CMakeLists.txt 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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(unit-test)
  5. # Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update
  6. # our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt
  7. # from 3rd parties that we should not alter. Therefore, in addition to
  8. # changing the `cmake_minimum_required()`, we should also add a configuration
  9. # here that is compatible with earlier versions.
  10. set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
  11. SET(CMAKE_BUILD_TYPE Debug)
  12. # add_definitions (-m32)
  13. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
  14. set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
  15. if(WAMR_BUILD_TARGET STREQUAL "X86_32")
  16. # 1) Force -m32
  17. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32" CACHE STRING "" FORCE)
  18. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32" CACHE STRING "" FORCE)
  19. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32" CACHE STRING "" FORCE)
  20. set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32" CACHE STRING "" FORCE)
  21. # 2) Make CMake prefer i386 libraries
  22. set(CMAKE_SYSTEM_PROCESSOR i386 CACHE STRING "" FORCE)
  23. set(CMAKE_LIBRARY_ARCHITECTURE "i386-linux-gnu" CACHE STRING "" FORCE)
  24. endif()
  25. # Fetch Google test
  26. include (FetchContent)
  27. if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24")
  28. FetchContent_Declare (
  29. googletest
  30. URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
  31. DOWNLOAD_EXTRACT_TIMESTAMP ON
  32. )
  33. else()
  34. FetchContent_Declare (
  35. googletest
  36. URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
  37. )
  38. endif()
  39. # Prevent overriding the parent project's compiler/linker
  40. # settings on Windows
  41. set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
  42. FetchContent_MakeAvailable(googletest)
  43. include(GoogleTest)
  44. enable_testing()
  45. add_subdirectory(wasm-vm)
  46. add_subdirectory(interpreter)
  47. add_subdirectory(wasm-c-api)
  48. add_subdirectory(libc-builtin)
  49. add_subdirectory(shared-utils)
  50. add_subdirectory(linear-memory-wasm)
  51. add_subdirectory(linear-memory-aot)
  52. add_subdirectory(linux-perf)
  53. add_subdirectory(gc)
  54. add_subdirectory(tid-allocator)
  55. add_subdirectory(unsupported-features)
  56. add_subdirectory(smart-tests)
  57. if (NOT WAMR_BUILD_TARGET STREQUAL "X86_32")
  58. add_subdirectory(aot-stack-frame)
  59. # should enable 32-bit llvm when X86_32
  60. add_subdirectory (aot)
  61. add_subdirectory (custom-section)
  62. add_subdirectory (compilation)
  63. # Fast-JIT or mem64 is not supported on X86_32
  64. add_subdirectory (running-modes)
  65. add_subdirectory (memory64)
  66. add_subdirectory (shared-heap)
  67. # HW_BOUND_CHECK is not supported on X86_32
  68. add_subdirectory (runtime-common)
  69. endif ()