unit_common.cmake 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. if (NOT DEFINED WAMR_BUILD_PLATFORM)
  4. set (WAMR_BUILD_PLATFORM "linux")
  5. endif ()
  6. enable_language (ASM)
  7. # Usually, test cases should identify their unique
  8. # complation flags to implement their test plan
  9. # Set WAMR_BUILD_TARGET, currently values supported:
  10. # "X86_64", "AMD_64", "X86_32", "ARM_32", "MIPS_32", "XTENSA_32"
  11. if (NOT DEFINED WAMR_BUILD_TARGET)
  12. if (CMAKE_SIZEOF_VOID_P EQUAL 8)
  13. # Build as X86_64 by default in 64-bit platform
  14. set (WAMR_BUILD_TARGET "X86_64")
  15. else ()
  16. # Build as X86_32 by default in 32-bit platform
  17. set (WAMR_BUILD_TARGET "X86_32")
  18. endif ()
  19. endif ()
  20. set (WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
  21. # include the build config template file
  22. include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
  23. include_directories (${SHARED_DIR}/include
  24. ${IWASM_DIR}/include)
  25. include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
  26. # Add helper classes
  27. include_directories(${CMAKE_CURRENT_LIST_DIR}/common)
  28. # config_common.cmake only sets up the llvm environment when
  29. # JIT is enabled. but in unit tests, we need llvm environment
  30. # for aot compilation.
  31. if (NOT DEFINED LLVM_DIR)
  32. set (LLVM_SRC_ROOT "${WAMR_ROOT_DIR}/core/deps/llvm")
  33. set (LLVM_BUILD_ROOT "${LLVM_SRC_ROOT}/build")
  34. if (NOT EXISTS "${LLVM_BUILD_ROOT}")
  35. message (FATAL_ERROR "Cannot find LLVM dir: ${LLVM_BUILD_ROOT}")
  36. endif ()
  37. set (CMAKE_PREFIX_PATH "${LLVM_BUILD_ROOT};${CMAKE_PREFIX_PATH}")
  38. set (LLVM_DIR ${LLVM_BUILD_ROOT}/lib/cmake/llvm)
  39. endif ()
  40. message(STATUS "unit_common.cmake included")