@@ -25,7 +25,10 @@ include(CheckCXXCompilerFlag)
25
25
string (TOUPPER "${CMAKE_BUILD_TYPE} " U_CMAKE_BUILD_TYPE)
26
26
27
27
if (CMAKE_CXX_COMPILER_ID MATCHES Clang OR CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Intel)
28
- add_compile_options (-Wunused-parameter -Wextra -Wreorder -Wconversion -Wsign-conversion)
28
+
29
+ if (NOT EMSCRIPTEN)
30
+ add_compile_options (-Wunused-parameter -Wextra -Wreorder -Wconversion -Wsign-conversion)
31
+ endif ()
29
32
30
33
CHECK_CXX_COMPILER_FLAG(-march=native HAS_MARCH_NATIVE)
31
34
if (HAS_MARCH_NATIVE)
@@ -39,7 +42,6 @@ if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
39
42
endif ()
40
43
41
44
find_package (doctest)
42
- find_package (Threads)
43
45
44
46
set (XEUS_CPP_TESTS
45
47
main.cpp
@@ -48,22 +50,55 @@ set(XEUS_CPP_TESTS
48
50
49
51
add_executable (test_xeus_cpp ${XEUS_CPP_TESTS} )
50
52
51
- if (APPLE )
52
- set_target_properties (test_xeus_cpp PROPERTIES
53
- MACOSX_RPATH ON
53
+ if (EMSCRIPTEN)
54
+ target_link_libraries (test_xeus_cpp PRIVATE xeus-cpp-static doctest::doctest)
55
+
56
+ target_compile_options (test_xeus_cpp
57
+ PUBLIC "SHELL: -fexceptions"
58
+ )
59
+
60
+ target_link_options (test_xeus_cpp
61
+ PUBLIC "SHELL: -fexceptions"
62
+ PUBLIC "SHELL: -s MAIN_MODULE=1"
63
+ PUBLIC "SHELL: -s WASM_BIGINT"
64
+ PUBLIC "SHELL: -s ASSERTIONS=0"
65
+ PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1"
66
+ PUBLIC "SHELL: -s EXIT_RUNTIME=1"
67
+ PUBLIC "SHELL: -s STACK_SIZE=32mb"
68
+ PUBLIC "SHELL: -s INITIAL_MEMORY=128mb"
69
+ PUBLIC "SHELL: --preload-file ${SYSROOT_PATH} /include@/include"
70
+ PUBLIC "SHELL: --preload-file ../${XEUS_CPP_DATA_DIR} @/share/xeus-cpp"
71
+ PUBLIC "SHELL: --preload-file ../${XEUS_CPP_CONF_DIR} @/etc/xeus-cpp"
72
+ )
73
+
74
+ target_include_directories (test_xeus_cpp PRIVATE ${XEUS_CPP_INCLUDE_DIR} )
75
+
76
+ add_custom_command (TARGET test_xeus_cpp POST_BUILD
77
+ COMMAND ${CMAKE_COMMAND} -E copy
78
+ ${CMAKE_INSTALL_PREFIX} /lib/libclangCppInterOp.so
79
+ ${CMAKE_CURRENT_BINARY_DIR} /libclangCppInterOp.so
80
+ COMMENT "Copying libclangCppInterOp.so to the test directory"
54
81
)
55
82
else ()
83
+ find_package (Threads)
84
+
85
+ if (APPLE )
86
+ set_target_properties (test_xeus_cpp PROPERTIES
87
+ MACOSX_RPATH ON
88
+ )
89
+ else ()
90
+ set_target_properties (test_xeus_cpp PROPERTIES
91
+ BUILD_WITH_INSTALL_RPATH 1
92
+ SKIP_BUILD_RPATH FALSE
93
+ )
94
+ endif ()
95
+
56
96
set_target_properties (test_xeus_cpp PROPERTIES
57
- BUILD_WITH_INSTALL_RPATH 1
58
- SKIP_BUILD_RPATH FALSE
97
+ INSTALL_RPATH_USE_LINK_PATH TRUE
59
98
)
60
- endif ()
61
99
62
- set_target_properties (test_xeus_cpp PROPERTIES
63
- INSTALL_RPATH_USE_LINK_PATH TRUE
64
- )
65
-
66
- target_link_libraries (test_xeus_cpp xeus-cpp doctest::doctest ${CMAKE_THREAD_LIBS_INIT} )
67
- target_include_directories (test_xeus_cpp PRIVATE ${XEUS_CPP_INCLUDE_DIR} )
100
+ target_link_libraries (test_xeus_cpp xeus-cpp doctest::doctest ${CMAKE_THREAD_LIBS_INIT} )
101
+ target_include_directories (test_xeus_cpp PRIVATE ${XEUS_CPP_INCLUDE_DIR} )
68
102
69
- add_custom_target (xtest COMMAND test_xeus_cpp DEPENDS test_xeus_cpp)
103
+ add_custom_target (xtest COMMAND test_xeus_cpp DEPENDS test_xeus_cpp)
104
+ endif ()
0 commit comments