-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef2588e
commit 851d417
Showing
13 changed files
with
406 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
From 26c33f505713a4cebf638988346fc62ff85e7732 Mon Sep 17 00:00:00 2001 | ||
From: Jeremy Newton <[email protected]> | ||
Date: Sat, 7 May 2022 14:23:21 -0400 | ||
Subject: [PATCH] Use GNUInstallDirs | ||
|
||
--- | ||
CMakeLists.txt | 31 ++++++++++++++++++------------- | ||
src/CMakeLists.txt | 6 +++--- | ||
2 files changed, 21 insertions(+), 16 deletions(-) | ||
|
||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 1c5a2e7f..546925b2 100755 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -20,6 +20,11 @@ | ||
cmake_minimum_required(VERSION 3.16.8) | ||
project(hip) | ||
|
||
+# Set default libdir to be "lib" for ROCm, distros will override this anyway: | ||
+set(CMAKE_INSTALL_LIBDIR "lib" CACHE STRING "Library install directory") | ||
+ | ||
+include(GNUInstallDirs) | ||
+ | ||
# sample command for hip-rocclr runtime, you'll need to have rocclr built | ||
# ROCM_PATH is the path where ROCM is installed | ||
# For shared lib of hip-rocclr runtime | ||
@@ -39,7 +44,7 @@ list(APPEND CMAKE_MODULE_PATH ${HIP_COMMON_DIR}/cmake) | ||
|
||
# required to add the right link to libhsa-runtime in install/lib path | ||
# CMAKE_PREFIX_PATH is used as rpath to search for libs outside HIP | ||
-set(CMAKE_INSTALL_RPATH "${CMAKE_PREFIX_PATH}/lib") | ||
+set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}") | ||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | ||
|
||
############################# | ||
@@ -275,9 +280,9 @@ endif (NOT CPACK_SET_DESTDIR) | ||
############################# | ||
# Build steps | ||
############################# | ||
-set(BIN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin) | ||
-set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib) | ||
-set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include) | ||
+set(BIN_INSTALL_DIR ${CMAKE_INSTALL_FULL_BINDIR}) | ||
+set(LIB_INSTALL_DIR ${CMAKE_INSTALL_FULL_LIBDIR}) | ||
+set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_FULL_INCLUDEDIR}) | ||
set(CONFIG_PACKAGE_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/hip) | ||
set(CONFIG_LANG_PACKAGE_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/hip-lang) | ||
|
||
@@ -325,10 +330,10 @@ endif() | ||
############################# | ||
|
||
# Install .hipInfo | ||
-install(FILES ${PROJECT_BINARY_DIR}/.hipInfo DESTINATION lib) | ||
+install(FILES ${PROJECT_BINARY_DIR}/.hipInfo DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
|
||
# Install .hipVersion | ||
-install(FILES ${PROJECT_BINARY_DIR}/.hipVersion DESTINATION bin) | ||
+install(FILES ${PROJECT_BINARY_DIR}/.hipVersion DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
|
||
# Install src, bin, include & cmake if necessary | ||
execute_process(COMMAND test ${CMAKE_INSTALL_PREFIX} -ef ${CMAKE_CURRENT_SOURCE_DIR} | ||
@@ -337,7 +342,7 @@ if(NOT ${INSTALL_SOURCE} EQUAL 0) | ||
if(WIN32) | ||
install(DIRECTORY ${HIP_COMMON_BIN_DIR} DESTINATION . USE_SOURCE_PERMISSIONS) | ||
if (CMAKE_BUILD_TYPE STREQUAL "Debug") | ||
- install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/src/" DESTINATION bin | ||
+ install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/src/" DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
FILES_MATCHING PATTERN "*.pdb" | ||
PATTERN "*.ilk" | ||
PATTERN "CMakeFiles" EXCLUDE | ||
@@ -354,11 +359,11 @@ if(NOT ${INSTALL_SOURCE} EQUAL 0) | ||
endif() | ||
|
||
# The following two lines will be removed after upstream updation | ||
- install(CODE "MESSAGE(\"Removing ${CMAKE_INSTALL_PREFIX}/include\")") | ||
- install(CODE "file(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/include)") | ||
+ install(CODE "MESSAGE(\"Removing ${CMAKE_INSTALL_FULL_INCLUDEDIR}\")") | ||
+ install(CODE "file(REMOVE_RECURSE ${CMAKE_INSTALL_FULL_INCLUDEDIR})") | ||
|
||
install(DIRECTORY include DESTINATION .) | ||
- install(DIRECTORY ${HIP_COMMON_INCLUDE_DIR}/hip/ DESTINATION include/hip/) | ||
+ install(DIRECTORY ${HIP_COMMON_INCLUDE_DIR}/hip/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hip/) | ||
install(DIRECTORY ${HIP_COMMON_DIR}/cmake DESTINATION .) | ||
endif() | ||
|
||
@@ -366,11 +371,11 @@ endif() | ||
# FIXME: Associate with individual targets. | ||
if(HIP_PLATFORM STREQUAL "amd") | ||
install(FILES ${PROJECT_BINARY_DIR}/include/hip/amd_detail/hip_prof_str.h | ||
- DESTINATION include/hip/amd_detail) | ||
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hip/amd_detail) | ||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin DESTINATION . USE_SOURCE_PERMISSIONS) | ||
endif() | ||
install(FILES ${PROJECT_BINARY_DIR}/include/hip/hip_version.h | ||
- DESTINATION include/hip) | ||
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hip) | ||
|
||
############################# | ||
# hip-config | ||
@@ -548,7 +553,7 @@ endif() | ||
# Target: clang | ||
if(HIP_HIPCC_EXECUTABLE) | ||
add_custom_target(analyze | ||
- COMMAND ${HIP_HIPCC_EXECUTABLE} -fvisibility=hidden -fvisibility-inlines-hidden --analyze --analyzer-outputtext -isystem ${ROCM_PATH}/include -Wno-unused-command-line-argument -I${ROCM_PATH}/include -c src/*.cpp -Iinclude/ -I./ | ||
+ COMMAND ${HIP_HIPCC_EXECUTABLE} -fvisibility=hidden -fvisibility-inlines-hidden --analyze --analyzer-outputtext -isystem ${ROCM_PATH}/${CMAKE_INSTALL_INCLUDEDIR} -Wno-unused-command-line-argument -I${ROCM_PATH}/${CMAKE_INSTALL_INCLUDEDIR} -c src/*.cpp -Iinclude/ -I./ | ||
WORKING_DIRECTORY ${HIP_SRC_PATH}) | ||
if(CPPCHECK_EXE) | ||
add_dependencies(analyze cppcheck) | ||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt | ||
index ac88ddf5..2ce748d1 100644 | ||
--- a/src/CMakeLists.txt | ||
+++ b/src/CMakeLists.txt | ||
@@ -257,7 +257,7 @@ if(__HIP_ENABLE_RTC) | ||
add_dependencies(amdhip64 hiprtc-builtins) | ||
install(TARGETS hiprtc-builtins | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
- LIBRARY DESTINATION lib | ||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
endif() | ||
|
||
@@ -325,7 +325,7 @@ target_link_libraries(device INTERFACE host) | ||
INSTALL(TARGETS amdhip64 host device | ||
EXPORT hip-targets | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
- LIBRARY DESTINATION lib | ||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
INSTALL(EXPORT hip-targets DESTINATION ${CONFIG_PACKAGE_INSTALL_DIR} NAMESPACE hip::) | ||
@@ -333,7 +333,7 @@ INSTALL(EXPORT hip-targets DESTINATION ${CONFIG_PACKAGE_INSTALL_DIR} NAMESPACE h | ||
INSTALL(TARGETS amdhip64 host device | ||
EXPORT hip-lang-targets | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
- LIBRARY DESTINATION lib | ||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
INSTALL(EXPORT hip-lang-targets DESTINATION ${CONFIG_LANG_PACKAGE_INSTALL_DIR} NAMESPACE hip-lang::) | ||
-- | ||
2.34.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
0001-Revert-hip-Fix-and-install-cmake-targets-for-hip-pac.patch | ||
0002-Revert-hip-Switch-to-component-based-packaging.patch | ||
0001-Use-installed-rocclr-if-available.patch | ||
0002-Fix-CL-icd-header-include.patch | ||
0001-Use-GNUInstallDirs.patch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
libamdocl64.so | ||
libcltrace.so | ||
libcltrace.so.5.1 | ||
librocclr.so.5.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
UNKNOWN | ||
ld-linux-x86-64.so.2 | ||
libOpenCL.so.1 | ||
libamd_comgr.so.2 | ||
libc.so.6 | ||
libgcc_s.so.1 | ||
libhsa-runtime64.so.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.