nixpkgs/pkgs/development/compilers/hip/hipamd-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

47 lines
1.7 KiB
Diff

diff --git a/hip-config.cmake.in b/hip-config.cmake.in
index 89d1224e..120b68c6 100755
--- a/hip-config.cmake.in
+++ b/hip-config.cmake.in
@@ -142,7 +142,7 @@ if(HIP_COMPILER STREQUAL "clang")
file(TO_CMAKE_PATH "${HIP_PATH}/../lc" HIP_CLANG_ROOT)
endif()
else()
- set(HIP_CLANG_ROOT "${ROCM_PATH}/llvm")
+ set(HIP_CLANG_ROOT "@llvm@")
endif()
if(NOT HIP_CXX_COMPILER)
set(HIP_CXX_COMPILER ${CMAKE_CXX_COMPILER})
@@ -206,10 +206,7 @@ if(NOT WIN32)
#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 is for Backward compatibility
- "${_IMPORT_PREFIX}/../include"
- ${ROCM_PATH}/include
+ "@rocm_runtime@/include"
)
if (NOT HSA_HEADER)
@@ -224,8 +221,8 @@ set_target_properties(hip::host PROPERTIES
if(HIP_RUNTIME MATCHES "rocclr")
set_target_properties(hip::amdhip64 PROPERTIES
- INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${HSA_HEADER}"
- INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${HSA_HEADER}"
+ INTERFACE_INCLUDE_DIRECTORIES "@hip@/include;${HSA_HEADER}"
+ INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "@hip@/include;${HSA_HEADER}"
)
get_target_property(amdhip64_type hip::amdhip64 TYPE)
@@ -233,8 +230,8 @@ if(HIP_RUNTIME MATCHES "rocclr")
if(NOT WIN32)
set_target_properties(hip::device PROPERTIES
- INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
- INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
+ INTERFACE_INCLUDE_DIRECTORIES "@hip@/include"
+ INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "@hip@/include"
)
endif()
endif()