Skip to content

Commit

Permalink
Create two HIPCC packages: One for AMD, one for NVIDIA
Browse files Browse the repository at this point in the history
  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
  • Loading branch information
David Salinas authored and David Salinas committed Nov 22, 2023
1 parent b3a07bb commit f23050f
Showing 1 changed file with 68 additions and 13 deletions.
81 changes: 68 additions & 13 deletions amd/hipcc/CMakeLists.txt
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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 <rocm.compiler.support@amd.com>")
set(CPACK_PACKAGE_DESCRIPTION "HIP Compiler Driver")
Expand All @@ -53,20 +56,31 @@ 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})
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})
Expand All @@ -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})
Expand All @@ -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.
Expand Down

0 comments on commit f23050f

Please sign in to comment.