Skip to content

Commit 292801c

Browse files
[SYCL] Add CMake option to pass "--gcc-toolchain" for syclcompat unittests (#10791)
The same has been done in libdevice in #7771. We need this internally where we have a build on an older RHEL with gcc in non-system location.
1 parent 70ce4b0 commit 292801c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sycl/cmake/modules/AddSYCLLibraryUnitTest.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
set(SYCL_COMPATH_UNITTEST_GCC_TOOLCHAIN "" CACHE PATH "Path to GCC installation")
12
# add_sycl_library_unittest(test_suite_name sycl_extra_flags
23
# file1.cpp file2.cpp ...)
34
#
@@ -26,6 +27,12 @@ macro(add_sycl_library_unittest test_suite_name)
2627
set(_LLVM_TARGET_DEPENDENCIES
2728
"llvm_gtest_main;llvm_gtest;LLVMTestingSupport;LLVMSupport;LLVMDemangle")
2829

30+
if (NOT SYCL_COMPAT_UNITTEST_GCC_TOOLCHAIN STREQUAL "")
31+
set(_GCC_TOOLCHAIN "--gcc-toolchain=${SYCL_COMPAT_UNITTEST_GCC_TOOLCHAIN}")
32+
else()
33+
set(_GCC_TOOLCHAIN "")
34+
endif()
35+
2936
foreach(_lib ${_LLVM_TARGET_DEPENDENCIES})
3037
list(APPEND _LIBRARIES $<TARGET_LINKER_FILE:${_lib}>)
3138
endforeach()
@@ -53,6 +60,7 @@ macro(add_sycl_library_unittest test_suite_name)
5360

5461
add_custom_target(${_BIN_TARGET}
5562
COMMAND ${DEVICE_COMPILER_EXECUTABLE} -fsycl ${ARG_SOURCES}
63+
${_GCC_TOOLCHAIN}
5664
-o ${_OUTPUT_BIN}
5765
${ARG_SYCL_EXTRA_FLAGS}
5866
${_INTERNAL_EXTRA_FLAGS}

0 commit comments

Comments
 (0)