Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ find_program(DPKG_EXE dpkg)

set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME runtime)
set(ROCM_PACKAGE_CREATED FALSE CACHE INTERNAL "Track whether rocm_create_package has been called.")
set(HDRONLY_LICENSE_INSTALLDIR "" CACHE INTERNAL "License File Install Directory Name")

function(rocm_package_add_rpm_dependencies)
set(options QUIET)
Expand Down Expand Up @@ -429,10 +430,11 @@ macro(rocm_create_package)
if(PARSE_PTH)
rocm_parse_python_syspath(${LIB_DIR} ${PARSE_NAME})
endif()
rocm_setup_license(${PARSE_HEADER_ONLY})
if(PARSE_COMPONENTS)
rocm_set_comp_cpackvar(PARSE_HEADER_ONLY "${PARSE_SUFFIX}" "${PARSE_COMPONENTS}")
endif()
# License Folder to match with Package Name
rocm_setup_license(${PARSE_HEADER_ONLY})
include(CPack)
set(ROCM_PACKAGE_CREATED TRUE CACHE INTERNAL "Track whether rocm_create_package has been called.")
endmacro()
Expand Down Expand Up @@ -465,17 +467,23 @@ macro(rocm_setup_license HEADER_ONLY)

if(CPACK_RESOURCE_FILE_LICENSE)
if(ENABLE_ASAN_PACKAGING)
message(STATUS "rocm-cmake: set install license file to ${_rocm_cpack_package_name}-asan.")
install(
FILES ${CPACK_RESOURCE_FILE_LICENSE}
DESTINATION share/doc/${_rocm_cpack_package_name}-asan
)
elseif((ROCM_USE_DEV_COMPONENT AND ${HEADER_ONLY}) OR NOT BUILD_SHARED_LIBS)
if("${HDRONLY_LICENSE_INSTALLDIR}" STREQUAL "")
set(HDRONLY_LICENSE_INSTALLDIR "${_rocm_cpack_package_name}")
endif()
message(STATUS "rocm-cmake: set install license file to ${HDRONLY_LICENSE_INSTALLDIR}.")
install(
FILES ${CPACK_RESOURCE_FILE_LICENSE}
DESTINATION share/doc/${_rocm_cpack_package_name}
DESTINATION share/doc/${HDRONLY_LICENSE_INSTALLDIR}
Comment on lines -475 to +482
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be safe, can we keep the old behaviour when HDRONLY_LICENSE_INSTALLDIR is unset?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the comment, I tried to address in the latest patch.
There are few failures I am facing in my testing, (even without this change) somehow the folder name generated is not consistently working for all package, ex: in case multiple packages from same module, it is random taking one of package name. Trying to check this now

COMPONENT devel
)
else()
message(STATUS "rocm-cmake: set install license file to ${_rocm_cpack_package_name}.")
install(
FILES ${CPACK_RESOURCE_FILE_LICENSE}
DESTINATION share/doc/${_rocm_cpack_package_name}
Expand Down Expand Up @@ -529,6 +537,16 @@ macro(rocm_compute_component_package_name COMPONENT_NAME BASE_NAME NAME_SUFFIX H
"${BASE_NAME}${_component_suffix}${_deb_component_partial}")
endif()

# Set install folder for License File
if( ROCM_USE_DEV_COMPONENT AND ${HEADER_ONLY} )
if( CPACK_RPM_COMPONENT_INSTALL )
set( HDRONLY_LICENSE_INSTALLDIR "${BASE_NAME}${_component_suffix}${_rpm_component_partial}")
elseif( CPACK_DEB_COMPONENT_INSTALL )
set( HDRONLY_LICENSE_INSTALLDIR "${BASE_NAME}${_component_suffix}${_deb_component_partial}")
endif()
message(STATUS "rocm-cmake: set install license file to ${HDRONLY_LICENSE_INSTALLDIR}.")
endif()

# clean up temporary variables
unset(_deb_component_partial)
unset(_rpm_component_partial)
Expand Down
Loading