|
1 | | -# Copyright (C) 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 1 | +# Copyright (C) 2019 Intel Corporation. All rights reserved. |
2 | 2 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
3 | 3 |
|
4 | | -cmake_minimum_required (VERSION 3.14) |
| 4 | +cmake_minimum_required(VERSION 2.9) |
5 | 5 |
|
6 | | -project (wamr_unit_tests) |
| 6 | +project(unit-test) |
7 | 7 |
|
8 | | -include (CTest) |
| 8 | +SET(CMAKE_BUILD_TYPE Debug) |
9 | 9 |
|
10 | | -if (NOT DEFINED WAMR_BUILD_INTERP) |
11 | | - # Enable Interpreter by default |
12 | | - set (WAMR_BUILD_INTERP 1) |
13 | | -endif () |
| 10 | +# add_definitions (-m32) |
| 11 | +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") |
| 12 | +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") |
14 | 13 |
|
15 | | -if (NOT DEFINED WAMR_BUILD_PLATFORM) |
16 | | - string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM) |
17 | | -endif () |
| 14 | +if(WAMR_BUILD_TARGET STREQUAL "X86_32") |
| 15 | + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32") |
| 16 | + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") |
| 17 | +endif() |
18 | 18 |
|
19 | | -set (WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..) |
20 | | -include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) |
21 | | -add_library (vmlib ${WAMR_RUNTIME_LIB_SOURCE}) |
| 19 | +# Prevent overriding the parent project's compiler/linker |
| 20 | +# settings on Windows |
| 21 | +set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) |
22 | 22 |
|
| 23 | +# Fetch Google test |
23 | 24 | include (FetchContent) |
24 | 25 | FetchContent_Declare ( |
25 | 26 | googletest |
26 | 27 | URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip |
27 | 28 | ) |
28 | | -# For Windows: Prevent overriding the parent project's compiler/linker settings |
29 | | -set (gtest_force_shared_crt ON CACHE BOOL "" FORCE) |
30 | 29 | FetchContent_MakeAvailable (googletest) |
31 | 30 |
|
32 | | -include (GoogleTest) |
33 | | - |
34 | | -add_library (wamr_gtest_main main.cpp) |
35 | | -target_link_libraries (wamr_gtest_main PUBLIC gtest vmlib) |
36 | | - |
37 | | -function (create_wamr_unit_test test_name) |
38 | | - set (sources ${ARGN}) |
39 | | - add_executable (${test_name} ${sources}) |
40 | | - target_link_libraries ( |
41 | | - ${test_name} |
42 | | - wamr_gtest_main |
43 | | - vmlib |
44 | | - ${LLVM_AVAILABLE_LIBS} |
45 | | - ) |
46 | | - gtest_discover_tests (${test_name}) |
47 | | - endfunction () |
48 | | - |
49 | | -if (WAMR_BUILD_LIB_WASI_THREADS EQUAL 1) |
50 | | - include (${IWASM_DIR}/libraries/lib-wasi-threads/unit-test/lib_wasi_threads_unit_tests.cmake) |
51 | | -endif () |
| 31 | +SET(GOOGLETEST_INCLUDED 1) |
| 32 | + |
| 33 | +include(GoogleTest) |
| 34 | +enable_testing() |
| 35 | + |
| 36 | +add_subdirectory(wasm-vm) |
| 37 | +add_subdirectory(interpreter) |
| 38 | +add_subdirectory(aot) |
| 39 | +add_subdirectory(wasm-c-api) |
| 40 | +add_subdirectory(libc-builtin) |
| 41 | +add_subdirectory(shared-utils) |
| 42 | +add_subdirectory(running-modes) |
| 43 | +add_subdirectory(runtime-common) |
| 44 | +add_subdirectory(custom-section) |
| 45 | +add_subdirectory(compilation) |
| 46 | +add_subdirectory(linear-memory-wasm) |
| 47 | +add_subdirectory(linear-memory-aot) |
| 48 | +add_subdirectory(aot-stack-frame) |
| 49 | +add_subdirectory(linux-perf) |
| 50 | +add_subdirectory(gc) |
| 51 | +add_subdirectory(memory64) |
| 52 | +add_subdirectory(tid-allocator) |
0 commit comments