CMakeLists.txt 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 (smart-test-interpreter)
  5. add_definitions (-DRUN_ON_LINUX)
  6. add_definitions (-Dattr_container_malloc=malloc)
  7. add_definitions (-Dattr_container_free=free)
  8. # add_definitions (-DWASM_ENABLE_WAMR_COMPILER=1)
  9. set(WAMR_BUILD_AOT 0)
  10. set(WAMR_BUILD_INTERP 1)
  11. set(WAMR_BUILD_JIT 0)
  12. set (WAMR_BUILD_LIBC_WASI 0)
  13. set (WAMR_BUILD_APP_FRAMEWORK 1)
  14. include (../../unit_common.cmake)
  15. include_directories (${CMAKE_CURRENT_SOURCE_DIR})
  16. file (GLOB_RECURSE source_all ${CMAKE_CURRENT_SOURCE_DIR}/*.cc)
  17. set (UNIT_SOURCE ${source_all})
  18. set (unit_test_sources
  19. ${UNIT_SOURCE}
  20. ${WAMR_RUNTIME_LIB_SOURCE}
  21. )
  22. add_executable (smart_test_classic-interpreter ${unit_test_sources})
  23. target_compile_definitions(smart_test_classic-interpreter PUBLIC -DWAMR_BUILD_FAST_INTERP=0)
  24. target_link_libraries (smart_test_classic-interpreter gtest_main)
  25. add_executable (smart_test_fast-interpreter ${unit_test_sources})
  26. target_compile_definitions(smart_test_fast-interpreter PUBLIC -DWAMR_BUILD_FAST_INTERP=1)
  27. target_link_libraries (smart_test_fast-interpreter gtest_main)
  28. # Copy WASM files to build directory for classic interpreter
  29. # fast interpreter uses the same WASM files
  30. add_custom_command(TARGET smart_test_classic-interpreter POST_BUILD
  31. COMMAND ${CMAKE_COMMAND} -E copy
  32. ${CMAKE_CURRENT_LIST_DIR}/wasm-apps/*.wasm
  33. ${CMAKE_CURRENT_BINARY_DIR}/
  34. COMMENT "Copy test wasm files to the directory of google test"
  35. )
  36. gtest_discover_tests(smart_test_classic-interpreter)
  37. gtest_discover_tests(smart_test_fast-interpreter)