Skip to content

Commit b632418

Browse files
committed
Specify --target when calling clang.
${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 b9f2e92 commit b632418

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
@@ -56,7 +56,12 @@ endif()
5656
add_custom_command(
5757
OUTPUT ${SYCL_JIT_RESOURCE_OBJ}
5858
COMMAND
59-
${clang_exe} ${SYCL_JIT_RESOURCE_CPP} -I ${CMAKE_CURRENT_SOURCE_DIR}/include -c -o ${SYCL_JIT_RESOURCE_OBJ} ${SYCL_JIT_RESOURCE_CXX_FLAGS}
59+
# ${clang_exe}'s default target is not necessarily ${LLVM_HOST_TRIPLE}: when
60+
# cross compiling, it will be whatever the host tools were configured with,
61+
# and when building a cross compiler, it will be
62+
# ${LLVM_DEFAULT_TARGET_TRIPLE}. Rather than special casing these, just always
63+
# specify --target=${LLVM_HOST_TRIPLE}.
64+
${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}
6065
DEPENDS
6166
${SYCL_JIT_RESOURCE_CPP}
6267
${CMAKE_CURRENT_SOURCE_DIR}/include/Resource.h

0 commit comments

Comments
 (0)