@@ -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,54 @@ 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 ASSERTIONS=0"
64
+ PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1"
65
+ PUBLIC "SHELL: -s EXIT_RUNTIME=1"
66
+ PUBLIC "SHELL: -s STACK_SIZE=32mb"
67
+ PUBLIC "SHELL: -s INITIAL_MEMORY=128mb"
68
+ PUBLIC "SHELL: --preload-file ${SYSROOT_PATH} /include@/include"
69
+ PUBLIC "SHELL: --preload-file ../${XEUS_CPP_DATA_DIR} @/share/xeus-cpp"
70
+ PUBLIC "SHELL: --preload-file ../${XEUS_CPP_CONF_DIR} @/etc/xeus-cpp"
71
+ )
72
+
73
+ target_include_directories (test_xeus_cpp PRIVATE ${XEUS_CPP_INCLUDE_DIR} )
74
+
75
+ add_custom_command (TARGET test_xeus_cpp POST_BUILD
76
+ COMMAND ${CMAKE_COMMAND} -E copy
77
+ ${CMAKE_INSTALL_PREFIX} /lib/libclangCppInterOp.so
78
+ ${CMAKE_CURRENT_BINARY_DIR} /libclangCppInterOp.so
79
+ COMMENT "Copying libclangCppInterOp.so to the test directory"
54
80
)
55
81
else ()
82
+ find_package (Threads )
83
+
84
+ if (APPLE )
85
+ set_target_properties (test_xeus_cpp PROPERTIES
86
+ MACOSX_RPATH ON
87
+ )
88
+ else ()
89
+ set_target_properties (test_xeus_cpp PROPERTIES
90
+ BUILD_WITH_INSTALL_RPATH 1
91
+ SKIP_BUILD_RPATH FALSE
92
+ )
93
+ endif ()
94
+
56
95
set_target_properties (test_xeus_cpp PROPERTIES
57
- BUILD_WITH_INSTALL_RPATH 1
58
- SKIP_BUILD_RPATH FALSE
96
+ INSTALL_RPATH_USE_LINK_PATH TRUE
59
97
)
60
- endif ()
61
-
62
- set_target_properties (test_xeus_cpp PROPERTIES
63
- INSTALL_RPATH_USE_LINK_PATH TRUE
64
- )
65
98
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} )
99
+ target_link_libraries (test_xeus_cpp xeus-cpp doctest::doctest ${CMAKE_THREAD_LIBS_INIT} )
100
+ target_include_directories (test_xeus_cpp PRIVATE ${XEUS_CPP_INCLUDE_DIR} )
68
101
69
- add_custom_target (xtest COMMAND test_xeus_cpp DEPENDS test_xeus_cpp )
102
+ add_custom_target (xtest COMMAND test_xeus_cpp DEPENDS test_xeus_cpp )
103
+ endif ()
0 commit comments