diff --git a/projects/amdsmi/CMakeLists.txt b/projects/amdsmi/CMakeLists.txt index adaca56944..552b68741a 100755 --- a/projects/amdsmi/CMakeLists.txt +++ b/projects/amdsmi/CMakeLists.txt @@ -57,13 +57,16 @@ option(BUILD_TESTS "Build test suite" OFF) option(BUILD_WRAPPER "Rebuild AMDSMI-wrapper" OFF) option(BUILD_CLI "Build AMDSMI-CLI and install" 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_INSTALL_PREFIX "share/${AMD_SMI}" CACHE STRING "Tests and Example install directory") + # Packaging directives set(CPACK_PACKAGE_NAME ${AMD_SMI_PACKAGE} CACHE STRING "") + set(CPACK_PACKAGE_CONTACT "AMD-SMILib Support " CACHE STRING "") @@ -147,7 +150,7 @@ configure_package_config_file( write_basic_package_version_file( ${CMAKE_CURRENT_BINARY_DIR}/amd_smi-config-version.cmake 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) 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 # (this registers the build-tree with a global CMake-registry) export(PACKAGE amd_smi) + # Create the amd_smiConfig.cmake and amd_smiConfigVersion files # ... for the build tree install( @@ -171,13 +175,24 @@ install( #License file 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 install( FILES ${CPACK_RESOURCE_FILE_LICENSE} DESTINATION share/doc/${AMD_SMI} - RENAME LICENSE.txt) + RENAME LICENSE.txt + COMPONENT dev) + #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 #Default Value is 99999, setting it first @@ -189,7 +204,13 @@ endif() #Debian package specific variables set(CPACK_DEBIAN_PACKAGE_PROVIDES "amd-smi") 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_ASAN_PACKAGE_DEPENDS "python3") +set(CPACK_DEBIAN_DEV_PACKAGE_DEPENDS "python3") ## Process the Debian install/remove scripts to update the CPACK variables 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) endif() 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") # 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_DEV_PACKAGE_REQUIRES "python3") +set(CPACK_RPM_ASAN_PACKAGE_REQUIRES "python3") # Add rocm-core dependency if -DROCM_DEP_ROCMCORE=ON is passed 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_RPM_PACKAGE_REQUIRES ", rocm-core") 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: # https://bugzilla.redhat.com/show_bug.cgi?id=1811358 # set(CPACK_RPM_PACKAGE_SUGGESTS "sudo, libdrm-dev") diff --git a/projects/amdsmi/example/CMakeLists.txt b/projects/amdsmi/example/CMakeLists.txt index f8cbbb41b9..34d61e50c1 100644 --- a/projects/amdsmi/example/CMakeLists.txt +++ b/projects/amdsmi/example/CMakeLists.txt @@ -5,6 +5,7 @@ install( DIRECTORY ./ DESTINATION ${SHARE_INSTALL_PREFIX}/example + COMPONENT dev FILES_MATCHING PATTERN "*.cc") @@ -12,7 +13,8 @@ install( install( FILES CMakeLists.txt.in RENAME CMakeLists.txt - DESTINATION ${SHARE_INSTALL_PREFIX}/example) + DESTINATION ${SHARE_INSTALL_PREFIX}/example + COMPONENT dev) # compile example files but do not install # this is only useful if running from build directory diff --git a/projects/amdsmi/src/CMakeLists.txt b/projects/amdsmi/src/CMakeLists.txt index 37d4961916..908502098c 100644 --- a/projects/amdsmi/src/CMakeLists.txt +++ b/projects/amdsmi/src/CMakeLists.txt @@ -110,14 +110,26 @@ endif() install( TARGETS ${AMD_SMI_TARGET} EXPORT amd_smiTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${AMD_SMI_COMPONENT}) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dev) + #COMPONENT ${AMD_SMI_COMPONENT}) -install(FILES ${PROJECT_SOURCE_DIR}/include/amd_smi/amdsmi.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/amd_smi) -install(FILES ${PROJECT_SOURCE_DIR}/include/amd_smi/${AMD_SMI_TARGET}Config.h - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/amd_smi) -install(FILES ${PROJECT_SOURCE_DIR}/rocm_smi/include/rocm_smi/kfd_ioctl.h - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/amd_smi) +install( + TARGETS ${AMD_SMI_TARGET} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT asan) + +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 # DESTINATION libexec/${AMD_SMI}) #install(FILES ${PROJECT_SOURCE_DIR}/rocm_smi/python_smi_tools/rocm_smi.py @@ -153,8 +165,12 @@ if(DOXYGEN_FOUND AND LATEX_FOUND) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf DESTINATION share/doc/${AMD_SMI} - RENAME ${ASMI_MANUAL_NAME}.pdf) - install(FILES ${PROJECT_SOURCE_DIR}/README.md DESTINATION share/doc/${AMD_SMI}) + RENAME ${ASMI_MANUAL_NAME}.pdf + COMPONENT dev) + install( + FILES ${PROJECT_SOURCE_DIR}/README.md + DESTINATION share/doc/${AMD_SMI} + COMPONENT dev) else() message("Doxygen or Latex is not found. Will not generate documents.") endif(DOXYGEN_FOUND AND LATEX_FOUND)