Skip to content

Commit 686e853

Browse files
authored
Apply local changes to get gtest attempting to run
1 parent a73cee6 commit 686e853

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed

lib/Interpreter/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ if(EMSCRIPTEN)
132132
SUFFIX ".wasm"
133133
)
134134

135+
add_custom_command(TARGET clangCppInterOp POST_BUILD
136+
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:clangCppInterOp> ${CMAKE_BINARY_DIR}/unittests/CppInterOp/
137+
)
135138
endif()
136139

137140
string(REPLACE ";" "\;" _VER CPPINTEROP_VERSION)

unittests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ endif()
99

1010
if(EMSCRIPTEN)
1111
# By removing gtest_main and gmock_main you avoid duplicate symbol error (probably not the best solution)
12-
set(gtest_libs gtest_main gtest gmock)
12+
set(gtest_libs gtest gmock)
1313
else()
1414
set(gtest_libs gtest gtest_main)
1515
# Clang prior than clang13 (I think) merges both gmock into gtest.

unittests/CppInterOp/CMakeLists.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@ set(LLVM_LINK_COMPONENTS
22
Support
33
)
44

5+
if(EMSCRIPTEN)
6+
set(INCLUDE_CUDA_TEST "")
7+
set(INCLUDE_MAIN_CCP "main.cpp")
8+
else()
9+
set(INCLUDE_CUDA_TEST "CUDATest.cpp")
10+
set(INCLUDE_MAIN_CPP "")
11+
endif()
12+
513
add_cppinterop_unittest(CppInterOpTests
6-
CUDATest.cpp
14+
${INCLUDE_CUDA_TEST}
715
EnumReflectionTest.cpp
816
FunctionReflectionTest.cpp
917
InterpreterTest.cpp
@@ -12,11 +20,12 @@ add_cppinterop_unittest(CppInterOpTests
1220
TypeReflectionTest.cpp
1321
Utils.cpp
1422
VariableReflectionTest.cpp
23+
${INCLUDE_MAIN_CPP}
1524
)
1625

1726
if(EMSCRIPTEN)
1827
set_target_properties(CppInterOpTests PROPERTIES
19-
LINK_FLAGS "-s MAIN_MODULE=1"
28+
LINK_FLAGS "-s MAIN_MODULE=1 -s WASM_BIGINT"
2029
)
2130
endif()
2231
target_link_libraries(CppInterOpTests
@@ -49,15 +58,15 @@ export_executable_symbols(CppInterOpTests)
4958

5059
unset(LLVM_LINK_COMPONENTS)
5160

52-
add_cppinterop_unittest(DynamicLibraryManagerTests DynamicLibraryManagerTest.cpp)
61+
add_cppinterop_unittest(DynamicLibraryManagerTests DynamicLibraryManagerTest.cpp ${INCLUDE_MAIN_CPP})
5362
target_link_libraries(DynamicLibraryManagerTests
5463
PRIVATE
5564
clangCppInterOp
5665
)
5766

5867
if(EMSCRIPTEN)
5968
target_link_options(DynamicLibraryManagerTests PRIVATE
60-
"SHELL: -s MAIN_MODULE=1"
69+
"SHELL: -s MAIN_MODULE=1 -s WASM_BIGINT"
6170
)
6271
endif()
6372

unittests/CppInterOp/TestSharedLib/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ set_output_directory(TestSharedLib
1717

1818

1919
if(EMSCRIPTEN)
20+
# FIXME: Remove export-all and replace with exporting individual undefined symbols
2021
set_target_properties(TestSharedLib PROPERTIES
2122
NO_SONAME 1
2223
COMPILE_FLAGS "-s SIDE_MODULE=1"

unittests/CppInterOp/main.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <gtest/gtest.h>
2+
3+
int main(int argc, char **argv) {
4+
::testing::InitGoogleTest(&argc, argv);
5+
return RUN_ALL_TESTS();
6+
}

0 commit comments

Comments
 (0)