SWDEV-335990 - Use GNUInstallDirs

GNUInstallDirs is used to allow the user to customize the install paths
of HIP, rather than using hardcoded locations.

See documentation for more information:
https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html

Note that libdir must be overriden to "lib" before including
GNUInstallDirs, because by default, cmake tries to detect the libdir
path, but ROCm packaging would like to use lib by default for all
targets. This does not stop the user (or distros) from overriding.

Also note this change does no take into account the changes needed to
non-cmake files, such as perl scripts, so not all paths combinations are
necessarily functional.

Signed-off-by: Jeremy Newton <Jeremy.Newton@amd.com>
Change-Id: Iae80f47c47ea0a74fc1c221b6eea82b557601394
This commit is contained in:
Jeremy Newton committed 2022-06-06 23:43:05 -04:00
1 parent e2874d5e22
commit bf4df229c9
2 files changed
+21 -16

No files matched your search

+3 -3
View File
@@ -201,7 +201,7 @@ if(NOT WIN32)
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()
endif()
@@ -270,7 +270,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::)
@@ -278,7 +278,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::)