Skip to content

Commit 9a19d1a

Browse files
committed
fix(ci): skip unit test detection when cross-compiling
1 parent 2030a8f commit 9a19d1a

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ include(CMakeCompiler)
88
include(CMakePlatforms)
99

1010
set(CPU_INSTRUCTION_SET false CACHE STRING "CPU instruction set")
11+
set(IS_CROSS_COMPILING false CACHE BOOL "Whether we are cross-compiling or not")
1112

1213
if(CMAKE_CONFIGURATION_TYPES)
1314
set(CMAKE_CONFIGURATION_TYPES Debug Release)

make.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,21 @@ def do_generate_solution(build_dir, cmake_script_dir, args):
292292
cpu = args.cpu
293293
config = args.config
294294

295+
is_arm64_cpu = False
296+
if platform.machine() == 'arm64' or platform.machine() == 'aarch64':
297+
is_arm64_cpu = True
298+
295299
if compiler:
296300
set_compiler_env(compiler, args)
297301

298302
extra_switches = ['--no-warn-unused-cli']
299303
extra_switches.append('-DCPU_INSTRUCTION_SET:STRING={}'.format(cpu))
300304
extra_switches.append('-DCMAKE_CXX_STANDARD:STRING={}'.format(args.cpp_version))
301305

306+
if platform.system() == 'Windows' and not is_arm64_cpu:
307+
if cpu == 'arm64' or cpu == 'arm64ec':
308+
extra_switches.append('-DIS_CROSS_COMPILING:BOOL=true')
309+
302310
if platform.system() == 'Windows':
303311
if os.path.sep == '\\':
304312
# Native Windows

tests/main_generic/CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ create_source_groups("${ALL_MAIN_SOURCE_FILES}" ${PROJECT_SOURCE_DIR})
1919

2020
add_executable(${PROJECT_NAME} ${ALL_TEST_SOURCE_FILES} ${ALL_MAIN_SOURCE_FILES})
2121

22-
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../../external/catch2/contrib")
23-
include(CTest)
24-
include(Catch)
25-
catch_discover_tests(${PROJECT_NAME})
22+
if(NOT IS_CROSS_COMPILING)
23+
# Don't attempt to detect unit tests if we are cross-compiling
24+
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../../external/catch2/contrib")
25+
include(CTest)
26+
include(Catch)
27+
catch_discover_tests(${PROJECT_NAME})
28+
endif()
2629

2730
setup_default_compiler_flags(${PROJECT_NAME})
2831

0 commit comments

Comments
 (0)