3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/compilers/hip/hip-config-paths.patch
Robin Voetter e3d748a92b
hip: fix hip cmake config
Update paths in cmake config files provided by HIP and hipamd to the proper
location in the Nix store. Previously these files were trying to find headers
in a way that assumes the typical ROCm installation (where everything is in
/opt/rocm). This resulted in a bunch of errors when trying to compile HIP
projects that are configured with cmake, like include paths that were set
incorrectly or header paths that were not found.
2022-09-12 00:04:40 +02:00

37 lines
1.5 KiB
Diff

diff --git a/hip-lang-config.cmake.in b/hip-lang-config.cmake.in
index 1a72643a..7f35031f 100644
--- a/hip-lang-config.cmake.in
+++ b/hip-lang-config.cmake.in
@@ -72,8 +72,8 @@ get_filename_component(_IMPORT_PREFIX "${_DIR}/../../../" REALPATH)
#need _IMPORT_PREFIX to be set #FILE_REORG_BACKWARD_COMPATIBILITY
-file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS "${_IMPORT_PREFIX}/../llvm/lib/clang/*/include")
-file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG "${_IMPORT_PREFIX}/llvm/lib/clang/*/include")
+file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS "@llvm@/lib/clang/*/include")
+file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG "@llvm@/lib/clang/*/include")
find_path(HIP_CLANG_INCLUDE_PATH __clang_cuda_math.h
HINTS ${HIP_CLANG_INCLUDE_SEARCH_PATHS}
${HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG}
@@ -88,10 +88,7 @@ endif()
#if HSA is not under ROCm then provide CMAKE_PREFIX_PATH=<HSA_PATH>
find_path(HSA_HEADER hsa/hsa.h
PATHS
- "${_IMPORT_PREFIX}/../include" #FILE_REORG_BACKWARD_COMPATIBILITY
- "${_IMPORT_PREFIX}/include"
- "${ROCM_PATH}/include"
- /opt/rocm/include
+ "@rocm_runtime@/include"
)
if (HSA_HEADER-NOTFOUND)
@@ -99,7 +96,7 @@ if (HSA_HEADER-NOTFOUND)
endif()
get_filename_component(HIP_COMPILER_INSTALL_PATH ${CMAKE_HIP_COMPILER} DIRECTORY)
-file(GLOB HIP_CLANGRT_LIB_SEARCH_PATHS "${HIP_COMPILER_INSTALL_PATH}/../lib/clang/*/lib/*")
+file(GLOB HIP_CLANGRT_LIB_SEARCH_PATHS "@llvm@/lib/clang/*/lib/*")
find_library(CLANGRT_BUILTINS
NAMES
clang_rt.builtins