================
@@ -95,16 +86,20 @@ else()
)
endif()
+foreach( tool IN ITEMS llvm-link opt )
+ find_program( LLVM_TOOL_${tool} ${tool} PATHS ${LLVM_TOOLS_BINARY_DIR}
NO_DEFAULT_PATH )
+ if( NOT LLVM_TOOL_${tool} )
+ message( FATAL_ERROR "libclc toolchain incomplete - missing tool ${tool}!"
)
+ endif()
+ set( ${tool}_exe ${LLVM_TOOL_${tool}} )
+endforeach()
+
if( NOT LIBCLC_USE_SPIRV_BACKEND )
# llvm-spirv is an optional dependency, used to build spirv-* targets when
# the SPIR-V backend hasn't been requested. It may be provided in-tree or
# externally.
- if( TARGET llvm-spirv )
- get_host_tool_path( llvm-spirv LLVM_SPIRV llvm-spirv_exe llvm-spirv_target
)
----------------
zeroomega wrote:
This probably will break the cross compilation. The runtimes's CMake file
explicitly passes "-DLLVM_NATIVE_TOOL_DIR" to the sub-build to make
"get_host_tool_path" work to find the host tools for the cross compilation. But
it looks like that the logic won't work with the `find_program` approach after
the patch.
Here is a reproducer to trigger a host tool error:
```
mkdir -p /tmp/native_bin
touch /tmp/native_bin/llvm-link /tmp/native_bin/opt
chmod +x /tmp/native_bin/llvm-link /tmp/native_bin/opt
cmake -S runtimes -B /tmp/runtimes-build -GNinja \
-DLLVM_ENABLE_RUNTIMES=libclc \
-DLLVM_DEFAULT_TARGET_TRIPLE=nvptx64-nvidia-cuda \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DPACKAGE_VERSION=20.0.0 \
-DLLVM_NATIVE_TOOL_DIR=/tmp/native_bin
```
https://github.com/llvm/llvm-project/pull/217502
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits