diff options
author | Joseph Huber <huberjn@outlook.com> | 2024-02-22 18:55:46 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-22 18:55:46 -0600 |
commit | 7a5c01dbca3ddfc6dd87775ec90346783c8e2c73 (patch) | |
tree | 0fd8a5a831f8d6b7cba45c18c2ba1dede9b83182 /libc/cmake/modules | |
parent | 9e84a22e6989494709d30a03ce9b304956fc0ae2 (diff) | |
download | llvm-7a5c01dbca3ddfc6dd87775ec90346783c8e2c73.zip llvm-7a5c01dbca3ddfc6dd87775ec90346783c8e2c73.tar.gz llvm-7a5c01dbca3ddfc6dd87775ec90346783c8e2c73.tar.bz2 |
[libc] Search the compiler's path for GPU utility tools (#82712)
Summary:
We need some extra tools for the GPU build. Normally we search for these
from the build itself, but in the case of a `LLVM_PROJECTS_BUILD` or
some other kind of external build, this directory will not be populated.
However, the GPU build already requires that the compiler is an
up-to-date clang, which should always have these present next to the
binary. Simply add this as a fallback search path. Generally we want it
to be the second, because it would pick up someone install and then
become stale.
Diffstat (limited to 'libc/cmake/modules')
-rw-r--r-- | libc/cmake/modules/prepare_libc_gpu_build.cmake | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libc/cmake/modules/prepare_libc_gpu_build.cmake b/libc/cmake/modules/prepare_libc_gpu_build.cmake index 75beef8..752182f 100644 --- a/libc/cmake/modules/prepare_libc_gpu_build.cmake +++ b/libc/cmake/modules/prepare_libc_gpu_build.cmake @@ -17,9 +17,10 @@ if(NOT LLVM_LIBC_FULL_BUILD) endif() # Identify the program used to package multiple images into a single binary. +get_filename_component(compiler_path ${CMAKE_CXX_COMPILER} DIRECTORY) find_program(LIBC_CLANG_OFFLOAD_PACKAGER NAMES clang-offload-packager NO_DEFAULT_PATH - PATHS ${LLVM_BINARY_DIR}/bin) + PATHS ${LLVM_BINARY_DIR}/bin ${compiler_path}) if(NOT LIBC_CLANG_OFFLOAD_PACKAGER) message(FATAL_ERROR "Cannot find the 'clang-offload-packager' for the GPU " "build") @@ -45,7 +46,7 @@ elseif(LIBC_TARGET_ARCHITECTURE_IS_NVPTX) # Using 'check_cxx_compiler_flag' does not work currently due to the link job. find_program(LIBC_NVPTX_ARCH NAMES nvptx-arch NO_DEFAULT_PATH - PATHS ${LLVM_BINARY_DIR}/bin) + PATHS ${LLVM_BINARY_DIR}/bin ${compiler_path}) if(LIBC_NVPTX_ARCH) execute_process(COMMAND ${LIBC_NVPTX_ARCH} OUTPUT_VARIABLE arch_tool_output |