-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
52 lines (49 loc) · 1.77 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
cmake_minimum_required(VERSION 3.12)
project(recyclone)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-g CXX_COVERAGE)
add_library(recyclone INTERFACE)
target_compile_features(recyclone INTERFACE cxx_std_20)
target_include_directories(recyclone INTERFACE include)
if(EMSCRIPTEN)
target_compile_definitions(recyclone INTERFACE RECYCLONE__COOPERATIVE)
target_compile_options(recyclone INTERFACE "-fexceptions;-pthread;-Wno-deprecated-volatile")
target_link_libraries(recyclone INTERFACE "-pthread;-s NO_DISABLE_EXCEPTION_CATCHING")
else()
target_link_libraries(recyclone INTERFACE Threads::Threads)
endif()
enable_testing()
function(do_test_from name source)
add_executable(test_${name} test/test_${source}.cc)
if(EMSCRIPTEN)
target_compile_options(test_${name} PRIVATE "-g")
target_link_libraries(test_${name} recyclone "-g;-s ALLOW_MEMORY_GROWTH;-s EXIT_RUNTIME;-s PROXY_TO_PTHREAD")
add_test(NAME ${name} COMMAND node test_${name}.js)
add_test(NAME ${name}-collect COMMAND node test_${name}.js 0)
else()
target_compile_options(test_${name} PRIVATE "$<$<BOOL:${CXX_COVERAGE}>:-g;--coverage>")
target_link_libraries(test_${name} recyclone "$<$<BOOL:${CXX_COVERAGE}>:--coverage>")
add_test(NAME ${name} COMMAND test_${name})
add_test(NAME ${name}-collect COMMAND test_${name} 0)
endif()
endfunction()
function(do_test name)
do_test_from(${name} ${name})
if(NOT EMSCRIPTEN)
do_test_from(${name}-co ${name})
target_compile_definitions(test_${name}-co PRIVATE RECYCLONE__COOPERATIVE)
endif()
endfunction()
do_test(empty)
do_test(collector)
do_test(cyclic)
do_test(large)
do_test(threads)
do_test(finalizer)
do_test(background)
do_test(monitor)
do_test(weak_pointer)
do_test(type_object)
do_test(region)