SWDEV-351540 - ASAN packaging for amd-smi

Change-Id: I5f0bf5330727e11159db87c2814904a2832df385


[ROCm/amdsmi commit: 689d58d2c9]
This commit is contained in:
AravindanC
2023-01-26 09:01:55 -08:00
والد bb2a7811a4
کامیت e8a95d9028
3فایلهای تغییر یافته به همراه75 افزوده شده و 13 حذف شده
+47 -3
مشاهده پرونده
@@ -57,13 +57,16 @@ option(BUILD_TESTS "Build test suite" OFF)
option(BUILD_WRAPPER "Rebuild AMDSMI-wrapper" OFF) option(BUILD_WRAPPER "Rebuild AMDSMI-wrapper" OFF)
option(BUILD_CLI "Build AMDSMI-CLI and install" ON) option(BUILD_CLI "Build AMDSMI-CLI and install" ON)
option(ENABLE_LDCONFIG "Set library links and caches using ldconfig." ON) option(ENABLE_LDCONFIG "Set library links and caches using ldconfig." ON)
option(ENABLE_ASAN_PACKAGING "" OFF)
# Set share path here because project name != amd_smi # Set share path here because project name != amd_smi
set(SHARE_INSTALL_PREFIX "share/${AMD_SMI}" CACHE STRING "Tests and Example install directory") set(SHARE_INSTALL_PREFIX "share/${AMD_SMI}" CACHE STRING "Tests and Example install directory")
# Packaging directives # Packaging directives
set(CPACK_PACKAGE_NAME set(CPACK_PACKAGE_NAME
${AMD_SMI_PACKAGE} ${AMD_SMI_PACKAGE}
CACHE STRING "") CACHE STRING "")
set(CPACK_PACKAGE_CONTACT set(CPACK_PACKAGE_CONTACT
"AMD-SMILib Support <amd-smi.support@amd.com>" "AMD-SMILib Support <amd-smi.support@amd.com>"
CACHE STRING "") CACHE STRING "")
@@ -147,7 +150,7 @@ configure_package_config_file(
write_basic_package_version_file( write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/amd_smi-config-version.cmake ${CMAKE_CURRENT_BINARY_DIR}/amd_smi-config-version.cmake
VERSION VERSION
"${AMD_SMI_LIBS_TARGET_VERSION_MAJOR}.${AMD_SMI_LIBS_TARGET_VERSION_MINOR}.${AMD_SMI_LIBS_TARGET_VERSION_PATCH}" "${AMD_SMI_LIBS_TARGET_VERSION_MAJOR}.${AMD_SMI_LIBS_TARGET_VERSION_MINOR}.${AMD_SMI_LIBS_TARGET_VERSION_PATCH}"
COMPATIBILITY SameMajorVersion) COMPATIBILITY SameMajorVersion)
install( install(
@@ -162,6 +165,7 @@ export(TARGETS ${AMD_SMI_TARGET} FILE "${PROJECT_BINARY_DIR}/amd_smi_target.cmak
# Export the package for use from the build-tree # Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry) # (this registers the build-tree with a global CMake-registry)
export(PACKAGE amd_smi) export(PACKAGE amd_smi)
# Create the amd_smiConfig.cmake and amd_smiConfigVersion files # Create the amd_smiConfig.cmake and amd_smiConfigVersion files
# ... for the build tree # ... for the build tree
install( install(
@@ -171,13 +175,24 @@ install(
#License file #License file
set(CPACK_RPM_PACKAGE_LICENSE "NCSA") set(CPACK_RPM_PACKAGE_LICENSE "NCSA")
# install license file in share/doc/amd_smi-asan folder
install(
FILES ${CPACK_RESOURCE_FILE_LICENSE}
DESTINATION share/doc/${AMD_SMI}-asan
RENAME LICENSE.txt
COMPONENT asan)
# docs are installed into different share directory from tests and examples # docs are installed into different share directory from tests and examples
install( install(
FILES ${CPACK_RESOURCE_FILE_LICENSE} FILES ${CPACK_RESOURCE_FILE_LICENSE}
DESTINATION share/doc/${AMD_SMI} DESTINATION share/doc/${AMD_SMI}
RENAME LICENSE.txt) RENAME LICENSE.txt
COMPONENT dev)
#Readme file #Readme file
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/README.md DESTINATION share/doc/${AMD_SMI}) install(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/README.md
DESTINATION share/doc/${AMD_SMI}
COMPONENT dev)
#Make proper version for appending #Make proper version for appending
#Default Value is 99999, setting it first #Default Value is 99999, setting it first
@@ -189,7 +204,13 @@ endif()
#Debian package specific variables #Debian package specific variables
set(CPACK_DEBIAN_PACKAGE_PROVIDES "amd-smi") set(CPACK_DEBIAN_PACKAGE_PROVIDES "amd-smi")
set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "sudo, libdrm-dev") set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "sudo, libdrm-dev")
set(CPACK_DEBIAN_ASAN_PACKAGE_RECOMMENDS "sudo, libdrm-dev")
set(CPACK_DEBIAN_DEV_PACKAGE_RECOMMENDS "sudo, libdrm-dev")
set(CPACK_DEBIAN_ASAN_PACKAGE_PROVIDES "${AMD_SMI_PACKAGE}-asan")
set(CPACK_DEBIAN_DEV_PACKAGE_PROVIDES "${AMD_SMI_PACKAGE}")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "python3") set(CPACK_DEBIAN_PACKAGE_DEPENDS "python3")
set(CPACK_DEBIAN_ASAN_PACKAGE_DEPENDS "python3")
set(CPACK_DEBIAN_DEV_PACKAGE_DEPENDS "python3")
## Process the Debian install/remove scripts to update the CPACK variables ## Process the Debian install/remove scripts to update the CPACK variables
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/DEBIAN/postinst.in DEBIAN/postinst @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/DEBIAN/postinst.in DEBIAN/postinst @ONLY)
@@ -204,16 +225,39 @@ if(CPACK_RPM_PACKAGE_RELEASE)
set(CPACK_RPM_PACKAGE_RELEASE_DIST ON) set(CPACK_RPM_PACKAGE_RELEASE_DIST ON)
endif() endif()
set(CPACK_RPM_PACKAGE_PROVIDES "amd-smi") set(CPACK_RPM_PACKAGE_PROVIDES "amd-smi")
set(CPACK_RPM_DEV_PACKAGE_PROVIDES "${AMD_SMI_PACKAGE}")
set(CPACK_RPM_ASAN_PACKAGE_PROVIDES "${AMD_SMI_PACKAGE}-asan")
set(CPACK_RPM_PACKAGE_REQUIRES "python3") set(CPACK_RPM_PACKAGE_REQUIRES "python3")
# don't terminate if bytecompile of python files fails # don't terminate if bytecompile of python files fails
set(CPACK_RPM_SPEC_MORE_DEFINE "%define _python_bytecompile_errors_terminate_build 0") set(CPACK_RPM_SPEC_MORE_DEFINE "%define _python_bytecompile_errors_terminate_build 0")
set(CPACK_RPM_DEV_PACKAGE_REQUIRES "python3")
set(CPACK_RPM_ASAN_PACKAGE_REQUIRES "python3")
# Add rocm-core dependency if -DROCM_DEP_ROCMCORE=ON is passed # Add rocm-core dependency if -DROCM_DEP_ROCMCORE=ON is passed
if(ROCM_DEP_ROCMCORE) if(ROCM_DEP_ROCMCORE)
string(APPEND CPACK_DEBIAN_ASAN_PACKAGE_DEPENDS ", rocm-core-asan")
string(APPEND CPACK_RPM_ASAN_PACKAGE_REQUIRES ", rocm-core-asan")
string(APPEND CPACK_DEBIAN_DEV_PACKAGE_DEPENDS ", rocm-core")
string(APPEND CPACK_RPM_DEV_PACKAGE_REQUIRES ", rocm-core")
string(APPEND CPACK_DEBIAN_PACKAGE_DEPENDS ", rocm-core") string(APPEND CPACK_DEBIAN_PACKAGE_DEPENDS ", rocm-core")
string(APPEND CPACK_RPM_PACKAGE_REQUIRES ", rocm-core") string(APPEND CPACK_RPM_PACKAGE_REQUIRES ", rocm-core")
endif() endif()
## Enable Component Mode and set component specific flags
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_DEV_PACKAGE_NAME "${AMD_SMI_PACKAGE}")
set(CPACK_DEBIAN_ASAN_PACKAGE_NAME "${AMD_SMI_PACKAGE}-asan")
set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_RPM_DEV_PACKAGE_NAME "${AMD_SMI_PACKAGE}")
set(CPACK_RPM_ASAN_PACKAGE_NAME "${AMD_SMI_PACKAGE}-asan")
if(ENABLE_ASAN_PACKAGING)
# ASAN Package requires only asan component with libraries and license file
set(CPACK_COMPONENTS_ALL asan)
else()
set(CPACK_COMPONENTS_ALL dev tests )
endif()
# The line below doesn't currently work; it may be this issue: # The line below doesn't currently work; it may be this issue:
# https://bugzilla.redhat.com/show_bug.cgi?id=1811358 # https://bugzilla.redhat.com/show_bug.cgi?id=1811358
# set(CPACK_RPM_PACKAGE_SUGGESTS "sudo, libdrm-dev") # set(CPACK_RPM_PACKAGE_SUGGESTS "sudo, libdrm-dev")
@@ -5,6 +5,7 @@
install( install(
DIRECTORY ./ DIRECTORY ./
DESTINATION ${SHARE_INSTALL_PREFIX}/example DESTINATION ${SHARE_INSTALL_PREFIX}/example
COMPONENT dev
FILES_MATCHING FILES_MATCHING
PATTERN "*.cc") PATTERN "*.cc")
@@ -12,7 +13,8 @@ install(
install( install(
FILES CMakeLists.txt.in FILES CMakeLists.txt.in
RENAME CMakeLists.txt RENAME CMakeLists.txt
DESTINATION ${SHARE_INSTALL_PREFIX}/example) DESTINATION ${SHARE_INSTALL_PREFIX}/example
COMPONENT dev)
# compile example files but do not install # compile example files but do not install
# this is only useful if running from build directory # this is only useful if running from build directory
@@ -110,14 +110,26 @@ endif()
install( install(
TARGETS ${AMD_SMI_TARGET} TARGETS ${AMD_SMI_TARGET}
EXPORT amd_smiTargets EXPORT amd_smiTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dev)
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${AMD_SMI_COMPONENT}) #COMPONENT ${AMD_SMI_COMPONENT})
install(FILES ${PROJECT_SOURCE_DIR}/include/amd_smi/amdsmi.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/amd_smi) install(
install(FILES ${PROJECT_SOURCE_DIR}/include/amd_smi/${AMD_SMI_TARGET}Config.h TARGETS ${AMD_SMI_TARGET}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/amd_smi) LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
install(FILES ${PROJECT_SOURCE_DIR}/rocm_smi/include/rocm_smi/kfd_ioctl.h COMPONENT asan)
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/amd_smi)
install(
FILES ${PROJECT_SOURCE_DIR}/include/amd_smi/amdsmi.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/amd_smii
COMPONENT dev)
install(
FILES ${PROJECT_SOURCE_DIR}/include/amd_smi/${AMD_SMI_TARGET}Config.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/amd_smi
COMPONENT dev)
install(
FILES ${PROJECT_SOURCE_DIR}/rocm_smi/include/rocm_smi/kfd_ioctl.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/amd_smi
COMPONENT dev)
#install(FILES ${PROJECT_SOURCE_DIR}/rocm_smi/python_smi_tools/rsmiBindings.py #install(FILES ${PROJECT_SOURCE_DIR}/rocm_smi/python_smi_tools/rsmiBindings.py
# DESTINATION libexec/${AMD_SMI}) # DESTINATION libexec/${AMD_SMI})
#install(FILES ${PROJECT_SOURCE_DIR}/rocm_smi/python_smi_tools/rocm_smi.py #install(FILES ${PROJECT_SOURCE_DIR}/rocm_smi/python_smi_tools/rocm_smi.py
@@ -153,8 +165,12 @@ if(DOXYGEN_FOUND AND LATEX_FOUND)
install( install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf FILES ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf
DESTINATION share/doc/${AMD_SMI} DESTINATION share/doc/${AMD_SMI}
RENAME ${ASMI_MANUAL_NAME}.pdf) RENAME ${ASMI_MANUAL_NAME}.pdf
install(FILES ${PROJECT_SOURCE_DIR}/README.md DESTINATION share/doc/${AMD_SMI}) COMPONENT dev)
install(
FILES ${PROJECT_SOURCE_DIR}/README.md
DESTINATION share/doc/${AMD_SMI}
COMPONENT dev)
else() else()
message("Doxygen or Latex is not found. Will not generate documents.") message("Doxygen or Latex is not found. Will not generate documents.")
endif(DOXYGEN_FOUND AND LATEX_FOUND) endif(DOXYGEN_FOUND AND LATEX_FOUND)