Skip to content

Commit ae97908

Browse files
authored
[SYCL RTC] Specify --target when compiling resource.cpp (#20013)
`${clang_exe}` may not default to the same target as `${CMAKE_CXX_COMPILER}`. This change is not sufficient to fix all cases, as it does not ensure compatibility with target flags in `${CMAKE_CXX_FLAGS}`, but handles the most common cases when cross compiling.
1 parent b239891 commit ae97908

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sycl-jit/jit-compiler/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ endif()
5959
add_custom_command(
6060
OUTPUT ${SYCL_JIT_RESOURCE_OBJ}
6161
COMMAND
62-
${clang_exe} ${SYCL_JIT_RESOURCE_CPP} -I ${CMAKE_CURRENT_SOURCE_DIR}/include -c -o ${SYCL_JIT_RESOURCE_OBJ} ${SYCL_JIT_RESOURCE_CXX_FLAGS}
62+
# ${clang_exe}'s default target is not necessarily ${LLVM_HOST_TRIPLE}: when
63+
# cross compiling, it will be whatever the host tools were configured with,
64+
# and when building a cross compiler, it will be
65+
# ${LLVM_DEFAULT_TARGET_TRIPLE}. Rather than special casing these, just always
66+
# specify --target=${LLVM_HOST_TRIPLE}.
67+
${clang_exe} --target=${LLVM_HOST_TRIPLE} ${SYCL_JIT_RESOURCE_CPP} -I ${CMAKE_CURRENT_SOURCE_DIR}/include -c -o ${SYCL_JIT_RESOURCE_OBJ} ${SYCL_JIT_RESOURCE_CXX_FLAGS}
6368
DEPENDS
6469
${SYCL_JIT_RESOURCE_CPP}
6570
${CMAKE_CURRENT_SOURCE_DIR}/include/Resource.h

0 commit comments

Comments
 (0)