Skip to content

Commit 8503d92

Browse files
committed
fix cross-compilation issues
1 parent 041418f commit 8503d92

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.github/workflows/windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ jobs:
4949
with:
5050
runner: windows-2025
5151
build_type: ${{ matrix.build_type }}
52-
cmake_args: '-DADA_DEVELOPMENT_CHECKS=ON -DCMAKE_CXX_COMPILER=clang-cl'
52+
cmake_args: '-DADA_DEVELOPMENT_CHECKS=ON -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl'

tests/CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,18 @@ endif()
5252
macro(add_gtest_test exe cpp)
5353
add_executable(${exe} ${cpp})
5454
target_link_libraries(${exe} PRIVATE simdjson GTest::gtest_main)
55-
gtest_discover_tests(${exe} PROPERTIES TEST_DISCOVERY_TIMEOUT 600)
55+
# Use PRE_TEST discovery mode for cross-compilation where the test binary
56+
# cannot be executed at build time (e.g., LoongArch via QEMU).
57+
# Use POST_BUILD (default) for native builds to avoid DLL/PATH issues on Windows.
58+
if(CMAKE_CROSSCOMPILING)
59+
set(GTEST_DISCOVERY_MODE PRE_TEST)
60+
else()
61+
set(GTEST_DISCOVERY_MODE POST_BUILD)
62+
endif()
63+
gtest_discover_tests(${exe}
64+
DISCOVERY_MODE ${GTEST_DISCOVERY_MODE}
65+
PROPERTIES TEST_DISCOVERY_TIMEOUT 600
66+
)
5667
set_source_files_properties(${cpp} PROPERTIES SKIP_LINTING ON)
5768
endmacro()
5869

0 commit comments

Comments
 (0)