From f23050fdd6c6c739e3cd5f2d11413dd6e4d3ac9c Mon Sep 17 00:00:00 2001 From: David Salinas Date: Thu, 12 Oct 2023 17:26:31 +0000 Subject: [PATCH] Create two HIPCC packages: One for AMD, one for NVIDIA SWDEV-424143 - rocm-llvm is installed with hip-runtime-nvidia package Adding a HIPCC-NVIDIA package that does not require/depend on rocm-llvm Change-Id: Ie4edfd259f003ca8d54403f5ac5074f06372e27f --- amd/hipcc/CMakeLists.txt | 81 +++++++++++++++++++++++++++++++++------- 1 file changed, 68 insertions(+), 13 deletions(-) mode change 100644 => 100755 amd/hipcc/CMakeLists.txt diff --git a/amd/hipcc/CMakeLists.txt b/amd/hipcc/CMakeLists.txt old mode 100644 new mode 100755 index fa9029ba47dfd0..3432b2e309ab38 --- a/amd/hipcc/CMakeLists.txt +++ b/amd/hipcc/CMakeLists.txt @@ -1,7 +1,6 @@ cmake_minimum_required(VERSION 3.13.4) -project(hipcc VERSION "1.0.0" LANGUAGES C CXX) -set(hipcc_NAME "${PROJECT_NAME}") +project(hipcc VERSION "1.1.1" LANGUAGES C CXX) include(CMakePackageConfigHelpers) include(GNUInstallDirs) @@ -43,6 +42,10 @@ endif() # Copy scripts and batch files to build directory. file(COPY ${PROJECT_SOURCE_DIR}/bin/ DESTINATION ${PROJECT_BINARY_DIR}) +# Packaging: +set(CPACK_RPM_COMPONENT_INSTALL ON) +set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) +set(CPACK_COMPONENTS_ALL AMD NVIDIA) set(CPACK_GENERATOR "DEB;RPM;ZIP" CACHE STRING "Default packaging generators") set(CPACK_PACKAGE_CONTACT "ROCm Compiler Support ") set(CPACK_PACKAGE_DESCRIPTION "HIP Compiler Driver") @@ -53,9 +56,11 @@ set(CPACK_PACKAGE_VERSION_MINOR "${hipcc_VERSION_MINOR}") set(CPACK_PACKAGE_VERSION_PATCH "${hipcc_VERSION_PATCH}") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt") -# Debian-specific packaging variables. +# Debian specific packaging variables. +set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS ON) +set(CPACK_DEB_COMPONENT_INSTALL ON) set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") -set(CPACK_DEBIAN_PACKAGE_DEPENDS "perl (>= 5.0), hip-dev, rocm-core, rocm-llvm") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "perl (>= 5.0), hip-dev, rocm-core") set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/ROCm-Developer-Tools/HIPCC") if(DEFINED ENV{CPACK_DEBIAN_PACKAGE_RELEASE}) set(CPACK_DEBIAN_PACKAGE_RELEASE $ENV{CPACK_DEBIAN_PACKAGE_RELEASE}) @@ -63,10 +68,19 @@ else() set(CPACK_DEBIAN_PACKAGE_RELEASE "local") endif() -# RPM-specific packaging variables. +# AMD specific Debian packaging varibles. +set(CPACK_DEBIAN_AMD_PACKAGE_NAME "hipcc") +set(CPACK_DEBIAN_AMD_PACKAGE_DEPENDS "perl (>= 5.0), hip-dev, rocm-core, rocm-llvm") + +# NVIDIA specific Debian packaging variables. +set(CPACK_DEBIAN_NVIDIA_PACKAGE_NAME "hipcc-nvidia") +set(CPACK_DEBIAN_NVIDIA_PACKAGE_DEPENDS "perl (>= 5.0), hip-dev, rocm-core") # for NVIDIA we don't need to add rocm-llvm as a dependency + + +# RPM specific packaging variables. set(CPACK_RPM_FILE_NAME "RPM-DEFAULT") set(CPACK_RPM_PACKAGE_LICENSE "MIT") -set(CPACK_RPM_PACKAGE_REQUIRES "perl >= 5.0, hip-devel, rocm-core, rocm-llvm") +set(CPACK_RPM_PACKAGE_REQUIRES "perl >= 5.0, hip-devel, rocm-core") set(CPACK_RPM_PACKAGE_AUTOREQPROV 0) if(DEFINED ENV{CPACK_RPM_PACKAGE_RELEASE}) set(CPACK_RPM_PACKAGE_RELEASE $ENV{CPACK_RPM_PACKAGE_RELEASE}) @@ -77,6 +91,14 @@ if(CPACK_RPM_PACKAGE_RELEASE) set(CPACK_RPM_PACKAGE_RELEASE_DIST ON) endif() +# AMD specific RPM packaging varibables. +set(CPACK_RPM_AMD_PACKAGE_NAME "hipcc") +set(CPACK_RPM_AMD_PACKAGE_REQUIRES "perl >= 5.0, hip-devel, rocm-core, rocm-llvm") + +# NVIDIA specific RPM packaging variables. +set(CPACK_RPM_NVIDIA_PACKAGE_NAME "hipcc-nvidia") +set(CPACK_RPM_NVIDIA_PACKAGE_REQUIRES "perl >= 5.0, hip-devel, rocm-core") # for NVIDIA we don't need to add rocm-llvm as a dependency + # ROCM versioning. set(ROCM_VERSION_FOR_PACKAGE "") if(DEFINED ENV{ROCM_LIBPATCH_VERSION}) @@ -90,33 +112,66 @@ set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSIO # Exclude Windows specific BAT scripts from install/packaging for Linux. if (NOT WIN32) + # AMD specific. + install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin + DESTINATION . + USE_SOURCE_PERMISSIONS + DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT AMD + FILES_MATCHING + PATTERN "*" + PATTERN "*.bat" EXCLUDE) + + # NVIDIA specific. install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin DESTINATION . USE_SOURCE_PERMISSIONS DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT NVIDIA FILES_MATCHING PATTERN "*" PATTERN "*.bat" EXCLUDE) else () + # AMD specific. install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin DESTINATION . USE_SOURCE_PERMISSIONS - DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) + DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT AMD) + + # NVIDIA specific. + install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin + DESTINATION . + USE_SOURCE_PERMISSIONS + DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT NVIDIA) endif() +# AMD specific. install(FILES "LICENSE.txt" "README.md" - COMPONENT ${hipcc_NAME} + COMPONENT AMD DESTINATION ${CMAKE_INSTALL_DOCDIR}) - install(TARGETS ${HIPCC_BIN} - COMPONENT ${hipcc_NAME} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + COMPONENT AMD + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(TARGETS ${HIPCONFIG_BIN} + COMPONENT AMD + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +# NVIDIA specific. +install(FILES + "LICENSE.txt" + "README.md" + COMPONENT NVIDIA + DESTINATION ${CMAKE_INSTALL_DOCDIR}) +install(TARGETS ${HIPCC_BIN} + COMPONENT NVIDIA + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${HIPCONFIG_BIN} - COMPONENT ${hipcc_NAME} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + COMPONENT NVIDIA + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) # TODO: WIN32 check need to be removed if backward # compatibility is required for WIN32.