diff options
author | Harald van Dijk <harald.vandijk@codeplay.com> | 2024-07-02 16:26:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-02 16:26:58 +0100 |
commit | 5ee53d417f41e8f452255ded1ff6a522afe17f08 (patch) | |
tree | fa8a9d3462ad3ae79f51545c5830e390f1f05014 /libclc/cmake | |
parent | abb5bd3732cd0574aec4969d617b87921b5b1f8c (diff) | |
download | llvm-5ee53d417f41e8f452255ded1ff6a522afe17f08.zip llvm-5ee53d417f41e8f452255ded1ff6a522afe17f08.tar.gz llvm-5ee53d417f41e8f452255ded1ff6a522afe17f08.tar.bz2 |
[libclc] Fix cross in-tree builds (#97392)
When performing cross in-tree builds, we need native versions of various
tools, we cannot assume the cross builds that are part of the current
build are executable. LLVM provides the setup_host_tool function to
handle this, either picking up versions of tools from
LLVM_NATIVE_TOOL_DIR, or implicitly building native versions as needed.
Use it for libclc too.
LLVM's setup_host_tool function assumes the project is LLVM, so this
also needs libclc's project() to be conditional on it being built
standalone. Luckily, the only change this needs is using
CMAKE_CURRENT_SOURCE_DIR instead of PROJECT_SOURCE_DIR.
Diffstat (limited to 'libclc/cmake')
-rw-r--r-- | libclc/cmake/modules/AddLibclc.cmake | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libclc/cmake/modules/AddLibclc.cmake b/libclc/cmake/modules/AddLibclc.cmake index ea97e50..68b33ed 100644 --- a/libclc/cmake/modules/AddLibclc.cmake +++ b/libclc/cmake/modules/AddLibclc.cmake @@ -12,8 +12,8 @@ # * DEPENDENCIES <string> ... # List of extra dependencies to inject # -# Depends on the libclc::clang and libclc::llvm-as targets for compiling and -# assembling, respectively. +# Depends on the clang, llvm-as, and llvm-link targets for compiling, +# assembling, and linking, respectively. function(compile_to_bc) cmake_parse_arguments(ARG "" @@ -45,7 +45,7 @@ function(compile_to_bc) add_custom_command( OUTPUT ${ARG_OUTPUT}${TMP_SUFFIX} - COMMAND libclc::clang + COMMAND ${clang_exe} ${TARGET_ARG} ${PP_OPTS} ${ARG_EXTRA_OPTS} @@ -58,7 +58,7 @@ function(compile_to_bc) -x cl ${ARG_INPUT} DEPENDS - libclc::clang + ${clang_target} ${ARG_INPUT} ${ARG_DEPENDENCIES} DEPFILE ${ARG_OUTPUT}.d @@ -67,8 +67,8 @@ function(compile_to_bc) if( ${FILE_EXT} STREQUAL ".ll" ) add_custom_command( OUTPUT ${ARG_OUTPUT} - COMMAND libclc::llvm-as -o ${ARG_OUTPUT} ${ARG_OUTPUT}${TMP_SUFFIX} - DEPENDS libclc::llvm-as ${ARG_OUTPUT}${TMP_SUFFIX} + COMMAND ${llvm-as_exe} -o ${ARG_OUTPUT} ${ARG_OUTPUT}${TMP_SUFFIX} + DEPENDS ${llvm-as_target} ${ARG_OUTPUT}${TMP_SUFFIX} ) endif() endfunction() @@ -107,8 +107,8 @@ function(link_bc) add_custom_command( OUTPUT ${ARG_TARGET}.bc - COMMAND libclc::llvm-link -o ${ARG_TARGET}.bc ${LINK_INPUT_ARG} - DEPENDS libclc::llvm-link ${ARG_DEPENDENCIES} ${ARG_INPUTS} ${RSP_FILE} + COMMAND ${llvm-link_exe} -o ${ARG_TARGET}.bc ${LINK_INPUT_ARG} + DEPENDS ${llvm-link_target} ${ARG_DEPENDENCIES} ${ARG_INPUTS} ${RSP_FILE} ) add_custom_target( ${ARG_TARGET} ALL DEPENDS ${ARG_TARGET}.bc ) |