CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
157 lines
5.8 KiB
CMake
157 lines
5.8 KiB
CMake
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
|
|
|
|
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND CMAKE_CURRENT_SOURCE_DIR STREQUAL
|
|
CMAKE_SOURCE_DIR)
|
|
set(MSG "")
|
|
message(STATUS "Warning! Building from the source directory is not recommended")
|
|
message(STATUS "If unintended, please remove 'CMakeCache.txt' and 'CMakeFiles'")
|
|
message(STATUS "and build from a separate directory")
|
|
message(AUTHOR_WARNING "In-source build")
|
|
endif()
|
|
|
|
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" FULL_VERSION_STRING LIMIT_COUNT 1)
|
|
string(REGEX REPLACE "(\n|\r)" "" FULL_VERSION_STRING "${FULL_VERSION_STRING}")
|
|
string(REGEX REPLACE "([0-9]+)\.([0-9]+)\.([0-9]+)(.*)" "\\1.\\2.\\3"
|
|
ROCPROFILER_SDK_VERSION "${FULL_VERSION_STRING}")
|
|
|
|
foreach(_LANG C CXX)
|
|
set(CMAKE_${_LANG}_FLAGS_COVERAGE_INIT
|
|
"-Og -g3 -fno-omit-frame-pointer -fprofile-abs-path -fprofile-arcs -ftest-coverage --coverage -DCODECOV=1"
|
|
CACHE STRING "${_LANG} flags for code coverage builds")
|
|
set(CMAKE_${_LANG}_FLAGS_COVERAGE
|
|
"${CMAKE_${_LANG}_FLAGS_COVERAGE_INIT}"
|
|
CACHE STRING "${_LANG} flags for code coverage builds")
|
|
endforeach()
|
|
|
|
project(
|
|
rocprofiler-sdk
|
|
LANGUAGES C CXX
|
|
VERSION ${ROCPROFILER_SDK_VERSION}
|
|
DESCRIPTION "ROCm GPU performance analysis SDK"
|
|
HOMEPAGE_URL "https://github.com/ROCm/rocprofiler-sdk")
|
|
|
|
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "core")
|
|
set(PACKAGE_NAME ${PROJECT_NAME})
|
|
string(REPLACE "-" "_" PACKAGE_NAME_UNDERSCORED ${PACKAGE_NAME})
|
|
|
|
if(NOT PROJECT_IS_TOP_LEVEL)
|
|
set(CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}] ")
|
|
endif()
|
|
|
|
find_package(Git)
|
|
|
|
if(Git_FOUND AND (EXISTS "${PROJECT_SOURCE_DIR}/../../.git"
|
|
OR EXISTS "${PROJECT_SOURCE_DIR}/.git"))
|
|
execute_process(
|
|
COMMAND ${GIT_EXECUTABLE} describe --tags
|
|
OUTPUT_VARIABLE ROCPROFILER_SDK_GIT_DESCRIBE
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
RESULT_VARIABLE _GIT_DESCRIBE_RESULT
|
|
ERROR_QUIET)
|
|
|
|
if(NOT _GIT_DESCRIBE_RESULT EQUAL 0)
|
|
execute_process(
|
|
COMMAND ${GIT_EXECUTABLE} describe
|
|
OUTPUT_VARIABLE ROCPROFILER_SDK_GIT_DESCRIBE
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
RESULT_VARIABLE _GIT_DESCRIBE_RESULT
|
|
ERROR_QUIET)
|
|
endif()
|
|
|
|
execute_process(
|
|
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
OUTPUT_VARIABLE ROCPROFILER_SDK_GIT_REVISION
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
|
else()
|
|
set(ROCPROFILER_SDK_GIT_DESCRIBE "v${ROCPROFILER_SDK_VERSION}")
|
|
set(ROCPROFILER_SDK_GIT_REVISION "")
|
|
endif()
|
|
|
|
# make sure that cmake re-runs when version file changes
|
|
configure_file(${PROJECT_SOURCE_DIR}/VERSION ${PROJECT_BINARY_DIR}/VERSION COPYONLY)
|
|
|
|
message(
|
|
STATUS
|
|
"[${PROJECT_NAME}] version ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} (${FULL_VERSION_STRING})"
|
|
)
|
|
message(STATUS "[${PROJECT_NAME}] git revision: ${ROCPROFILER_SDK_GIT_REVISION}")
|
|
message(STATUS "[${PROJECT_NAME}] git describe: ${ROCPROFILER_SDK_GIT_DESCRIBE}")
|
|
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${PROJECT_SOURCE_DIR}/cmake/Modules
|
|
${CMAKE_MODULE_PATH})
|
|
|
|
include(GNUInstallDirs) # install directories
|
|
set(CMAKE_INSTALL_LIBDIR "lib") # rocm doesn't use lib64
|
|
set(CMAKE_BUILD_RPATH "${PROJECT_BINARY_DIR}/lib:\$ORIGIN:\$ORIGIN/../lib")
|
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH
|
|
OFF
|
|
CACHE BOOL "")
|
|
set(CMAKE_DEBUG_POSTFIX
|
|
""
|
|
CACHE STRING "Suffix for non-executable build targets")
|
|
mark_as_advanced(CMAKE_INSTALL_RPATH_USE_LINK_PATH CMAKE_DEBUG_POSTFIX)
|
|
|
|
set(ROCPROFILER_INTERNAL_BUILD_DOCS
|
|
OFF
|
|
CACHE INTERNAL "Generates rocprofiler-sdk/version.h and exits (no build targets)")
|
|
if(ROCPROFILER_INTERNAL_BUILD_DOCS)
|
|
add_subdirectory(source/include)
|
|
return()
|
|
endif()
|
|
|
|
include(rocprofiler_utilities) # various functions/macros
|
|
include(rocprofiler_interfaces) # interface libraries
|
|
include(rocprofiler_compilers) # compiler identification
|
|
include(rocprofiler_options) # project options
|
|
include(rocprofiler_build_settings) # build flags
|
|
include(rocprofiler_formatting) # formatting
|
|
include(rocprofiler_linting) # clang-tidy
|
|
include(rocprofiler_config_interfaces) # configure interface libraries
|
|
|
|
if(ROCPROFILER_BUILD_TESTS)
|
|
# Source-level unit tests are configured before tests/common sets test GPU targets.
|
|
include("${PROJECT_SOURCE_DIR}/tests/cmake/rocprofiler_test_gpu_targets.cmake")
|
|
endif()
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
|
|
|
|
enable_testing()
|
|
include(CTest)
|
|
|
|
add_subdirectory(external)
|
|
add_subdirectory(source)
|
|
|
|
include(rocprofiler_config_install)
|
|
include(rocprofiler_config_install_roctx)
|
|
include(rocprofiler_config_install_rocpd)
|
|
# rocattach is only supported on x86_64 for now
|
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
|
|
include(rocprofiler_config_install_rocattach)
|
|
endif()
|
|
include(rocprofiler_config_install_tests)
|
|
|
|
# ROCPROFILER_BUILD_INTEGRATION_TESTS is not a standard option. If not defined, set it as
|
|
# a local (non-cached) variable equal to ROCPROFILER_BUILD_TESTS. If one only wants to
|
|
# build and install unit tests, they can use -DROCPROFILER_BUILD_INTEGRATION_TESTS=OFF.
|
|
if(NOT DEFINED ROCPROFILER_BUILD_INTEGRATION_TESTS)
|
|
set(ROCPROFILER_BUILD_INTEGRATION_TESTS ${ROCPROFILER_BUILD_TESTS})
|
|
endif()
|
|
|
|
if(ROCPROFILER_BUILD_TESTS AND ROCPROFILER_BUILD_INTEGRATION_TESTS)
|
|
add_subdirectory(tests)
|
|
endif()
|
|
|
|
if(ROCPROFILER_BUILD_SAMPLES)
|
|
add_subdirectory(samples)
|
|
endif()
|
|
|
|
if(ROCPROFILER_BUILD_BENCHMARK)
|
|
add_subdirectory(benchmark)
|
|
endif()
|
|
|
|
include(rocprofiler_config_packaging)
|
|
|
|
rocprofiler_print_features()
|