CMakeLists.txt 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. cmake_minimum_required(VERSION 3.14)
  4. project(test-running-modes)
  5. # Compile wasm modules
  6. add_subdirectory(wasm-apps)
  7. add_definitions(-DRUN_ON_LINUX)
  8. set(WAMR_BUILD_LIBC_WASI 1)
  9. set(WAMR_BUILD_APP_FRAMEWORK 0)
  10. set(WAMR_BUILD_JIT 1)
  11. set(WAMR_BUILD_FAST_JIT 1)
  12. # if only load this CMake other than load it as subdirectory
  13. include(../unit_common.cmake)
  14. set(LLVM_SRC_ROOT "${WAMR_ROOT_DIR}/core/deps/llvm")
  15. if (NOT EXISTS "${LLVM_SRC_ROOT}/build")
  16. message(FATAL_ERROR "Cannot find LLVM dir: ${LLVM_SRC_ROOT}/build")
  17. endif ()
  18. set(CMAKE_PREFIX_PATH "${LLVM_SRC_ROOT}/build;${CMAKE_PREFIX_PATH}")
  19. find_package(LLVM REQUIRED CONFIG)
  20. include_directories(${LLVM_INCLUDE_DIRS})
  21. add_definitions(${LLVM_DEFINITIONS})
  22. message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
  23. message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
  24. include(${IWASM_DIR}/compilation/iwasm_compl.cmake)
  25. include_directories(${CMAKE_CURRENT_SOURCE_DIR})
  26. file(GLOB_RECURSE source_all ${CMAKE_CURRENT_SOURCE_DIR}/*.cc)
  27. set(UNIT_SOURCE ${source_all})
  28. aux_source_directory(. SRC_LIST)
  29. set(unit_test_sources
  30. ${UNIT_SOURCE}
  31. ${WAMR_RUNTIME_LIB_SOURCE}
  32. ${UNCOMMON_SHARED_SOURCE}
  33. ${SRC_LIST}
  34. )
  35. # Now simply link against gtest or gtest_main as needed. Eg
  36. add_executable(wasm_running_modes_test ${unit_test_sources})
  37. target_link_libraries(wasm_running_modes_test ${LLVM_AVAILABLE_LIBS} gtest_main)
  38. gtest_discover_tests(wasm_running_modes_test)