|
| 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(enhanced_constants_test) |
| 7 | + |
| 8 | +# Platform-specific definitions |
| 9 | +add_definitions(-DRUN_ON_LINUX) |
| 10 | + |
| 11 | +set(WAMR_BUILD_INTERP 1) |
| 12 | +set(WAMR_BUILD_AOT 1) |
| 13 | +set(WAMR_BUILD_JIT 1) |
| 14 | +set(WAMR_BUILD_FAST_JIT 0) |
| 15 | +set(WAMR_BUILD_LIBC_WASI 1) |
| 16 | +set(WAMR_BUILD_APP_FRAMEWORK 0) |
| 17 | +set(WAMR_BUILD_MEMORY_PROFILING 0) |
| 18 | + |
| 19 | +# Include shared unit test configuration |
| 20 | +include(../../unit_common.cmake) |
| 21 | + |
| 22 | +find_package(LLVM REQUIRED CONFIG) |
| 23 | +include_directories(${LLVM_INCLUDE_DIRS}) |
| 24 | +add_definitions(${LLVM_DEFINITIONS}) |
| 25 | + |
| 26 | +include(${IWASM_DIR}/compilation/iwasm_compl.cmake) |
| 27 | + |
| 28 | +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
| 29 | + |
| 30 | +set(i32_const_test_sources |
| 31 | + enhanced_i32_const_test.cc |
| 32 | + ${WAMR_RUNTIME_LIB_SOURCE} |
| 33 | + ${IWASM_COMPL_SOURCE} |
| 34 | + ${UNCOMMON_SHARED_SOURCE} |
| 35 | + ) |
| 36 | + |
| 37 | +# Prepare unit test sources for i64.const test |
| 38 | +# set(i64_const_test_sources |
| 39 | +# enhanced_i64_const_test.cc |
| 40 | +# ${WAMR_RUNTIME_LIB_SOURCE} |
| 41 | +# ${IWASM_COMPL_SOURCE} |
| 42 | +# ${UNCOMMON_SHARED_SOURCE} |
| 43 | +# ) |
| 44 | + |
| 45 | +# Prepare unit test sources for f32.const test |
| 46 | +set(f32_const_test_sources |
| 47 | + enhanced_f32_const_test.cc |
| 48 | + ${WAMR_RUNTIME_LIB_SOURCE} |
| 49 | + ${IWASM_COMPL_SOURCE} |
| 50 | + ${UNCOMMON_SHARED_SOURCE} |
| 51 | + ) |
| 52 | + |
| 53 | +# Prepare unit test sources for f64.const test |
| 54 | +# set(f64_const_test_sources |
| 55 | +# enhanced_f64_const_test.cc |
| 56 | +# ${WAMR_RUNTIME_LIB_SOURCE} |
| 57 | +# ${IWASM_COMPL_SOURCE} |
| 58 | +# ${UNCOMMON_SHARED_SOURCE} |
| 59 | +# ) |
| 60 | + |
| 61 | +# Create test executables |
| 62 | +add_executable(enhanced_i32_const_test ${i32_const_test_sources}) |
| 63 | +# add_executable(enhanced_i64_const_test ${i64_const_test_sources}) |
| 64 | +add_executable(enhanced_f32_const_test ${f32_const_test_sources}) |
| 65 | +# add_executable(enhanced_f64_const_test ${f64_const_test_sources}) |
| 66 | + |
| 67 | + |
| 68 | +# Link required libraries |
| 69 | +target_link_libraries(enhanced_i32_const_test ${LLVM_AVAILABLE_LIBS} gtest_main) |
| 70 | +# target_link_libraries(enhanced_i64_const_test ${LLVM_AVAILABLE_LIBS} gtest_main) |
| 71 | +target_link_libraries(enhanced_f32_const_test ${LLVM_AVAILABLE_LIBS} gtest_main) |
| 72 | +# target_link_libraries(enhanced_f64_const_test ${LLVM_AVAILABLE_LIBS} gtest_main) |
| 73 | + |
| 74 | +# Post-build: Copy WASM test files to build directory for all tests |
| 75 | +add_custom_command(TARGET enhanced_i32_const_test POST_BUILD |
| 76 | + COMMAND ${CMAKE_COMMAND} -E copy_directory |
| 77 | + ${CMAKE_CURRENT_SOURCE_DIR}/wasm-apps |
| 78 | + $<TARGET_FILE_DIR:enhanced_i32_const_test>/wasm-apps |
| 79 | + COMMENT "Copying WASM test files to i32_const test build directory" |
| 80 | +) |
| 81 | + |
| 82 | +# add_custom_command(TARGET enhanced_i64_const_test POST_BUILD |
| 83 | +# COMMAND ${CMAKE_COMMAND} -E copy_directory |
| 84 | +# ${CMAKE_CURRENT_SOURCE_DIR}/wasm-apps |
| 85 | +# $<TARGET_FILE_DIR:enhanced_i64_const_test>/wasm-apps |
| 86 | +# COMMENT "Copying WASM test files to i64_const test build directory" |
| 87 | +# ) |
| 88 | + |
| 89 | +add_custom_command(TARGET enhanced_f32_const_test POST_BUILD |
| 90 | + COMMAND ${CMAKE_COMMAND} -E copy_directory |
| 91 | + ${CMAKE_CURRENT_SOURCE_DIR}/wasm-apps |
| 92 | + $<TARGET_FILE_DIR:enhanced_f32_const_test>/wasm-apps |
| 93 | + COMMENT "Copying WASM test files to f32_const test build directory" |
| 94 | +) |
| 95 | + |
| 96 | +# add_custom_command(TARGET enhanced_f64_const_test POST_BUILD |
| 97 | +# COMMAND ${CMAKE_COMMAND} -E copy_directory |
| 98 | +# ${CMAKE_CURRENT_SOURCE_DIR}/wasm-apps |
| 99 | +# $<TARGET_FILE_DIR:enhanced_f64_const_test>/wasm-apps |
| 100 | +# COMMENT "Copying WASM test files to f64_const test build directory" |
| 101 | +# ) |
| 102 | + |
| 103 | +include(GoogleTest) |
| 104 | + |
| 105 | +gtest_discover_tests(enhanced_i32_const_test |
| 106 | + PROPERTIES RUN_SERIAL TRUE |
| 107 | + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
| 108 | + |
| 109 | +# gtest_discover_tests(enhanced_i64_const_test |
| 110 | +# PROPERTIES RUN_SERIAL TRUE |
| 111 | +# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
| 112 | + |
| 113 | +gtest_discover_tests(enhanced_f32_const_test |
| 114 | + PROPERTIES RUN_SERIAL TRUE |
| 115 | + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
| 116 | + |
| 117 | +# gtest_discover_tests(enhanced_f64_const_test |
| 118 | +# PROPERTIES RUN_SERIAL TRUE |
| 119 | +# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
0 commit comments