|
| 1 | +# Copyright (C) 2019 Intel Corporation. All rights reserved. |
| 2 | +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | + |
| 4 | +cmake_minimum_required(VERSION 3.14) |
| 5 | + |
| 6 | +project (smart-test-interpreter) |
| 7 | + |
| 8 | +add_definitions (-DRUN_ON_LINUX) |
| 9 | + |
| 10 | +add_definitions (-Dattr_container_malloc=malloc) |
| 11 | +add_definitions (-Dattr_container_free=free) |
| 12 | +# add_definitions (-DWASM_ENABLE_WAMR_COMPILER=1) |
| 13 | + |
| 14 | +set(WAMR_BUILD_AOT 0) |
| 15 | +set(WAMR_BUILD_INTERP 1) |
| 16 | +set(WAMR_BUILD_JIT 0) |
| 17 | +set (WAMR_BUILD_LIBC_WASI 0) |
| 18 | +set (WAMR_BUILD_APP_FRAMEWORK 1) |
| 19 | + |
| 20 | +include (../../unit_common.cmake) |
| 21 | + |
| 22 | +include_directories (${CMAKE_CURRENT_SOURCE_DIR}) |
| 23 | + |
| 24 | +file (GLOB_RECURSE source_all ${CMAKE_CURRENT_SOURCE_DIR}/*.cc) |
| 25 | + |
| 26 | +set (UNIT_SOURCE ${source_all}) |
| 27 | + |
| 28 | +set (unit_test_sources |
| 29 | + ${UNIT_SOURCE} |
| 30 | + ${WAMR_RUNTIME_LIB_SOURCE} |
| 31 | +) |
| 32 | + |
| 33 | +add_executable (smart_test_classic-interpreter ${unit_test_sources}) |
| 34 | +target_compile_definitions(smart_test_classic-interpreter PUBLIC -DWAMR_BUILD_FAST_INTERP=0) |
| 35 | +target_link_libraries (smart_test_classic-interpreter gtest_main) |
| 36 | + |
| 37 | +add_executable (smart_test_fast-interpreter ${unit_test_sources}) |
| 38 | +target_compile_definitions(smart_test_fast-interpreter PUBLIC -DWAMR_BUILD_FAST_INTERP=1) |
| 39 | +target_link_libraries (smart_test_fast-interpreter gtest_main) |
| 40 | + |
| 41 | +# Copy WASM files to build directory for classic interpreter |
| 42 | +# fast interpreter uses the same WASM files |
| 43 | +add_custom_command(TARGET smart_test_classic-interpreter POST_BUILD |
| 44 | + COMMAND ${CMAKE_COMMAND} -E copy |
| 45 | + ${CMAKE_CURRENT_LIST_DIR}/wasm-apps/*.wasm |
| 46 | + ${CMAKE_CURRENT_BINARY_DIR}/ |
| 47 | + COMMENT "Copy test wasm files to the directory of google test" |
| 48 | +) |
| 49 | + |
| 50 | +gtest_discover_tests(smart_test_classic-interpreter) |
| 51 | +gtest_discover_tests(smart_test_fast-interpreter) |
0 commit comments