CMakeLists.txt 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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-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. set (WAMR_BUILD_FAST_INTERP 0)
  12. include (../unit_common.cmake)
  13. include_directories (${CMAKE_CURRENT_SOURCE_DIR})
  14. file (GLOB_RECURSE source_all ${CMAKE_CURRENT_SOURCE_DIR}/*.cc)
  15. set (UNIT_SOURCE ${source_all})
  16. set (unit_test_sources
  17. ${UNIT_SOURCE}
  18. ${WAMR_RUNTIME_LIB_SOURCE}
  19. ${UNCOMMON_SHARED_SOURCE}
  20. ${IWASM_COMPL_SOURCE}
  21. )
  22. # Test case: .aot file with hardware bound check.
  23. add_executable (linear_memory_test_aot ${unit_test_sources})
  24. target_link_libraries (linear_memory_test_aot gtest_main)
  25. gtest_discover_tests(linear_memory_test_aot)
  26. target_compile_definitions(linear_memory_test_aot PRIVATE WAMR_DISABLE_HW_BOUND_CHECK=0)
  27. # Ensure that aot compiled is completed before linear_memory_test_aot is built
  28. set(dummy_output "${CMAKE_CURRENT_BINARY_DIR}/dummy_output")
  29. add_custom_command(OUTPUT ${dummy_output}
  30. COMMAND ./build_aot.sh
  31. COMMAND ${CMAKE_COMMAND} -E touch ${dummy_output}
  32. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  33. DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/build_aot.sh
  34. COMMENT "Executing script to compile aot files"
  35. VERBATIM
  36. )
  37. add_custom_target(
  38. RunBuildAot ALL
  39. DEPENDS ${dummy_output}
  40. )
  41. add_dependencies(linear_memory_test_aot RunBuildAot)
  42. add_custom_command(TARGET linear_memory_test_aot POST_BUILD
  43. COMMAND ${CMAKE_COMMAND} -E copy
  44. ${CMAKE_CURRENT_SOURCE_DIR}/build/*.aot
  45. ${CMAKE_CURRENT_BINARY_DIR}
  46. COMMENT "Copy aot files to the directory: build/linear-memory-aot."
  47. )
  48. # Test case: .aot file with no hardware bound check.
  49. add_executable (linear_memory_test_aot_no_hw_bound ${unit_test_sources})
  50. target_link_libraries (linear_memory_test_aot_no_hw_bound gtest_main)
  51. gtest_discover_tests(linear_memory_test_aot_no_hw_bound)
  52. target_compile_definitions(linear_memory_test_aot_no_hw_bound PRIVATE WAMR_DISABLE_HW_BOUND_CHECK=1)