CMakeLists.txt 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. cmake_minimum_required(VERSION 2.9)
  4. project (test-linear-memory-aot)
  5. add_definitions (-DRUN_ON_LINUX)
  6. set (WAMR_BUILD_LIBC_WASI 0)
  7. set (WAMR_BUILD_APP_FRAMEWORK 0)
  8. set (WAMR_BUILD_MEMORY_PROFILING 1)
  9. set (WAMR_BUILD_INTERP 0)
  10. set (WAMR_BUILD_AOT 1)
  11. include (../unit_common.cmake)
  12. include_directories (${CMAKE_CURRENT_SOURCE_DIR})
  13. file (GLOB_RECURSE source_all ${CMAKE_CURRENT_SOURCE_DIR}/*.cc)
  14. set (UNIT_SOURCE ${source_all})
  15. set (unit_test_sources
  16. ${UNIT_SOURCE}
  17. ${WAMR_RUNTIME_LIB_SOURCE}
  18. ${UNCOMMON_SHARED_SOURCE}
  19. ${SRC_LIST}
  20. ${PLATFORM_SHARED_SOURCE}
  21. ${UTILS_SHARED_SOURCE}
  22. ${MEM_ALLOC_SHARED_SOURCE}
  23. ${LIB_HOST_AGENT_SOURCE}
  24. ${NATIVE_INTERFACE_SOURCE}
  25. ${LIBC_BUILTIN_SOURCE}
  26. ${IWASM_COMMON_SOURCE}
  27. ${IWASM_INTERP_SOURCE}
  28. ${IWASM_AOT_SOURCE}
  29. ${IWASM_COMPL_SOURCE}
  30. ${WASM_APP_LIB_SOURCE_ALL}
  31. )
  32. # Test case: .aot file with hardware bound check.
  33. add_executable (linear_memory_test_aot ${unit_test_sources})
  34. target_link_libraries (linear_memory_test_aot gtest_main)
  35. gtest_discover_tests(linear_memory_test_aot)
  36. target_compile_definitions(linear_memory_test_aot PRIVATE WAMR_DISABLE_HW_BOUND_CHECK=0)
  37. # Ensure that aot compiled is completed before linear_memory_test_aot is built
  38. set(dummy_output "${CMAKE_CURRENT_BINARY_DIR}/dummy_output")
  39. add_custom_command(OUTPUT ${dummy_output}
  40. COMMAND ./build_aot.sh
  41. COMMAND ${CMAKE_COMMAND} -E touch ${dummy_output}
  42. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  43. DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/build_aot.sh
  44. COMMENT "Executing script to compile aot files"
  45. VERBATIM
  46. )
  47. add_custom_target(
  48. RunBuildAot ALL
  49. DEPENDS ${dummy_output}
  50. )
  51. add_dependencies(linear_memory_test_aot RunBuildAot)
  52. add_custom_command(TARGET linear_memory_test_aot POST_BUILD
  53. COMMAND ${CMAKE_COMMAND} -E copy
  54. ${CMAKE_CURRENT_SOURCE_DIR}/build/*.aot
  55. ${CMAKE_CURRENT_BINARY_DIR}
  56. COMMENT "Copy aot files to the directory: build/linear-memory-aot."
  57. )
  58. # Test case: .aot file with no hardware bound check.
  59. add_executable (linear_memory_test_aot_no_hw_bound ${unit_test_sources})
  60. target_link_libraries (linear_memory_test_aot_no_hw_bound gtest_main)
  61. gtest_discover_tests(linear_memory_test_aot_no_hw_bound)
  62. target_compile_definitions(linear_memory_test_aot_no_hw_bound PRIVATE WAMR_DISABLE_HW_BOUND_CHECK=1)