Files
rocm-systems/cmake/rocprofiler_config_packaging.cmake
T
Jonathan R. Madsen 1edd4891b2 ROCTx Library (#360)
* Initial implementation of roctx library

* Update include/roctx/CMakeLists.txt

- fix installation

* Update cmake/rocprofiler_config_packaging.cmake

- add rocprofiler-sdk-roctx installer

* Update include/roctx/CMakeLists.txt

- include api_trace.h in installation

* Update include/roctx/api_trace.h

- add ROCTX_API_TABLE_VERSION_MAJOR define
- add ROCTX_API_TABLE_VERSION_STEP define

* Update lib/roctx/roctx.cpp

- static asserts for table size and struct member offsets

* Update external/CMakeLists.txt

- move BUILD_SHARED_LIBS to top
- disable libunwind for glog

* Update lib/roctx/CMakeLists.txt

- Update {BUILD,INSTALL}_RPATH

* Relocate include/roctx to include/rocprofiler-sdk/roctx

* Relocate lib/roctx to lib/rocprofiler-sdk-roctx

- change the name of the library from libroctx to librocprofiler-sdk-roctx

* Move lib/plugins to lib/rocprofiler-sdk-tool/plugins

- also change install export group

* Update lib/rocprofiler-sdk/CMakeLists.txt

- change rocprofiler-shared-library EXPORT group (rocprofiler-sdk-library-targets -> rocprofiler-sdk-targets)

* Update cmake/rocprofiler_utilities.cmake

- change install EXPORT group
  - rocprofiler-sdk-library-targets -> rocprofiler-sdk-targets

* Update CMakeLists.txt

- set PACKAGE_NAME at high level
- include(rocprofiler_config_install_roctx)

* Update cmake/rocprofiler_config_install* and cmake/Templates/*.cmake.in

- added rocprofiler_config_install_roctx.cmake for installing roctx as a package
- reorganization of existing cmake/Templates/*-config.cmake.in files
- created new config.cmake.in and build-config.cmake.in for rocprofiler-sdk-roctx

* Relocate include/rocprofiler-sdk/roctx to include/rocprofiler-sdk-roctx

* Update rocprofiler_config_install_roctx.cmake

* Update lib/rocprofiler-sdk-roctx/roctx.cpp

- update include paths

* Update lib/rocprofiler-sdk-roctx/CMakeLists.txt

- change target name to have rocprofiler-sdk- prefix
- interface target_include_directories
- define export symbol

* source formatting (clang-format v11) (#361)

Co-authored-by: jrmadsen <jrmadsen@users.noreply.github.com>

* Update include/rocprofiler-sdk/fwd.h

- fix doxygen markup for ROCPROFILER_STATUS_ERROR_CONTEXT_ERROR

* Update modulefile and setup-env.sh

* Update cmake/Templates/rocprofiler-sdk/config.cmake.in

- fix inclusion of rocprofiler-sdk-targets.cmake

* Update include/rocprofiler-sdk-roctx

- add types.h for typedefs
- add doxygen comments for roctx.h
- add roctxGetThreadId function
- roctxProfilerStart and roctxProfilerStop accept thread ID param

* Update lib/rocprofiler-sdk-roctx/roctx.cpp

- hsa_agent_t* -> hsa_agent_s*

* Update lib/rocprofiler-sdk-roctx/roctx.cpp

- support for roctxGetThreadId
- update signatures of roctxProfilerPause and roctxProfilerResume

* Update lib/rocprofiler-sdk-roctx/roctx.cpp

- Initialize logging with ROCTX_LOG_LEVEL

* Update include/rocprofiler-sdk-roctx/roctx.h

- remove ROCTX_NONNULL for ihipStream_t parameter in roctxNameHipStream because default stream is a nullptr

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-01-17 01:27:41 -06:00

193 lines
7.8 KiB
CMake

#
# configure packaging settings
#
# Add packaging directives
set(CPACK_PACKAGE_NAME ${PROJECT_NAME}-sdk)
set(CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc.")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}")
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
set(CPACK_PACKAGE_CONTACT "ROCm Profiler Support <dl.ROCm-Profiler.support@amd.com>")
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_STRIP_FILES
OFF
CACHE BOOL "") # eventually this should be set to ON
set(ROCPROFILER_CPACK_SYSTEM_NAME
"${CMAKE_SYSTEM_NAME}"
CACHE STRING "System name, e.g. Linux or Ubuntu-18.04")
set(ROCPROFILER_CPACK_PACKAGE_SUFFIX "")
set(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${ROCPROFILER_VERSION}-${ROCPROFILER_CPACK_SYSTEM_NAME}${ROCPROFILER_CPACK_PACKAGE_SUFFIX}"
)
if(DEFINED ENV{CPACK_PACKAGE_FILE_NAME})
set(CPACK_PACKAGE_FILE_NAME $ENV{CPACK_PACKAGE_FILE_NAME})
endif()
set(ROCPROFILER_PACKAGE_FILE_NAME
${CPACK_PACKAGE_NAME}-${ROCPROFILER_VERSION}-${ROCPROFILER_CPACK_SYSTEM_NAME}${ROCPROFILER_CPACK_PACKAGE_SUFFIX}
)
rocprofiler_add_feature(ROCPROFILER_PACKAGE_FILE_NAME "CPack filename")
get_cmake_property(ROCPROFILER_PACKAGING_COMPONENTS COMPONENTS)
rocprofiler_add_feature(ROCPROFILER_PACKAGING_COMPONENTS "Packaging components")
list(REMOVE_ITEM ROCPROFILER_PACKAGING_COMPONENTS "Development" "Unspecified")
list(LENGTH ROCPROFILER_PACKAGING_COMPONENTS NUM_ROCPROFILER_PACKAGING_COMPONENTS)
# the packages we will generate
set(ROCPROFILER_COMPONENT_GROUPS "core" "docs" "tests" "roctx")
set(COMPONENT_GROUP_core_COMPONENTS "core" "development" "samples" "tools" "Development"
"Unspecified")
set(COMPONENT_GROUP_docs_COMPONENTS "docs")
set(COMPONENT_GROUP_tests_COMPONENTS "tests")
set(COMPONENT_GROUP_roctx_COMPONENTS "roctx")
# variables for each component group. Note: eventually we will probably want to separate
# the core to just be the runtime libraries, development to be the headers and cmake
# files, the samples to just be the samples, and tools just be the tool files but right
# now we are just combining core, development, samples, and tools into one package
set(COMPONENT_NAME_core "rocprofiler-sdk")
set(COMPONENT_NAME_docs "rocprofiler-sdk-docs")
set(COMPONENT_NAME_tests "rocprofiler-sdk-tests")
set(COMPONENT_NAME_roctx "rocprofiler-sdk-roctx")
set(COMPONENT_DEP_core "")
set(COMPONENT_DEP_docs "")
set(COMPONENT_DEP_tests "rocprofiler-sdk")
set(COMPONENT_DEP_roctx "")
set(COMPONENT_DESC_core "rocprofiler-sdk libraries, headers, samples, and tools")
set(COMPONENT_DESC_docs "rocprofiler-sdk documentation")
set(COMPONENT_DESC_tests "rocprofiler-sdk tests")
set(COMPONENT_DESC_roctx "ROCm Tools Extension library and headers")
set(EXPECTED_PACKAGING_COMPONENTS 6)
if(ROCPROFILER_BUILD_DOCS)
set(EXPECTED_PACKAGING_COMPONENTS 7)
endif()
if(NOT NUM_ROCPROFILER_PACKAGING_COMPONENTS EQUAL EXPECTED_PACKAGING_COMPONENTS)
message(
FATAL_ERROR
"Error new install component needs COMPONENT_NAME_* and COMPONENT_SEP_* entries: ${ROCPROFILER_PACKAGING_COMPONENTS}"
)
endif()
if(ROCM_DEP_ROCMCORE OR ROCPROFILER_DEP_ROCMCORE)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "rocm-core")
set(CPACK_RPM_PACKAGE_REQUIRES "rocm-core")
else()
set(CPACK_DEBIAN_PACKAGE_DEPENDS "")
set(CPACK_RPM_PACKAGE_REQUIRES "")
endif()
foreach(COMPONENT_GROUP ${ROCPROFILER_COMPONENT_GROUPS})
set(_DEP "${COMPONENT_DEP_${COMPONENT_GROUP}}")
set(_NAME "${COMPONENT_NAME_${COMPONENT_GROUP}}")
set(_DESC "${COMPONENT_DESC_${COMPONENT_GROUP}}")
cpack_add_component_group(
${COMPONENT_GROUP}
DISPLAY_NAME "${_NAME}"
DESCRIPTION "${_DESC}")
if(ROCM_DEP_ROCMCORE OR ROCPROFILER_DEP_ROCMCORE)
list(INSERT _DEP 0 "rocm-core")
endif()
string(TOUPPER "${COMPONENT_GROUP}" UCOMPONENT)
set(CPACK_DEBIAN_${UCOMPONENT}_PACKAGE_NAME "${_NAME}")
set(CPACK_DEBIAN_${UCOMPONENT}_PACKAGE_DEPENDS "${_DEP}")
set(CPACK_RPM_${UCOMPONENT}_PACKAGE_NAME "${_NAME}")
set(CPACK_RPM_${UCOMPONENT}_PACKAGE_REQUIRES "${_DEP}")
foreach(COMPONENT ${COMPONENT_GROUP_${COMPONENT_GROUP}_COMPONENTS})
cpack_add_component(${COMPONENT} REQUIRED GROUP "${COMPONENT_GROUP}")
endforeach()
endforeach()
# -------------------------------------------------------------------------------------- #
#
# Debian package specific variables
#
# -------------------------------------------------------------------------------------- #
set(CPACK_DEBIAN_PACKAGE_EPOCH 0)
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) # auto-generate deps based on shared libs
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON) # generate list of shared libs provided by
# package
set(CPACK_DEBIAN_TESTS_PACKAGE_SHLIBDEPS OFF) # disable for tests package
set(CPACK_DEBIAN_TESTS_PACKAGE_GENERATE_SHLIBS OFF) # disable for tests package
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "${PROJECT_HOMEPAGE_URL}")
set(CPACK_DEBIAN_PACKAGE_RELEASE
"${ROCPROFILER_CPACK_SYSTEM_NAME}${ROCPROFILER_CPACK_PACKAGE_SUFFIX}")
string(REGEX REPLACE "([a-zA-Z])-([0-9])" "\\1\\2" CPACK_DEBIAN_PACKAGE_RELEASE
"${CPACK_DEBIAN_PACKAGE_RELEASE}")
string(REPLACE "-" "~" CPACK_DEBIAN_PACKAGE_RELEASE "${CPACK_DEBIAN_PACKAGE_RELEASE}")
if(DEFINED ENV{CPACK_DEBIAN_PACKAGE_RELEASE})
set(CPACK_DEBIAN_PACKAGE_RELEASE $ENV{CPACK_DEBIAN_PACKAGE_RELEASE})
endif()
set(_DEBIAN_PACKAGE_DEPENDS "")
if(rocm_version_FOUND)
set(_ROCPROFILER_SUFFIX " (>= 1.0.0.${rocm_version_NUMERIC_VERSION})")
set(_ROCTRACER_SUFFIX " (>= 1.0.0.${rocm_version_NUMERIC_VERSION})")
set(_ROCM_SMI_SUFFIX
" (>= ${rocm_version_MAJOR_VERSION}.0.0.${rocm_version_NUMERIC_VERSION})")
endif()
string(REPLACE ";" ", " _DEBIAN_PACKAGE_DEPENDS "${_DEBIAN_PACKAGE_DEPENDS}")
set(CPACK_DEBIAN_PACKAGE_DEPENDS
"${_DEBIAN_PACKAGE_DEPENDS}"
CACHE STRING "Debian package dependencies" FORCE)
rocprofiler_add_feature(CPACK_DEBIAN_PACKAGE_DEPENDS "Debian package dependencies")
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
# -------------------------------------------------------------------------------------- #
#
# RPM package specific variables
#
# -------------------------------------------------------------------------------------- #
if(DEFINED CPACK_PACKAGING_INSTALL_PREFIX)
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "${CPACK_PACKAGING_INSTALL_PREFIX}")
endif()
set(CPACK_RPM_PACKAGE_EPOCH 0)
set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_RPM_PACKAGE_AUTOREQ ON) # auto-generate deps based on shared libs
set(CPACK_RPM_PACKAGE_AUTOPROV ON) # generate list of shared libs provided by package
set(CPACK_RPM_TESTS_PACKAGE_AUTOREQ OFF) # disable for tests package
set(CPACK_RPM_TESTS_PACKAGE_AUTOPROV OFF) # disable for tests package
set(CPACK_RPM_PACKAGE_RELEASE
"${ROCPROFILER_CPACK_SYSTEM_NAME}${ROCPROFILER_CPACK_PACKAGE_SUFFIX}")
string(REGEX REPLACE "([a-zA-Z])-([0-9])" "\\1\\2" CPACK_RPM_PACKAGE_RELEASE
"${CPACK_RPM_PACKAGE_RELEASE}")
string(REPLACE "-" "~" CPACK_RPM_PACKAGE_RELEASE "${CPACK_RPM_PACKAGE_RELEASE}")
if(DEFINED ENV{CPACK_RPM_PACKAGE_RELEASE})
set(CPACK_RPM_PACKAGE_RELEASE $ENV{CPACK_RPM_PACKAGE_RELEASE})
endif()
# Get rpm distro
if(CPACK_RPM_PACKAGE_RELEASE)
set(CPACK_RPM_PACKAGE_RELEASE_DIST ON)
endif()
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
# -------------------------------------------------------------------------------------- #
#
# Prepare final version for the CPACK use
#
# -------------------------------------------------------------------------------------- #
set(CPACK_PACKAGE_VERSION
"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}"
)
include(CPack)