From 8fcf3a50b08615ed9c87564804b7ce03837de61d Mon Sep 17 00:00:00 2001 From: David Galiffi Date: Sun, 22 Jun 2025 10:44:33 -0400 Subject: [PATCH] Use `gersemi` for CMake formatting (#257) * Replace `cmake-format` with `gersemi` Signed-off-by: David Galiffi * Remove .cmake-format.yaml Signed-off-by: David Galiffi * Update workflow to use gersemi Signed-off-by: David Galiffi * Update CONTRIBUTING.md * Update helper scripts * Don't include `*/external/*` in workflows --------- Signed-off-by: David Galiffi [ROCm/rocprofiler-systems commit: 122623a92962db5da223313fadce878feca82cb3] --- .../rocprofiler-systems/.cmake-format.yaml | 305 --- projects/rocprofiler-systems/.gersemirc | 5 + .../.github/workflows/formatting.yml | 10 +- .../.pre-commit-config.yaml | 9 +- projects/rocprofiler-systems/CMakeLists.txt | 236 ++- projects/rocprofiler-systems/CONTRIBUTING.md | 4 +- .../cmake/BuildSettings.cmake | 238 ++- .../rocprofiler-systems/cmake/Compilers.cmake | 138 +- .../cmake/ConfigCPack.cmake | 127 +- .../cmake/ConfigInstall.cmake | 32 +- .../cmake/DyninstBoost.cmake | 174 +- .../cmake/DyninstElfUtils.cmake | 117 +- .../cmake/DyninstExternals.cmake | 72 +- .../cmake/DyninstLibIberty.cmake | 57 +- .../cmake/DyninstTBB.cmake | 124 +- .../cmake/DyninstTBBInstall.cmake | 9 +- .../cmake/Formatting.cmake | 65 +- .../cmake/MacroUtilities.cmake | 346 ++-- .../cmake/Modules/FindBoost.cmake | 1641 ++++++++++++----- .../cmake/Modules/FindLibDW.cmake | 53 +- .../cmake/Modules/FindLibDebuginfod.cmake | 37 +- .../cmake/Modules/FindLibDwarf.cmake | 9 +- .../cmake/Modules/FindLibElf.cmake | 9 +- .../cmake/Modules/FindLibIberty.cmake | 9 +- .../cmake/Modules/FindLibva-headers.cmake | 24 +- .../cmake/Modules/FindMPI-Headers.cmake | 95 +- .../cmake/Modules/FindROCmVersion.cmake | 160 +- .../cmake/Modules/FindTBB.cmake | 75 +- .../cmake/Modules/Findamd-smi.cmake | 19 +- projects/rocprofiler-systems/cmake/PAPI.cmake | 186 +- .../rocprofiler-systems/cmake/Packages.cmake | 546 +++--- .../rocprofiler-systems/cmake/Perfetto.cmake | 208 ++- .../examples/CMakeLists.txt | 11 +- .../examples/causal-helpers.cmake | 124 +- .../examples/causal/CMakeLists.txt | 27 +- .../examples/code-coverage/CMakeLists.txt | 21 +- .../examples/fork/CMakeLists.txt | 11 +- .../examples/jpegdecode/CMakeLists.txt | 34 +- .../examples/lulesh/CMakeLists.txt | 40 +- .../lulesh/cmake/Modules/Utilities.cmake | 45 +- .../examples/mpi/CMakeLists.txt | 37 +- .../examples/openmp/CMakeLists.txt | 60 +- .../examples/openmp/target/CMakeLists.txt | 44 +- .../examples/parallel-overhead/CMakeLists.txt | 21 +- .../examples/python/CMakeLists.txt | 24 +- .../examples/rccl/CMakeLists.txt | 50 +- .../examples/rewrite-caller/CMakeLists.txt | 11 +- .../examples/trace-time-window/CMakeLists.txt | 9 +- .../examples/transpose/CMakeLists.txt | 52 +- .../examples/user-api/CMakeLists.txt | 16 +- .../examples/videodecode/CMakeLists.txt | 43 +- .../scripts/check-cmake-format.sh | 8 +- .../scripts/write-rocprof-sys-install.cmake | 26 +- .../rocprofiler-systems/source/CMakeLists.txt | 9 +- .../source/bin/CMakeLists.txt | 2 +- .../bin/rocprof-sys-avail/CMakeLists.txt | 55 +- .../bin/rocprof-sys-causal/CMakeLists.txt | 27 +- .../source/bin/rocprof-sys-exe/CMakeLists.txt | 21 +- .../bin/rocprof-sys-instrument/CMakeLists.txt | 65 +- .../source/bin/rocprof-sys-run/CMakeLists.txt | 29 +- .../bin/rocprof-sys-sample/CMakeLists.txt | 28 +- .../source/bin/tests/CMakeLists.txt | 172 +- .../source/lib/CMakeLists.txt | 11 +- .../source/lib/binary/CMakeLists.txt | 30 +- .../source/lib/common/CMakeLists.txt | 47 +- .../source/lib/core/CMakeLists.txt | 48 +- .../source/lib/core/binary/CMakeLists.txt | 12 +- .../source/lib/core/components/CMakeLists.txt | 6 +- .../source/lib/core/containers/CMakeLists.txt | 9 +- .../source/lib/rocprof-sys-dl/CMakeLists.txt | 53 +- .../source/lib/rocprof-sys-rt/CMakeLists.txt | 79 +- .../lib/rocprof-sys-rt/cmake/platform.cmake | 75 +- .../lib/rocprof-sys-user/CMakeLists.txt | 53 +- .../source/lib/rocprof-sys/CMakeLists.txt | 90 +- .../lib/rocprof-sys/library/CMakeLists.txt | 29 +- .../rocprof-sys/library/causal/CMakeLists.txt | 26 +- .../library/causal/components/CMakeLists.txt | 12 +- .../library/components/CMakeLists.txt | 12 +- .../library/coverage/CMakeLists.txt | 6 +- .../library/rocprofiler-sdk/CMakeLists.txt | 18 +- .../library/tracing/CMakeLists.txt | 6 +- .../source/python/CMakeLists.txt | 123 +- .../source/python/cmake/ConfigPython.cmake | 58 +- .../cmake/Modules/FindPyBind11Python.cmake | 30 +- .../source/python/cmake/PyBind11Tools.cmake | 138 +- .../tests/rocprof-sys-annotate-tests.cmake | 37 +- .../tests/rocprof-sys-attach-tests.cmake | 29 +- .../tests/rocprof-sys-causal-tests.cmake | 36 +- .../rocprof-sys-code-coverage-tests.cmake | 12 +- .../tests/rocprof-sys-config-tests.cmake | 36 +- .../tests/rocprof-sys-decode-tests.cmake | 18 +- .../tests/rocprof-sys-fork-tests.cmake | 3 +- .../tests/rocprof-sys-instrument-tests.cmake | 8 +- .../tests/rocprof-sys-kokkos-tests.cmake | 18 +- .../tests/rocprof-sys-mpi-tests.cmake | 26 +- .../tests/rocprof-sys-nic-perf.cmake | 48 +- .../tests/rocprof-sys-openmp-tests.cmake | 33 +- .../tests/rocprof-sys-overflow-tests.cmake | 14 +- .../tests/rocprof-sys-pthread-tests.cmake | 4 +- .../tests/rocprof-sys-python-tests.cmake | 79 +- .../tests/rocprof-sys-rccl-tests.cmake | 6 +- .../tests/rocprof-sys-rocm-tests.cmake | 36 +- .../tests/rocprof-sys-testing.cmake | 568 +++--- .../tests/rocprof-sys-time-window-tests.cmake | 17 +- .../tests/rocprof-sys-user-api-tests.cmake | 3 +- .../tests/source/CMakeLists.txt | 9 +- 106 files changed, 5116 insertions(+), 3156 deletions(-) delete mode 100644 projects/rocprofiler-systems/.cmake-format.yaml create mode 100644 projects/rocprofiler-systems/.gersemirc diff --git a/projects/rocprofiler-systems/.cmake-format.yaml b/projects/rocprofiler-systems/.cmake-format.yaml deleted file mode 100644 index d9504a2789..0000000000 --- a/projects/rocprofiler-systems/.cmake-format.yaml +++ /dev/null @@ -1,305 +0,0 @@ -parse: - additional_commands: - rocprofiler_systems_checkout_git_submodule: - flags: - - RECURSIVE - kwargs: - RELATIVE_PATH: '*' - WORKING_DIRECTORY: '*' - TEST_FILE: '*' - REPO_URL: '*' - REPO_BRANCH: '*' - ADDITIONAL_COMMANDS: '*' - rocprofiler_systems_save_variables: - kwargs: - VARIABLES: '*' - CONDITION: '*' - rocprofiler_systems_restore_variables: - kwargs: - VARIABLES: '*' - CONDITION: '*' - rocprofiler_systems_add_test: - flags: - - SKIP_BASELINE - - SKIP_SAMPLING - - SKIP_REWRITE - - SKIP_RUNTIME - kwargs: - NAME: '*' - TARGET: '*' - MPI: '*' - GPU: '*' - NUM_PROCS: '*' - REWRITE_TIMEOUT: '*' - RUNTIME_TIMEOUT: '*' - SAMPLING_TIMEOUT: '*' - SAMPLING_ARGS: '*' - REWRITE_ARGS: '*' - RUNTIME_ARGS: '*' - RUN_ARGS: '*' - ENVIRONMENT: '*' - LABELS: '*' - PROPERTIES: '*' - SAMPLING_PASS_REGEX: '*' - SAMPLING_FAIL_REGEX: '*' - RUNTIME_PASS_REGEX: '*' - RUNTIME_FAIL_REGEX: '*' - REWRITE_PASS_REGEX: '*' - REWRITE_FAIL_REGEX: '*' - BASELINE_PASS_REGEX: '*' - BASELINE_FAIL_REGEX: '*' - REWRITE_RUN_PASS_REGEX: '*' - REWRITE_RUN_FAIL_REGEX: '*' - rocprofiler_systems_add_causal_test: - flags: - - SKIP_BASELINE - kwargs: - NAME: '*' - TARGET: '*' - CAUSAL_TIMEOUT: '*' - CAUSAL_VALIDATE_TIMEOUT: '*' - CAUSAL_MODE: '*' - CAUSAL_ARGS: '*' - CAUSAL_VALIDATE_ARGS: '*' - RUNTIME_ARGS: '*' - RUN_ARGS: '*' - ENVIRONMENT: '*' - LABELS: '*' - PROPERTIES: '*' - CAUSAL_PASS_REGEX: '*' - CAUSAL_FAIL_REGEX: '*' - BASELINE_PASS_REGEX: '*' - BASELINE_FAIL_REGEX: '*' - CAUSAL_VALIDATE_PASS_REGEX: '*' - CAUSAL_VALIDATE_FAIL_REGEX: '*' - rocprofiler_systems_target_compile_definitions: - kwargs: - PUBLIC: '*' - PRIVATE: '*' - INTERFACE: '*' - rocprofiler_systems_add_bin_test: - flags: - - WILL_FAIL - kwargs: - NAME: '*' - ARGS: '*' - LABELS: '*' - TARGET: '*' - DEPENDS: '*' - COMMAND: '*' - TIMEOUT: '*' - PROPERTIES: '*' - ENVIRONMENT: '*' - WORKING_DIRECTORY: '*' - PASS_REGEX: '*' - FAIL_REGEX: '*' - SKIP_REGEX: '*' - rocprofiler_systems_add_python_test: - flags: - - STANDALONE - kwargs: - NAME: '*' - FILE: '*' - TIMEOUT: '*' - PROFILE_ARGS: '*' - RUN_ARGS: '*' - ENVIRONMENT: '*' - LABELS: '*' - DEPENDS: '*' - COMMAND: '*' - PROPERTIES: '*' - PYTHON_EXECUTABLE: '*' - PYTHON_VERSION: '*' - PASS_REGEX: '*' - FAIL_REGEX: '*' - SKIP_REGEX: '*' - rocprofiler_systems_add_python_validation_test: - kwargs: - NAME: '*' - ARGS: '*' - PERFETTO_FILE: '*' - PERFETTO_METRIC: '*' - TIMEMORY_FILE: '*' - TIMEMORY_METRIC: '*' - rocm_version_message: - flags: - - STATUS - - WARNING - - SEND_ERROR - - FATAL_ERROR - - AUTHOR_WARNING - rocprofiler_systems_find_python: - flags: - - REQUIRED - - QUIET - kwargs: - VERSION: '*' - ROOT_DIR: '*' - COMPONENTS: '*' - rocprofiler_systems_python_console_script: - kwargs: - VERSION: '*' - ROOT_DIR: '*' - rocprofiler_systems_pybind11_add_module: - flags: - - MODULE - - SHARED - - EXCLUDE_FROM_ALL - - NO_EXTRAS - - SYSTEM - - THIN_LTO - - LTO - kwargs: - PYTHON_VERSION: '*' - CXX_STANDARD: '*' - VISIBILITY: '*' - rocprofiler_systems_directory: - flags: - - MKDIR - - FAIL - kwargs: - PREFIX: '*' - OUTPUT_VARIABLE: '*' - WORKING_DIRECTORY: '*' - PATHS: '*' - rocprofiler_systems_check_python_dirs_and_versions: - flags: - - UNSET - - FAIL - kwargs: - RESULT_VARIABLE: '*' - OUTPUT_VARIABLE: '*' - rocprofiler_systems_find_static_library: - flags: - - NO_CACHE - - REQUIRED - - NO_DEFAULT_PATH - - NO_PACKAGE_ROOT_PATH - - NO_CMAKE_PATH - - NO_CMAKE_ENVIRONMENT_PATH - - NO_SYSTEM_ENVIRONMENT_PATH - - CMAKE_FIND_ROOT_PATH_BOTH - - ONLY_CMAKE_FIND_ROOT_PATH - - NO_CMAKE_FIND_ROOT_PATH - kwargs: - NAMES: '*' - NAMES_PER_DIR: '*' - HINTS: '*' - PATHS: '*' - PATH_SUFFIXES: '*' - DOC: '*' - rocprofiler_systems_find_shared_library: - flags: - - NO_CACHE - - REQUIRED - - NO_DEFAULT_PATH - - NO_PACKAGE_ROOT_PATH - - NO_CMAKE_PATH - - NO_CMAKE_ENVIRONMENT_PATH - - NO_SYSTEM_ENVIRONMENT_PATH - - CMAKE_FIND_ROOT_PATH_BOTH - - ONLY_CMAKE_FIND_ROOT_PATH - - NO_CMAKE_FIND_ROOT_PATH - kwargs: - NAMES: '*' - NAMES_PER_DIR: '*' - HINTS: '*' - PATHS: '*' - PATH_SUFFIXES: '*' - DOC: '*' - rocprofiler_systems_causal_example_executable: - kwargs: - TAG: '*' - SOURCES: '*' - DEFINITIONS: '*' - LINK_LIBRARIES: '*' - INCLUDE_DIRECTORIES: '*' - rocprofiler_systems_add_validation_test: - kwargs: - NAME: '*' - ARGS: '*' - LABELS: '*' - TIMEOUT: '*' - DEPENDS: '*' - PROPERTIES: '*' - PASS_REGEX: '*' - FAIL_REGEX: '*' - SKIP_REGEX: '*' - ENVIRONMENT: '*' - PERFETTO_FILE: '*' - PERFETTO_METRIC: '*' - TIMEMORY_FILE: '*' - TIMEMORY_METRIC: '*' - EXIST_FILES: '*' - rocprofiler_systems_custom_compilation: - flags: - - GLOBAL - - PROJECT - kwargs: - COMPILER: '*' - DIRECTORY: '*' - TARGET: '*' - SOURCE: '*' - override_spec: {} - vartags: [] - proptags: [] -format: - disable: false - line_width: 90 - tab_size: 4 - use_tabchars: false - fractional_tab_policy: use-space - max_subgroups_hwrap: 2 - max_pargs_hwrap: 8 - max_rows_cmdline: 2 - separate_ctrl_name_with_space: false - separate_fn_name_with_space: false - dangle_parens: false - dangle_align: child - min_prefix_chars: 4 - max_prefix_chars: 10 - max_lines_hwrap: 2 - line_ending: unix - command_case: lower - keyword_case: upper - always_wrap: [] - enable_sort: true - autosort: false - require_valid_layout: false - layout_passes: {} -markup: - bullet_char: '*' - enum_char: . - first_comment_is_literal: true - literal_comment_pattern: ^# - fence_pattern: ^\s*([`~]{3}[`~]*)(.*)$ - ruler_pattern: ^\s*[^\w\s]{3}.*[^\w\s]{3}$ - explicit_trailing_pattern: '#<' - hashruler_min_length: 10 - canonicalize_hashrulers: true - enable_markup: true -lint: - disabled_codes: [] - function_pattern: '[0-9a-z_]+' - macro_pattern: '[0-9A-Z_]+' - global_var_pattern: '[A-Z][0-9A-Z_]+' - internal_var_pattern: _[A-Z][0-9A-Z_]+ - local_var_pattern: '[a-z][a-z0-9_]+' - private_var_pattern: _[0-9a-z_]+ - public_var_pattern: '[A-Z][0-9A-Z_]+' - argument_var_pattern: '[a-z][a-z0-9_]+' - keyword_pattern: '[A-Z][0-9A-Z_]+' - max_conditionals_custom_parser: 2 - min_statement_spacing: 1 - max_statement_spacing: 2 - max_returns: 6 - max_branches: 12 - max_arguments: 5 - max_localvars: 15 - max_statements: 50 -encode: - emit_byteorder_mark: false - input_encoding: utf-8 - output_encoding: utf-8 -misc: - per_command: {} diff --git a/projects/rocprofiler-systems/.gersemirc b/projects/rocprofiler-systems/.gersemirc new file mode 100644 index 0000000000..49555be6e5 --- /dev/null +++ b/projects/rocprofiler-systems/.gersemirc @@ -0,0 +1,5 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/BlankSpruce/gersemi/0.19.3/gersemi/configuration.schema.json + +warn_about_unknown_commands: false +indent: 4 +line_length: 90 diff --git a/projects/rocprofiler-systems/.github/workflows/formatting.yml b/projects/rocprofiler-systems/.github/workflows/formatting.yml index 5d6bf1d9fd..993fca0446 100644 --- a/projects/rocprofiler-systems/.github/workflows/formatting.yml +++ b/projects/rocprofiler-systems/.github/workflows/formatting.yml @@ -40,7 +40,7 @@ jobs: black --diff --check . cmake: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 @@ -48,13 +48,13 @@ jobs: run: | sudo apt-get update sudo apt-get install -y python3-pip - python3 -m pip install cmake-format - - name: cmake-format + python3 -m pip install gersemi + - name: gersemi run: | set +e - cmake-format -i $(find . -type f | egrep 'CMakeLists.txt|\.cmake$') + gersemi -i $(find . -type f ! -path '*/external/*' | grep -E 'CMakeLists.txt|\.cmake$') if [ $(git diff | wc -l) -gt 0 ]; then - echo -e "\nError! CMake code not formatted. Run cmake-format...\n" + echo -e "\nError! CMake code not formatted. Run gersemi ...\n" echo -e "\nFiles:\n" git diff --name-only echo -e "\nFull diff:\n" diff --git a/projects/rocprofiler-systems/.pre-commit-config.yaml b/projects/rocprofiler-systems/.pre-commit-config.yaml index a7c0fa50fd..9e0c2e1586 100644 --- a/projects/rocprofiler-systems/.pre-commit-config.yaml +++ b/projects/rocprofiler-systems/.pre-commit-config.yaml @@ -40,13 +40,10 @@ repos: - id: clang-format files: \.(c|cpp|h.*)$ - - repo: local + - repo: https://github.com/BlankSpruce/gersemi + rev: 0.19.3 hooks: - - id: check-cmake - name: cmake-format - entry: ./scripts/check-cmake-format.sh - language: script - files: (^|/)(CMakeLists\.txt|.*\.cmake)$ + - id: gersemi - repo: local hooks: diff --git a/projects/rocprofiler-systems/CMakeLists.txt b/projects/rocprofiler-systems/CMakeLists.txt index c68ecdeb38..04bb87d551 100644 --- a/projects/rocprofiler-systems/CMakeLists.txt +++ b/projects/rocprofiler-systems/CMakeLists.txt @@ -1,7 +1,9 @@ cmake_minimum_required(VERSION 3.18.4 FATAL_ERROR) -if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND CMAKE_CURRENT_SOURCE_DIR STREQUAL - CMAKE_SOURCE_DIR) +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 unintented, please remove 'CMakeCache.txt' and 'CMakeFiles'") @@ -17,21 +19,27 @@ endif() if(NOT UNIX OR APPLE) message( AUTHOR_WARNING - "rocprofiler-systems only supports Linux. Configure and/or build is likely to fail" - ) + "rocprofiler-systems only supports Linux. Configure and/or build is likely to fail" + ) 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" ROCPROFSYS_VERSION - "${FULL_VERSION_STRING}") +string( + REGEX REPLACE + "([0-9]+)\.([0-9]+)\.([0-9]+)(.*)" + "\\1.\\2.\\3" + ROCPROFSYS_VERSION + "${FULL_VERSION_STRING}" +) project( rocprofiler-systems LANGUAGES C CXX VERSION ${ROCPROFSYS_VERSION} DESCRIPTION "CPU/GPU Application tracing with static/dynamic binary instrumentation" - HOMEPAGE_URL "https://github.com/ROCm/rocprofiler-systems") + HOMEPAGE_URL "https://github.com/ROCm/rocprofiler-systems" +) set(PROJECT_NAME_UNDERSCORED "rocprofiler_systems") set(BINARY_NAME_PREFIX "rocprof-sys") @@ -44,19 +52,23 @@ if(Git_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") OUTPUT_VARIABLE ROCPROFSYS_GIT_DESCRIBE OUTPUT_STRIP_TRAILING_WHITESPACE RESULT_VARIABLE _GIT_DESCRIBE_RESULT - ERROR_QUIET) + ERROR_QUIET + ) if(NOT _GIT_DESCRIBE_RESULT EQUAL 0) execute_process( COMMAND ${GIT_EXECUTABLE} describe OUTPUT_VARIABLE ROCPROFSYS_GIT_DESCRIBE OUTPUT_STRIP_TRAILING_WHITESPACE RESULT_VARIABLE _GIT_DESCRIBE_RESULT - ERROR_QUIET) + ERROR_QUIET + ) endif() execute_process( COMMAND ${GIT_EXECUTABLE} rev-parse HEAD OUTPUT_VARIABLE ROCPROFSYS_GIT_REVISION - OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) else() set(ROCPROFSYS_GIT_DESCRIBE "v${ROCPROFSYS_VERSION}") set(ROCPROFSYS_GIT_REVISION "") @@ -64,38 +76,34 @@ endif() message( STATUS - "[${PROJECT_NAME}] version ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} (${FULL_VERSION_STRING})" - ) + "[${PROJECT_NAME}] version ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} (${FULL_VERSION_STRING})" +) message(STATUS "[${PROJECT_NAME}] git revision: ${ROCPROFSYS_GIT_REVISION}") message(STATUS "[${PROJECT_NAME}] git describe: ${ROCPROFSYS_GIT_DESCRIBE}") -set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${PROJECT_SOURCE_DIR}/cmake/Modules - ${PROJECT_SOURCE_DIR}/source/python/cmake ${CMAKE_MODULE_PATH}) -set(BUILD_SHARED_LIBS - ON - CACHE BOOL "Build shared libraries") -set(BUILD_STATIC_LIBS - OFF - CACHE BOOL "Build static libraries") -set(CMAKE_POSITION_INDEPENDENT_CODE - ON - CACHE BOOL "Build position independent code") +set(CMAKE_MODULE_PATH + ${PROJECT_SOURCE_DIR}/cmake + ${PROJECT_SOURCE_DIR}/cmake/Modules + ${PROJECT_SOURCE_DIR}/source/python/cmake + ${CMAKE_MODULE_PATH} +) +set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries") +set(BUILD_STATIC_LIBS OFF CACHE BOOL "Build static libraries") +set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "Build position independent code") if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24) cmake_policy(SET CMP0135 NEW) endif() if("${CMAKE_BUILD_TYPE}" STREQUAL "") - set(CMAKE_BUILD_TYPE - Release - CACHE STRING "Build type" FORCE) + set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE) else() set(VALID_BUILD_TYPES "Release" "RelWithDebInfo" "Debug" "MinSizeRel") if(NOT "${CMAKE_BUILD_TYPE}" IN_LIST VALID_BUILD_TYPES) string(REPLACE ";" ", " _VALID_BUILD_TYPES "${VALID_BUILD_TYPES}") message( FATAL_ERROR - "Invalid CMAKE_BUILD_TYPE :: ${CMAKE_BUILD_TYPE}. Valid build types are: ${_VALID_BUILD_TYPES}" - ) + "Invalid CMAKE_BUILD_TYPE :: ${CMAKE_BUILD_TYPE}. Valid build types are: ${_VALID_BUILD_TYPES}" + ) endif() endif() set(_STRIP_LIBRARIES_DEFAULT OFF) @@ -110,7 +118,10 @@ if(DEFINED CMAKE_INSTALL_LIBDIR AND NOT DEFINED CMAKE_DEFAULT_INSTALL_LIBDIR) # force this because dyninst always installs to lib set(CMAKE_DEFAULT_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}" - CACHE STRING "Object code libraries" FORCE) + CACHE STRING + "Object code libraries" + FORCE + ) endif() if(NOT "$ENV{ROCPROFSYS_CI}" STREQUAL "") @@ -124,78 +135,92 @@ include(MacroUtilities) # various functions and macros if(CI_BUILD) rocprofiler_systems_add_option(ROCPROFSYS_BUILD_CI "Enable internal asserts, etc." ON - ADVANCED NO_FEATURE) + ADVANCED NO_FEATURE + ) rocprofiler_systems_add_option(ROCPROFSYS_BUILD_TESTING - "Enable building the testing suite" ON ADVANCED) + "Enable building the testing suite" ON ADVANCED + ) rocprofiler_systems_add_option( ROCPROFSYS_BUILD_DEBUG "Enable building with extensive debug symbols" OFF - ADVANCED) + ADVANCED + ) rocprofiler_systems_add_option( ROCPROFSYS_BUILD_HIDDEN_VISIBILITY - "Build with hidden visibility (disable for Debug builds)" OFF ADVANCED) + "Build with hidden visibility (disable for Debug builds)" OFF ADVANCED + ) rocprofiler_systems_add_option(ROCPROFSYS_STRIP_LIBRARIES "Strip the libraries" OFF - ADVANCED) + ADVANCED + ) else() rocprofiler_systems_add_option(ROCPROFSYS_BUILD_CI "Enable internal asserts, etc." - OFF ADVANCED NO_FEATURE) + OFF ADVANCED NO_FEATURE + ) rocprofiler_systems_add_option(ROCPROFSYS_BUILD_EXAMPLES - "Enable building the examples" OFF ADVANCED) + "Enable building the examples" OFF ADVANCED + ) rocprofiler_systems_add_option(ROCPROFSYS_BUILD_TESTING - "Enable building the testing suite" OFF ADVANCED) + "Enable building the testing suite" OFF ADVANCED + ) rocprofiler_systems_add_option( ROCPROFSYS_BUILD_DEBUG "Enable building with extensive debug symbols" OFF - ADVANCED) + ADVANCED + ) rocprofiler_systems_add_option( ROCPROFSYS_BUILD_HIDDEN_VISIBILITY - "Build with hidden visibility (disable for Debug builds)" ON ADVANCED) + "Build with hidden visibility (disable for Debug builds)" ON ADVANCED + ) rocprofiler_systems_add_option(ROCPROFSYS_STRIP_LIBRARIES "Strip the libraries" - ${_STRIP_LIBRARIES_DEFAULT} ADVANCED) + ${_STRIP_LIBRARIES_DEFAULT} ADVANCED + ) endif() include(Compilers) # compiler identification include(BuildSettings) # compiler flags -set(CMAKE_INSTALL_LIBDIR - "lib" - CACHE STRING "Object code libraries (lib)" FORCE) -set(CMAKE_CXX_STANDARD - 17 - CACHE STRING "CXX language standard") +set(CMAKE_INSTALL_LIBDIR "lib" CACHE STRING "Object code libraries (lib)" FORCE) +set(CMAKE_CXX_STANDARD 17 CACHE STRING "CXX language standard") rocprofiler_systems_add_feature(CMAKE_BUILD_TYPE "Build optimization level") rocprofiler_systems_add_feature(CMAKE_INSTALL_PREFIX "Installation prefix") rocprofiler_systems_add_feature(CMAKE_CXX_COMPILER "C++ compiler") rocprofiler_systems_add_feature(CMAKE_CXX_STANDARD "CXX language standard") rocprofiler_systems_add_option(CMAKE_CXX_STANDARD_REQUIRED - "Require C++ language standard" ON) + "Require C++ language standard" ON +) rocprofiler_systems_add_option(CMAKE_CXX_EXTENSIONS - "Compiler specific language extensions" OFF) + "Compiler specific language extensions" OFF +) rocprofiler_systems_add_option(CMAKE_INSTALL_RPATH_USE_LINK_PATH - "Enable rpath to linked libraries" ON) -set(CMAKE_INSTALL_MESSAGE - "LAZY" - CACHE STRING "Installation message") + "Enable rpath to linked libraries" ON +) +set(CMAKE_INSTALL_MESSAGE "LAZY" CACHE STRING "Installation message") mark_as_advanced(CMAKE_INSTALL_MESSAGE) rocprofiler_systems_add_option(ROCPROFSYS_USE_CLANG_TIDY "Enable clang-tidy" OFF) rocprofiler_systems_add_option(ROCPROFSYS_USE_BFD - "Enable BFD support (map call-stack samples to LOC)" ON) + "Enable BFD support (map call-stack samples to LOC)" ON +) rocprofiler_systems_add_option(ROCPROFSYS_USE_MPI "Enable MPI support" OFF) rocprofiler_systems_add_option(ROCPROFSYS_USE_ROCM "Enable ROCm support" ON) rocprofiler_systems_add_option(ROCPROFSYS_USE_PAPI "Enable HW counter support via PAPI" - ON) + ON +) rocprofiler_systems_add_option( ROCPROFSYS_USE_MPI_HEADERS - "Enable wrapping MPI functions w/o enabling MPI dependency" ON) + "Enable wrapping MPI functions w/o enabling MPI dependency" ON +) rocprofiler_systems_add_option(ROCPROFSYS_USE_OMPT "Enable OpenMP tools support" ON) rocprofiler_systems_add_option(ROCPROFSYS_USE_PYTHON "Enable Python support" OFF) rocprofiler_systems_add_option(ROCPROFSYS_BUILD_DYNINST "Build dyninst from submodule" - OFF) + OFF +) rocprofiler_systems_add_option(ROCPROFSYS_BUILD_LIBUNWIND - "Build libunwind from submodule" ON) + "Build libunwind from submodule" ON +) rocprofiler_systems_add_option(ROCPROFSYS_BUILD_CODECOV "Build for code coverage" OFF) rocprofiler_systems_add_option(ROCPROFSYS_INSTALL_PERFETTO_TOOLS - "Install perfetto tools (i.e. traced, perfetto, etc.)" OFF) + "Install perfetto tools (i.e. traced, perfetto, etc.)" OFF +) if(ROCPROFSYS_USE_PAPI) rocprofiler_systems_add_option(ROCPROFSYS_BUILD_PAPI "Build PAPI from submodule" ON) @@ -203,24 +228,24 @@ endif() if(ROCPROFSYS_USE_PYTHON) rocprofiler_systems_add_option(ROCPROFSYS_BUILD_PYTHON - "Build python bindings with internal pybind11" ON) + "Build python bindings with internal pybind11" ON + ) elseif("$ENV{ROCPROFSYS_CI}") # quiet warnings in dashboard if(ROCPROFSYS_PYTHON_ENVS OR ROCPROFSYS_PYTHON_PREFIX) rocprofiler_systems_message( STATUS - "Ignoring values of ROCPROFSYS_PYTHON_ENVS and/or ROCPROFSYS_PYTHON_PREFIX") + "Ignoring values of ROCPROFSYS_PYTHON_ENVS and/or ROCPROFSYS_PYTHON_PREFIX" + ) endif() endif() if(ROCPROFSYS_BUILD_TESTING) - set(ROCPROFSYS_BUILD_EXAMPLES - ON - CACHE BOOL "Enable building the examples" FORCE) + set(ROCPROFSYS_BUILD_EXAMPLES ON CACHE BOOL "Enable building the examples" FORCE) endif() include(ProcessorCount) -processorcount(ROCPROFSYS_PROCESSOR_COUNT) +ProcessorCount(ROCPROFSYS_PROCESSOR_COUNT) if(ROCPROFSYS_PROCESSOR_COUNT LESS 8) set(ROCPROFSYS_THREAD_COUNT 128) @@ -236,14 +261,13 @@ endif() set(ROCPROFSYS_MAX_THREADS "${ROCPROFSYS_THREAD_COUNT}" - CACHE - STRING - "Maximum number of threads in the host application. Likely only needs to be increased if host app does not use thread-pool but creates many threads" - ) + CACHE STRING + "Maximum number of threads in the host application. Likely only needs to be increased if host app does not use thread-pool but creates many threads" +) rocprofiler_systems_add_feature( ROCPROFSYS_MAX_THREADS "Maximum number of total threads supported in the host application (default: max of 128 or 16 * nproc)" - ) +) compute_pow2_ceil(_MAX_THREADS "${ROCPROFSYS_MAX_THREADS}") @@ -251,35 +275,40 @@ if(_MAX_THREADS GREATER 0 AND NOT ROCPROFSYS_MAX_THREADS EQUAL _MAX_THREADS) rocprofiler_systems_message( FATAL_ERROR "Error! ROCPROFSYS_MAX_THREADS must be a power of 2. Recommendation: ${_MAX_THREADS}" - ) + ) elseif(NOT ROCPROFSYS_MAX_THREADS EQUAL _MAX_THREADS) rocprofiler_systems_message( AUTHOR_WARNING "ROCPROFSYS_MAX_THREADS (=${ROCPROFSYS_MAX_THREADS}) must be a power of 2. We were unable to verify it so we are emitting this warning instead. Estimate resulted in: ${_MAX_THREADS}" - ) + ) endif() set(ROCPROFSYS_MAX_UNWIND_DEPTH "64" - CACHE - STRING - "Maximum call-stack depth to search during call-stack unwinding. Decreasing this value will result in sampling consuming less memory" - ) + CACHE STRING + "Maximum call-stack depth to search during call-stack unwinding. Decreasing this value will result in sampling consuming less memory" +) rocprofiler_systems_add_feature( ROCPROFSYS_MAX_UNWIND_DEPTH "Maximum call-stack depth to search during call-stack unwinding. Decreasing this value will result in sampling consuming less memory" - ) +) # default visibility settings set(CMAKE_C_VISIBILITY_PRESET "default" - CACHE STRING "Visibility preset for non-inline C functions") + CACHE STRING + "Visibility preset for non-inline C functions" +) set(CMAKE_CXX_VISIBILITY_PRESET "default" - CACHE STRING "Visibility preset for non-inline C++ functions/objects") + CACHE STRING + "Visibility preset for non-inline C++ functions/objects" +) set(CMAKE_VISIBILITY_INLINES_HIDDEN OFF - CACHE BOOL "Visibility preset for inline functions") + CACHE BOOL + "Visibility preset for inline functions" +) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) include(Formatting) # format target @@ -309,20 +338,22 @@ set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME core) if(ROCPROFSYS_BUILD_CODECOV) rocprofiler_systems_save_variables(CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS - CMAKE_CXX_FLAGS) + CMAKE_CXX_FLAGS + ) foreach(_BUILD_TYPE DEBUG MINSIZEREL RELWITHDEBINFO RELEASE) rocprofiler_systems_save_variables( CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS_${_BUILD_TYPE} - CMAKE_CXX_FLAGS_${_BUILD_TYPE}) + CMAKE_CXX_FLAGS_${_BUILD_TYPE} + ) endforeach() foreach(_BUILD_TYPE DEBUG MINSIZEREL RELWITHDEBINFO RELEASE) set(CMAKE_C_FLAGS_${_BUILD_TYPE} "-Og -g3 -fno-omit-frame-pointer -fprofile-abs-path -fprofile-arcs -ftest-coverage" - ) + ) set(CMAKE_CXX_FLAGS_${_BUILD_TYPE} "-Og -g3 -fno-omit-frame-pointer -fprofile-abs-path -fprofile-arcs -ftest-coverage" - ) + ) endforeach() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage") @@ -333,12 +364,14 @@ add_subdirectory(source) if(ROCPROFSYS_BUILD_CODECOV) rocprofiler_systems_restore_variables(CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS - CMAKE_CXX_FLAGS) + CMAKE_CXX_FLAGS + ) foreach(_BUILD_TYPE DEBUG MINSIZEREL RELWITHDEBINFO RELEASE) rocprofiler_systems_restore_variables( CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS_${_BUILD_TYPE} - CMAKE_CXX_FLAGS_${_BUILD_TYPE}) + CMAKE_CXX_FLAGS_${_BUILD_TYPE} + ) endforeach() endif() @@ -351,49 +384,60 @@ endif() configure_file( ${PROJECT_SOURCE_DIR}/LICENSE ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}/LICENSE - COPYONLY) + COPYONLY +) configure_file( ${PROJECT_SOURCE_DIR}/perfetto.cfg ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/perfetto.cfg - COPYONLY) + COPYONLY +) configure_file( ${PROJECT_SOURCE_DIR}/cmake/Templates/setup-env.sh.in - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/setup-env.sh @ONLY) + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/setup-env.sh + @ONLY +) configure_file( ${PROJECT_SOURCE_DIR}/cmake/Templates/modulefile.in ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PROJECT_NAME}/${ROCPROFSYS_VERSION} - @ONLY) + @ONLY +) configure_file( ${PROJECT_SOURCE_DIR}/scripts/merge-multiprocess-output.sh ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBEXECDIR}/${PROJECT_NAME}/rocprof-sys-merge-output.sh - COPYONLY) + COPYONLY +) install( - FILES ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/setup-env.sh - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/perfetto.cfg + FILES + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/setup-env.sh + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/perfetto.cfg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME} - COMPONENT setup) + COMPONENT setup +) install( FILES ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PROJECT_NAME}/${ROCPROFSYS_VERSION} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PROJECT_NAME} - COMPONENT setup) + COMPONENT setup +) install( FILES ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}/LICENSE DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME} - COMPONENT setup) + COMPONENT setup +) install( PROGRAMS ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBEXECDIR}/${PROJECT_NAME}/rocprof-sys-merge-output.sh DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/${PROJECT_NAME} - COMPONENT setup) + COMPONENT setup +) # ------------------------------------------------------------------------------# # diff --git a/projects/rocprofiler-systems/CONTRIBUTING.md b/projects/rocprofiler-systems/CONTRIBUTING.md index 7df86dcc52..d295ca9cf6 100644 --- a/projects/rocprofiler-systems/CONTRIBUTING.md +++ b/projects/rocprofiler-systems/CONTRIBUTING.md @@ -51,7 +51,7 @@ By creating a pull request, you agree to the statements made in the [code licens * Fork the repository and create your branch from `amd-staging`. * If you've added code that should be tested, add tests. * Ensure the test suite passes. -* Make sure your code conforms to the format. Use clang-format-18 and/or cmake-format. +* Make sure your code conforms to the format. Use clang-format-18 and/or gersemi. * Use clear and descriptive commit messages. * Submit your PR and work with the reviewer or maintainer to get your PR approved * Once approved, the PR is brought onto internal CI systems and may be merged into the component during our release cycle, as coordinated by the maintainer. @@ -77,7 +77,7 @@ By creating a pull request, you agree to the statements made in the [code licens * Adhere to the coding style used in the project. This includes naming conventions, indentation, and commenting practices. * Follow the existing directory structure and organization of the codebase. * Group related files together and maintain a logical hierarchy. -* Use `clang-format-18` and `cmake-format` formatters to ensure consistency. +* Use `clang-format-18` and `gersemi` formatters to ensure consistency. ### Using pre-commit hooks ### diff --git a/projects/rocprofiler-systems/cmake/BuildSettings.cmake b/projects/rocprofiler-systems/cmake/BuildSettings.cmake index b2469a6a9b..9110d80d8f 100644 --- a/projects/rocprofiler-systems/cmake/BuildSettings.cmake +++ b/projects/rocprofiler-systems/cmake/BuildSettings.cmake @@ -14,53 +14,70 @@ include(MacroUtilities) rocprofiler_systems_add_option( ROCPROFSYS_BUILD_DEVELOPER "Extra build flags for development like -Werror" - ${ROCPROFSYS_BUILD_CI}) + ${ROCPROFSYS_BUILD_CI} +) rocprofiler_systems_add_option(ROCPROFSYS_BUILD_RELEASE - "Build with minimal debug line info" OFF) + "Build with minimal debug line info" OFF +) rocprofiler_systems_add_option(ROCPROFSYS_BUILD_EXTRA_OPTIMIZATIONS - "Extra optimization flags" OFF) + "Extra optimization flags" OFF +) rocprofiler_systems_add_option(ROCPROFSYS_BUILD_LTO "Build with link-time optimization" - OFF) + OFF +) rocprofiler_systems_add_option(ROCPROFSYS_USE_COMPILE_TIMING - "Build with timing metrics for compilation" OFF) + "Build with timing metrics for compilation" OFF +) rocprofiler_systems_add_option(ROCPROFSYS_USE_SANITIZER - "Build with -fsanitze=\${ROCPROFSYS_SANITIZER_TYPE}" OFF) + "Build with -fsanitze=\${ROCPROFSYS_SANITIZER_TYPE}" OFF +) rocprofiler_systems_add_option(ROCPROFSYS_BUILD_STATIC_LIBGCC - "Build with -static-libgcc if possible" OFF) + "Build with -static-libgcc if possible" OFF +) rocprofiler_systems_add_option(ROCPROFSYS_BUILD_STATIC_LIBSTDCXX - "Build with -static-libstdc++ if possible" OFF) + "Build with -static-libstdc++ if possible" OFF +) rocprofiler_systems_add_option(ROCPROFSYS_BUILD_STACK_PROTECTOR - "Build with -fstack-protector" ON) + "Build with -fstack-protector" ON +) rocprofiler_systems_add_cache_option( ROCPROFSYS_BUILD_LINKER - "If set to a non-empty value, pass -fuse-ld=\${ROCPROFSYS_BUILD_LINKER}" STRING "bfd") + "If set to a non-empty value, pass -fuse-ld=\${ROCPROFSYS_BUILD_LINKER}" STRING "bfd" +) rocprofiler_systems_add_cache_option(ROCPROFSYS_BUILD_NUMBER "Internal CI use" STRING "0" - ADVANCED NO_FEATURE) + ADVANCED NO_FEATURE +) rocprofiler_systems_add_interface_library(rocprofiler-systems-static-libgcc - "Link to static version of libgcc") + "Link to static version of libgcc" +) rocprofiler_systems_add_interface_library(rocprofiler-systems-static-libstdcxx - "Link to static version of libstdc++") + "Link to static version of libstdc++" +) rocprofiler_systems_add_interface_library(rocprofiler-systems-static-libgcc-optional - "Link to static version of libgcc") + "Link to static version of libgcc" +) rocprofiler_systems_add_interface_library(rocprofiler-systems-static-libstdcxx-optional - "Link to static version of libstdc++") + "Link to static version of libstdc++" +) -target_compile_definitions(rocprofiler-systems-compile-options - INTERFACE $<$:DEBUG>) +target_compile_definitions( + rocprofiler-systems-compile-options + INTERFACE $<$:DEBUG> +) -set(ROCPROFSYS_SANITIZER_TYPE - "leak" - CACHE STRING "Sanitizer type") +set(ROCPROFSYS_SANITIZER_TYPE "leak" CACHE STRING "Sanitizer type") if(ROCPROFSYS_USE_SANITIZER) rocprofiler_systems_add_feature( ROCPROFSYS_SANITIZER_TYPE - "Sanitizer type, e.g. leak, thread, address, memory, etc.") + "Sanitizer type, e.g. leak, thread, address, memory, etc." + ) endif() if(ROCPROFSYS_BUILD_CI) rocprofiler_systems_target_compile_definitions(${LIBNAME}-compile-options - INTERFACE ROCPROFSYS_CI) + INTERFACE ROCPROFSYS_CI + ) endif() # ----------------------------------------------------------------------------------------# @@ -68,9 +85,7 @@ endif() # if(CMAKE_DL_LIBS AND NOT "${CMAKE_DL_LIBS}" STREQUAL "dl") # if cmake provides dl library, use that - set(dl_LIBRARY - ${CMAKE_DL_LIBS} - CACHE FILEPATH "dynamic linking system library") + set(dl_LIBRARY ${CMAKE_DL_LIBS} CACHE FILEPATH "dynamic linking system library") endif() foreach(_TYPE dl rt dw) @@ -92,7 +107,8 @@ endif() # add_flag_if_avail( "-W" "-Wall" "-Wno-unknown-pragmas" "-Wno-unused-function" "-Wno-ignored-attributes" - "-Wno-attributes" "-Wno-missing-field-initializers" "-Wno-interference-size") + "-Wno-attributes" "-Wno-missing-field-initializers" "-Wno-interference-size" +) if(ROCPROFSYS_BUILD_DEBUG) add_flag_if_avail("-g3" "-fno-omit-frame-pointer") @@ -113,10 +129,11 @@ endif() rocprofiler_systems_add_interface_library( rocprofiler-systems-compile-debuginfo "Attempts to set best flags for more expressive profiling information in debug or optimized binaries" - ) +) add_target_flag_if_avail(rocprofiler-systems-compile-debuginfo "-g3" - "-fno-omit-frame-pointer" "-fno-optimize-sibling-calls") + "-fno-omit-frame-pointer" "-fno-optimize-sibling-calls" +) if(CMAKE_CUDA_COMPILER_IS_NVIDIA) add_target_cuda_flag(rocprofiler-systems-compile-debuginfo "-lineinfo") @@ -124,19 +141,24 @@ endif() target_compile_options( rocprofiler-systems-compile-debuginfo - INTERFACE $<$:$<$:-rdynamic>> - $<$:$<$:-rdynamic>>) + INTERFACE + $<$:$<$:-rdynamic>> + $<$:$<$:-rdynamic>> +) if(NOT APPLE) - target_link_options(rocprofiler-systems-compile-debuginfo INTERFACE - $<$:-rdynamic>) + target_link_options( + rocprofiler-systems-compile-debuginfo + INTERFACE $<$:-rdynamic> + ) endif() if(CMAKE_CUDA_COMPILER_IS_NVIDIA) target_compile_options( rocprofiler-systems-compile-debuginfo INTERFACE - $<$:$<$:-Xcompiler=-rdynamic>>) + $<$:$<$:-Xcompiler=-rdynamic>> + ) endif() if(dl_LIBRARY) @@ -151,22 +173,29 @@ endif() # non-debug optimizations # rocprofiler_systems_add_interface_library(rocprofiler-systems-compile-extra - "Extra optimization flags") + "Extra optimization flags" +) if(NOT ROCPROFSYS_BUILD_CODECOV AND ROCPROFSYS_BUILD_EXTRA_OPTIMIZATIONS) add_target_flag_if_avail( rocprofiler-systems-compile-extra "-finline-functions" "-funroll-loops" - "-ftree-vectorize" "-ftree-loop-optimize" "-ftree-loop-vectorize") + "-ftree-vectorize" "-ftree-loop-optimize" "-ftree-loop-vectorize" + ) endif() -if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" - AND ROCPROFSYS_BUILD_EXTRA_OPTIMIZATIONS - AND NOT ROCPROFSYS_BUILD_CODECOV) - target_link_libraries(rocprofiler-systems-compile-options - INTERFACE $) +if( + NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" + AND ROCPROFSYS_BUILD_EXTRA_OPTIMIZATIONS + AND NOT ROCPROFSYS_BUILD_CODECOV +) + target_link_libraries( + rocprofiler-systems-compile-options + INTERFACE $ + ) add_flag_if_avail( "-fno-signaling-nans" "-fno-trapping-math" "-fno-signed-zeros" "-ffinite-math-only" "-fno-math-errno" "-fpredictive-commoning" - "-fvariable-expansion-in-unroller") + "-fvariable-expansion-in-unroller" + ) # add_flag_if_avail("-freciprocal-math" "-fno-signed-zeros" "-mfast-fp") endif() @@ -176,7 +205,8 @@ endif() add_cxx_flag_if_avail("-faligned-new") rocprofiler_systems_add_interface_library(rocprofiler-systems-lto - "Adds link-time-optimization flags") + "Adds link-time-optimization flags" +) if(NOT ROCPROFSYS_BUILD_CODECOV) rocprofiler_systems_save_variables(FLTO VARIABLES CMAKE_CXX_FLAGS) @@ -208,7 +238,8 @@ endif() # rocprofiler_systems_add_interface_library( rocprofiler-systems-compile-timing - "Adds compiler flags which report compilation timing metrics") + "Adds compiler flags which report compilation timing metrics" +) if(CMAKE_CXX_COMPILER_IS_CLANG) add_target_flag_if_avail(rocprofiler-systems-compile-timing "-ftime-trace") if(NOT cxx_rocprofiler_systems_compile_timing_ftime_trace) @@ -219,21 +250,27 @@ else() endif() if(ROCPROFSYS_USE_COMPILE_TIMING) - target_link_libraries(rocprofiler-systems-compile-options - INTERFACE rocprofiler-systems-compile-timing) + target_link_libraries( + rocprofiler-systems-compile-options + INTERFACE rocprofiler-systems-compile-timing + ) endif() # ----------------------------------------------------------------------------------------# # fstack-protector # rocprofiler_systems_add_interface_library(rocprofiler-systems-stack-protector - "Adds stack-protector compiler flags") + "Adds stack-protector compiler flags" +) add_target_flag_if_avail(rocprofiler-systems-stack-protector "-fstack-protector-strong" - "-Wstack-protector") + "-Wstack-protector" +) if(ROCPROFSYS_BUILD_STACK_PROTECTOR) - target_link_libraries(rocprofiler-systems-compile-options - INTERFACE rocprofiler-systems-stack-protector) + target_link_libraries( + rocprofiler-systems-compile-options + INTERFACE rocprofiler-systems-stack-protector + ) endif() # ----------------------------------------------------------------------------------------# @@ -243,7 +280,8 @@ if(ROCPROFSYS_BUILD_DEVELOPER) add_target_flag_if_avail( rocprofiler-systems-compile-options "-Werror" "-Wdouble-promotion" "-Wshadow" "-Wextra" "-Wpedantic" "-Wstack-usage=524288" # 512 KB - "/showIncludes") + "/showIncludes" + ) if(ROCPROFSYS_BUILD_NUMBER GREATER 2) add_target_flag_if_avail(rocprofiler-systems-compile-options "-gsplit-dwarf") endif() @@ -251,9 +289,11 @@ endif() if(ROCPROFSYS_BUILD_LINKER) target_link_options( - rocprofiler-systems-compile-options INTERFACE - $<$:-fuse-ld=${ROCPROFSYS_BUILD_LINKER}> - $<$:-fuse-ld=${ROCPROFSYS_BUILD_LINKER}>) + rocprofiler-systems-compile-options + INTERFACE + $<$:-fuse-ld=${ROCPROFSYS_BUILD_LINKER}> + $<$:-fuse-ld=${ROCPROFSYS_BUILD_LINKER}> + ) endif() # ----------------------------------------------------------------------------------------# @@ -262,20 +302,24 @@ endif() if(ROCPROFSYS_BUILD_RELEASE AND NOT ROCPROFSYS_BUILD_DEBUG) add_target_flag_if_avail( rocprofiler-systems-compile-options "-g1" "-feliminate-unused-debug-symbols" - "-gno-column-info" "-gno-variable-location-views" "-gline-tables-only") + "-gno-column-info" "-gno-variable-location-views" "-gline-tables-only" + ) endif() # ----------------------------------------------------------------------------------------# # visibility build flags # rocprofiler_systems_add_interface_library(rocprofiler-systems-default-visibility - "Adds -fvisibility=default compiler flag") + "Adds -fvisibility=default compiler flag" +) rocprofiler_systems_add_interface_library(rocprofiler-systems-hidden-visibility - "Adds -fvisibility=hidden compiler flag") + "Adds -fvisibility=hidden compiler flag" +) add_target_flag_if_avail(rocprofiler-systems-default-visibility "-fvisibility=default") add_target_flag_if_avail(rocprofiler-systems-hidden-visibility "-fvisibility=hidden" - "-fvisibility-inlines-hidden") + "-fvisibility-inlines-hidden" +) # ----------------------------------------------------------------------------------------# # developer build flags @@ -299,30 +343,42 @@ set(ROCPROFSYS_SANITIZER_TYPES unreachable null bounds - alignment) -set_property(CACHE ROCPROFSYS_SANITIZER_TYPE PROPERTY STRINGS - "${ROCPROFSYS_SANITIZER_TYPES}") + alignment +) +set_property( + CACHE ROCPROFSYS_SANITIZER_TYPE + PROPERTY STRINGS "${ROCPROFSYS_SANITIZER_TYPES}" +) rocprofiler_systems_add_interface_library(rocprofiler-systems-sanitizer-compile-options - "Adds compiler flags for sanitizers") + "Adds compiler flags for sanitizers" +) rocprofiler_systems_add_interface_library( rocprofiler-systems-sanitizer "Adds compiler flags to enable ${ROCPROFSYS_SANITIZER_TYPE} sanitizer (-fsanitizer=${ROCPROFSYS_SANITIZER_TYPE})" - ) +) -set(COMMON_SANITIZER_FLAGS "-fno-optimize-sibling-calls" "-fno-omit-frame-pointer" - "-fno-inline-functions") +set(COMMON_SANITIZER_FLAGS + "-fno-optimize-sibling-calls" + "-fno-omit-frame-pointer" + "-fno-inline-functions" +) add_target_flag(rocprofiler-systems-sanitizer-compile-options ${COMMON_SANITIZER_FLAGS}) foreach(_TYPE ${ROCPROFSYS_SANITIZER_TYPES}) set(_FLAG "-fsanitize=${_TYPE}") rocprofiler_systems_add_interface_library( rocprofiler-systems-${_TYPE}-sanitizer - "Adds compiler flags to enable ${_TYPE} sanitizer (${_FLAG})") + "Adds compiler flags to enable ${_TYPE} sanitizer (${_FLAG})" + ) add_target_flag(rocprofiler-systems-${_TYPE}-sanitizer ${_FLAG}) - target_link_libraries(rocprofiler-systems-${_TYPE}-sanitizer - INTERFACE rocprofiler-systems-sanitizer-compile-options) - set_property(TARGET rocprofiler-systems-${_TYPE}-sanitizer - PROPERTY INTERFACE_LINK_OPTIONS ${_FLAG} ${COMMON_SANITIZER_FLAGS}) + target_link_libraries( + rocprofiler-systems-${_TYPE}-sanitizer + INTERFACE rocprofiler-systems-sanitizer-compile-options + ) + set_property( + TARGET rocprofiler-systems-${_TYPE}-sanitizer + PROPERTY INTERFACE_LINK_OPTIONS ${_FLAG} ${COMMON_SANITIZER_FLAGS} + ) endforeach() unset(_FLAG) @@ -331,13 +387,15 @@ unset(COMMON_SANITIZER_FLAGS) if(ROCPROFSYS_USE_SANITIZER) foreach(_TYPE ${ROCPROFSYS_SANITIZER_TYPE}) if(TARGET rocprofiler-systems-${_TYPE}-sanitizer) - target_link_libraries(rocprofiler-systems-sanitizer - INTERFACE rocprofiler-systems-${_TYPE}-sanitizer) + target_link_libraries( + rocprofiler-systems-sanitizer + INTERFACE rocprofiler-systems-${_TYPE}-sanitizer + ) else() message( FATAL_ERROR - "Error! Target 'rocprofiler-systems-${_TYPE}-sanitizer' does not exist!" - ) + "Error! Target 'rocprofiler-systems-${_TYPE}-sanitizer' does not exist!" + ) endif() endforeach() else() @@ -349,28 +407,38 @@ endif() # target_compile_options( rocprofiler-systems-static-libgcc - INTERFACE $<$:$<$:-static-libgcc>> - $<$:$<$:-static-libgcc>>) + INTERFACE + $<$:$<$:-static-libgcc>> + $<$:$<$:-static-libgcc>> +) target_link_options( - rocprofiler-systems-static-libgcc INTERFACE - $<$:$<$:-static-libgcc>> - $<$:$<$:-static-libgcc>>) + rocprofiler-systems-static-libgcc + INTERFACE + $<$:$<$:-static-libgcc>> + $<$:$<$:-static-libgcc>> +) target_compile_options( rocprofiler-systems-static-libstdcxx - INTERFACE $<$:$<$:-static-libstdc++>>) + INTERFACE $<$:$<$:-static-libstdc++>> +) target_link_options( - rocprofiler-systems-static-libstdcxx INTERFACE - $<$:$<$:-static-libstdc++>>) + rocprofiler-systems-static-libstdcxx + INTERFACE $<$:$<$:-static-libstdc++>> +) if(ROCPROFSYS_BUILD_STATIC_LIBGCC) - target_link_libraries(rocprofiler-systems-static-libgcc-optional - INTERFACE rocprofiler-systems-static-libgcc) + target_link_libraries( + rocprofiler-systems-static-libgcc-optional + INTERFACE rocprofiler-systems-static-libgcc + ) endif() if(ROCPROFSYS_BUILD_STATIC_LIBSTDCXX) - target_link_libraries(rocprofiler-systems-static-libstdcxx-optional - INTERFACE rocprofiler-systems-static-libstdcxx) + target_link_libraries( + rocprofiler-systems-static-libstdcxx-optional + INTERFACE rocprofiler-systems-static-libstdcxx + ) endif() # ----------------------------------------------------------------------------------------# diff --git a/projects/rocprofiler-systems/cmake/Compilers.cmake b/projects/rocprofiler-systems/cmake/Compilers.cmake index 9d02fcfa64..2c9d1a7c79 100644 --- a/projects/rocprofiler-systems/cmake/Compilers.cmake +++ b/projects/rocprofiler-systems/cmake/Compilers.cmake @@ -32,7 +32,8 @@ endif() if(NOT TARGET ${LIBNAME}-compile-options) rocprofiler_systems_add_interface_library( ${LIBNAME}-compile-options - "Adds the standard set of compiler flags used by timemory") + "Adds the standard set of compiler flags used by timemory" + ) endif() # ----------------------------------------------------------------------------------------# @@ -41,20 +42,14 @@ endif() macro(to_list _VAR _STR) string(REPLACE " " " " ${_VAR} "${_STR}") string(REPLACE " " ";" ${_VAR} "${_STR}") -endmacro( - to_list - _VAR - _STR) +endmacro(to_list _VAR _STR) # ----------------------------------------------------------------------------------------# # macro converting string to list # ----------------------------------------------------------------------------------------# macro(to_string _VAR _STR) string(REPLACE ";" " " ${_VAR} "${_STR}") -endmacro( - to_string - _VAR - _STR) +endmacro(to_string _VAR _STR) # ----------------------------------------------------------------------------------------# # Macro to add to string @@ -233,8 +228,11 @@ macro(ADD_TARGET_CXX_FLAG _TARG) list(APPEND ${_MAKE_TARG}_CXX_FLAGS ${ARGN}) get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) if(CMAKE_CUDA_COMPILER_IS_NVIDIA) - target_compile_options(${_TARG} ${_SCOPE} - $<$:-Xcompiler=${ARGN}>) + target_compile_options( + ${_TARG} + ${_SCOPE} + $<$:-Xcompiler=${ARGN}> + ) list(APPEND ${_MAKE_TARG}_CUDA_FLAGS -Xcompiler=${ARGN}) elseif(CMAKE_CUDA_COMPILER_IS_CLANG) target_compile_options(${_TARG} ${_SCOPE} $<$:${ARGN}>) @@ -380,8 +378,11 @@ function(ROCPROFILER_SYSTEMS_TARGET_FLAG _TARG_TARGET) foreach(_FLAG ${_TARG_FLAGS}) foreach(_LANG ${_TARG_LANGUAGES}) if(NOT _TARG_IF_AVAIL) - target_compile_options(${_TARG_TARGET} ${_TARG_MODE} - $<$:${_FLAG}>) + target_compile_options( + ${_TARG_TARGET} + ${_TARG_MODE} + $<$:${_FLAG}> + ) continue() endif() @@ -400,8 +401,11 @@ function(ROCPROFILER_SYSTEMS_TARGET_FLAG _TARG_TARGET) endif() rocprofiler_systems_end_flag_check() if(${FLAG_NAME}) - target_compile_options(${_TARG_TARGET} ${_TARG_MODE} - $<$:${_FLAG}>) + target_compile_options( + ${_TARG_TARGET} + ${_TARG_MODE} + $<$:${_FLAG}> + ) endif() elseif("${_LANG}" STREQUAL "CXX") string(REGEX REPLACE "^/" "cxx${_LTARG}_" FLAG_NAME "${_FLAG}") @@ -418,15 +422,23 @@ function(ROCPROFILER_SYSTEMS_TARGET_FLAG _TARG_TARGET) endif() rocprofiler_systems_end_flag_check() if(${FLAG_NAME}) - target_compile_options(${_TARG_TARGET} ${_TARG_MODE} - $<$:${_FLAG}>) + target_compile_options( + ${_TARG_TARGET} + ${_TARG_MODE} + $<$:${_FLAG}> + ) if(CMAKE_CUDA_COMPILER_IS_NVIDIA) target_compile_options( - ${_TARG_TARGET} ${_TARG_MODE} - $<$:-Xcompiler=${_FLAG}>) + ${_TARG_TARGET} + ${_TARG_MODE} + $<$:-Xcompiler=${_FLAG}> + ) elseif(CMAKE_CUDA_COMPILER_IS_CLANG) - target_compile_options(${_TARG_TARGET} ${_TARG_MODE} - $<$:${_FLAG}>) + target_compile_options( + ${_TARG_TARGET} + ${_TARG_MODE} + $<$:${_FLAG}> + ) endif() endif() endif() @@ -449,22 +461,31 @@ endmacro() # add to any language # ----------------------------------------------------------------------------------------# function(ADD_USER_FLAGS _TARGET _LANGUAGE) - - set(_FLAGS ${${_LANGUAGE}FLAGS} $ENV{${_LANGUAGE}FLAGS} ${${_LANGUAGE}_FLAGS} - $ENV{${_LANGUAGE}_FLAGS}) + set(_FLAGS + ${${_LANGUAGE}FLAGS} + $ENV{${_LANGUAGE}FLAGS} + ${${_LANGUAGE}_FLAGS} + $ENV{${_LANGUAGE}_FLAGS} + ) string(REPLACE " " ";" _FLAGS "${_FLAGS}") set(${PROJECT_NAME}_${_LANGUAGE}_FLAGS - ${${PROJECT_NAME}_${_LANGUAGE}_FLAGS} ${_FLAGS} - PARENT_SCOPE) + ${${PROJECT_NAME}_${_LANGUAGE}_FLAGS} + ${_FLAGS} + PARENT_SCOPE + ) set(${PROJECT_NAME}_${_LANGUAGE}_COMPILE_OPTIONS - ${${PROJECT_NAME}_${_LANGUAGE}_COMPILE_OPTIONS} ${_FLAGS} - PARENT_SCOPE) + ${${PROJECT_NAME}_${_LANGUAGE}_COMPILE_OPTIONS} + ${_FLAGS} + PARENT_SCOPE + ) - target_compile_options(${_TARGET} - INTERFACE $<$:${_FLAGS}>) + target_compile_options( + ${_TARGET} + INTERFACE $<$:${_FLAGS}> + ) endfunction() # ----------------------------------------------------------------------------------------# @@ -477,11 +498,17 @@ function(ROCPROFILER_SYSTEMS_TARGET_COMPILE_DEFINITIONS _TARG _VIS) endif() target_compile_definitions(${_TARG} ${_VIS} $<$:${_DEF}>) if(CMAKE_CUDA_COMPILER_IS_NVIDIA) - target_compile_definitions(${_TARG} ${_VIS} - $<$:${_DEF}>) + target_compile_definitions( + ${_TARG} + ${_VIS} + $<$:${_DEF}> + ) elseif(CMAKE_CUDA_COMPILER_IS_CLANG) - target_compile_definitions(${_TARG} ${_VIS} - $<$:${_DEF}>) + target_compile_definitions( + ${_TARG} + ${_VIS} + $<$:${_DEF}> + ) endif() endforeach() endfunction() @@ -491,7 +518,6 @@ endfunction() # ----------------------------------------------------------------------------------------# get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) foreach(LANG C CXX CUDA) - if(NOT DEFINED CMAKE_${LANG}_COMPILER) set(CMAKE_${LANG}_COMPILER "") endif() @@ -503,36 +529,32 @@ foreach(LANG C CXX CUDA) function(SET_COMPILER_VAR VAR _BOOL) set(CMAKE_${LANG}_COMPILER_IS_${VAR} ${_BOOL} - CACHE INTERNAL "CMake ${LANG} compiler identification (${VAR})" FORCE) + CACHE INTERNAL + "CMake ${LANG} compiler identification (${VAR})" + FORCE + ) mark_as_advanced(CMAKE_${LANG}_COMPILER_IS_${VAR}) endfunction() - if(("${LANG}" STREQUAL "C" AND CMAKE_COMPILER_IS_GNUCC) - OR ("${LANG}" STREQUAL "CXX" AND CMAKE_COMPILER_IS_GNUCXX)) - + if( + ("${LANG}" STREQUAL "C" AND CMAKE_COMPILER_IS_GNUCC) + OR ("${LANG}" STREQUAL "CXX" AND CMAKE_COMPILER_IS_GNUCXX) + ) # GNU compiler set_compiler_var(GNU 1) - elseif(CMAKE_${LANG}_COMPILER MATCHES "icc.*") - # Intel icc compiler set_compiler_var(INTEL 1) set_compiler_var(INTEL_ICC 1) - elseif(CMAKE_${LANG}_COMPILER MATCHES "icpc.*") - # Intel icpc compiler set_compiler_var(INTEL 1) set_compiler_var(INTEL_ICPC 1) - elseif(CMAKE_${LANG}_COMPILER_ID MATCHES "AppleClang") - # Clang/LLVM compiler set_compiler_var(CLANG 1) set_compiler_var(APPLE_CLANG 1) - elseif(CMAKE_${LANG}_COMPILER_ID MATCHES "Clang") - # Clang/LLVM compiler set_compiler_var(CLANG 1) @@ -540,32 +562,23 @@ foreach(LANG C CXX CUDA) if(CMAKE_${LANG}_COMPILER MATCHES "hipcc") set_compiler_var(HIPCC 1) endif() - elseif(CMAKE_${LANG}_COMPILER_ID MATCHES "PGI") - # PGI compiler set_compiler_var(PGI 1) - elseif(CMAKE_${LANG}_COMPILER MATCHES "xlC" AND UNIX) - # IBM xlC compiler set_compiler_var(XLC 1) - elseif(CMAKE_${LANG}_COMPILER MATCHES "aCC" AND UNIX) - # HP aC++ compiler set_compiler_var(HP_ACC 1) - elseif( CMAKE_${LANG}_COMPILER MATCHES "CC" AND CMAKE_SYSTEM_NAME MATCHES "IRIX" - AND UNIX) - + AND UNIX + ) # IRIX MIPSpro CC Compiler set_compiler_var(MIPS 1) - elseif(CMAKE_${LANG}_COMPILER_ID MATCHES "Intel") - set_compiler_var(INTEL 1) set(CTYPE ICC) @@ -574,17 +587,12 @@ foreach(LANG C CXX CUDA) endif() set_compiler_var(INTEL_${CTYPE} 1) - elseif(CMAKE_${LANG}_COMPILER MATCHES "MSVC") - # Windows Visual Studio compiler set_compiler_var(MSVC 1) - elseif(CMAKE_${LANG}_COMPILER_ID MATCHES "NVIDIA") - # NVCC set_compiler_var(NVIDIA 1) - endif() # set other to no @@ -602,10 +610,10 @@ foreach(LANG C CXX CUDA) MIPS MSVC NVIDIA - HIPCC) + HIPCC + ) if(NOT DEFINED CMAKE_${LANG}_COMPILER_IS_${TYPE}) set_compiler_var(${TYPE} 0) endif() endforeach() - endforeach() diff --git a/projects/rocprofiler-systems/cmake/ConfigCPack.cmake b/projects/rocprofiler-systems/cmake/ConfigCPack.cmake index 6716a55af9..35e68e5fed 100644 --- a/projects/rocprofiler-systems/cmake/ConfigCPack.cmake +++ b/projects/rocprofiler-systems/cmake/ConfigCPack.cmake @@ -4,26 +4,33 @@ function(rocprofiler_systems_parse_release) if(EXISTS /etc/lsb-release AND NOT IS_DIRECTORY /etc/lsb-release) file(READ /etc/lsb-release _LSB_RELEASE) if(_LSB_RELEASE) - string(REGEX - REPLACE "DISTRIB_ID=(.*)\nDISTRIB_RELEASE=(.*)\nDISTRIB_CODENAME=.*" - "\\1-\\2" _SYSTEM_NAME "${_LSB_RELEASE}") + string( + REGEX REPLACE + "DISTRIB_ID=(.*)\nDISTRIB_RELEASE=(.*)\nDISTRIB_CODENAME=.*" + "\\1-\\2" + _SYSTEM_NAME + "${_LSB_RELEASE}" + ) endif() elseif(EXISTS /etc/os-release AND NOT IS_DIRECTORY /etc/os-release) file(READ /etc/os-release _OS_RELEASE) if(_OS_RELEASE) string(REPLACE "\"" "" _OS_RELEASE "${_OS_RELEASE}") string(REPLACE "-" " " _OS_RELEASE "${_OS_RELEASE}") - string(REGEX REPLACE "NAME=.*\nVERSION=([0-9\.]+).*\nID=([a-z]+).*" "\\2-\\1" - _SYSTEM_NAME "${_OS_RELEASE}") + string( + REGEX REPLACE + "NAME=.*\nVERSION=([0-9\.]+).*\nID=([a-z]+).*" + "\\2-\\1" + _SYSTEM_NAME + "${_OS_RELEASE}" + ) endif() endif() string(TOLOWER "${_SYSTEM_NAME}" _SYSTEM_NAME) if(NOT _SYSTEM_NAME) set(_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}") endif() - set(_SYSTEM_NAME - "${_SYSTEM_NAME}" - PARENT_SCOPE) + set(_SYSTEM_NAME "${_SYSTEM_NAME}" PARENT_SCOPE) endfunction() # parse either /etc/lsb-release or /etc/os-release @@ -37,7 +44,8 @@ endif() set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) set(CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc.") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY - "Runtime instrumentation and binary rewriting for Perfetto via Dyninst") + "Runtime instrumentation and binary rewriting for Perfetto via Dyninst" +) set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}") set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") @@ -51,12 +59,15 @@ set(OMNITRACE_PACKAGE_NAME "omnitrace") set(ROCPROFSYS_CPACK_SYSTEM_NAME "${_SYSTEM_NAME}" - CACHE STRING "System name, e.g. Linux or Ubuntu-20.04") + CACHE STRING + "System name, e.g. Linux or Ubuntu-20.04" +) set(ROCPROFSYS_CPACK_PACKAGE_SUFFIX "") if(ROCPROFSYS_USE_ROCM) set(ROCPROFSYS_CPACK_PACKAGE_SUFFIX - "${ROCPROFSYS_CPACK_PACKAGE_SUFFIX}-ROCm-${ROCmVersion_NUMERIC_VERSION}") + "${ROCPROFSYS_CPACK_PACKAGE_SUFFIX}-ROCm-${ROCmVersion_NUMERIC_VERSION}" + ) endif() if(ROCPROFSYS_USE_PAPI) @@ -76,17 +87,18 @@ if(ROCPROFSYS_USE_MPI) else() message( WARNING - "MPI implementation could not be determined. Please set ROCPROFSYS_MPI_IMPL to one of the following for CPack: ${VALID_MPI_IMPLS}" - ) + "MPI implementation could not be determined. Please set ROCPROFSYS_MPI_IMPL to one of the following for CPack: ${VALID_MPI_IMPLS}" + ) endif() if(ROCPROFSYS_MPI_IMPL AND NOT "${ROCPROFSYS_MPI_IMPL}" IN_LIST VALID_MPI_IMPLS) message( SEND_ERROR - "Invalid ROCPROFSYS_MPI_IMPL (${ROCPROFSYS_MPI_IMPL}). Should be one of: ${VALID_MPI_IMPLS}" - ) + "Invalid ROCPROFSYS_MPI_IMPL (${ROCPROFSYS_MPI_IMPL}). Should be one of: ${VALID_MPI_IMPLS}" + ) else() rocprofiler_systems_add_feature(ROCPROFSYS_MPI_IMPL - "MPI implementation for CPack DEBIAN depends") + "MPI implementation for CPack DEBIAN depends" + ) endif() if("${ROCPROFSYS_MPI_IMPL}" STREQUAL "openmpi") @@ -97,7 +109,8 @@ if(ROCPROFSYS_USE_MPI) set(ROCPROFSYS_MPI_IMPL_UPPER "MPI") endif() set(ROCPROFSYS_CPACK_PACKAGE_SUFFIX - "${ROCPROFSYS_CPACK_PACKAGE_SUFFIX}-${ROCPROFSYS_MPI_IMPL_UPPER}") + "${ROCPROFSYS_CPACK_PACKAGE_SUFFIX}-${ROCPROFSYS_MPI_IMPL_UPPER}" + ) endif() if(ROCPROFSYS_USE_PYTHON) @@ -112,14 +125,14 @@ endif() set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${ROCPROFSYS_VERSION}-${ROCPROFSYS_CPACK_SYSTEM_NAME}${ROCPROFSYS_CPACK_PACKAGE_SUFFIX}" - ) +) if(DEFINED ENV{CPACK_PACKAGE_FILE_NAME}) set(CPACK_PACKAGE_FILE_NAME $ENV{CPACK_PACKAGE_FILE_NAME}) endif() set(ROCPROFSYS_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${ROCPROFSYS_VERSION}-${ROCPROFSYS_CPACK_SYSTEM_NAME}${ROCPROFSYS_CPACK_PACKAGE_SUFFIX} - ) +) rocprofiler_systems_add_feature(ROCPROFSYS_PACKAGE_FILE_NAME "CPack filename") if(ROCM_DEP_ROCMCORE OR ROCPROFILER_DEP_ROCMCORE) @@ -138,9 +151,15 @@ endif() set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/ROCm/rocprofiler-systems") set(CPACK_DEBIAN_PACKAGE_RELEASE - "${ROCPROFSYS_CPACK_SYSTEM_NAME}${ROCPROFSYS_CPACK_PACKAGE_SUFFIX}") -string(REGEX REPLACE "([a-zA-Z])-([0-9])" "\\1\\2" CPACK_DEBIAN_PACKAGE_RELEASE - "${CPACK_DEBIAN_PACKAGE_RELEASE}") + "${ROCPROFSYS_CPACK_SYSTEM_NAME}${ROCPROFSYS_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(ROCPROFSYS_USE_PAPI AND NOT ROCPROFSYS_BUILD_PAPI) @@ -148,9 +167,20 @@ if(ROCPROFSYS_USE_PAPI AND NOT ROCPROFSYS_BUILD_PAPI) endif() if(NOT ROCPROFSYS_BUILD_DYNINST) if(NOT ROCPROFSYS_BUILD_BOOST) - foreach(_BOOST_COMPONENT atomic system thread date-time filesystem timer) - list(APPEND _DEBIAN_PACKAGE_DEPENDS - "libboost-${_BOOST_COMPONENT}-dev (>= 1.67.0)") + foreach( + _BOOST_COMPONENT + atomic + system + thread + date-time + filesystem + timer + ) + list( + APPEND + _DEBIAN_PACKAGE_DEPENDS + "libboost-${_BOOST_COMPONENT}-dev (>= 1.67.0)" + ) endforeach() endif() if(NOT ROCPROFSYS_BUILD_TBB) @@ -162,7 +192,8 @@ if(NOT ROCPROFSYS_BUILD_DYNINST) endif() if(ROCmVersion_FOUND) set(_AMD_SMI_SUFFIX - " (>= ${ROCmVersion_MAJOR_VERSION}.0.0.${ROCmVersion_NUMERIC_VERSION})") + " (>= ${ROCmVersion_MAJOR_VERSION}.0.0.${ROCmVersion_NUMERIC_VERSION})" + ) endif() if(ROCPROFSYS_USE_ROCM) list(APPEND _DEBIAN_PACKAGE_DEPENDS "amd-smi-lib${_AMD_SMI_SUFFIX}") @@ -182,7 +213,10 @@ endif() string(REPLACE ";" ", " _DEBIAN_PACKAGE_DEPENDS "${_DEBIAN_PACKAGE_DEPENDS}") set(CPACK_DEBIAN_PACKAGE_DEPENDS "${_DEBIAN_PACKAGE_DEPENDS}" - CACHE STRING "Debian package dependencies" FORCE) + CACHE STRING + "Debian package dependencies" + FORCE +) set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) @@ -203,9 +237,15 @@ if(DEFINED CPACK_PACKAGING_INSTALL_PREFIX) endif() set(CPACK_RPM_PACKAGE_RELEASE - "${ROCPROFSYS_CPACK_SYSTEM_NAME}${ROCPROFSYS_CPACK_PACKAGE_SUFFIX}") -string(REGEX REPLACE "([a-zA-Z])-([0-9])" "\\1\\2" CPACK_RPM_PACKAGE_RELEASE - "${CPACK_RPM_PACKAGE_RELEASE}") + "${ROCPROFSYS_CPACK_SYSTEM_NAME}${ROCPROFSYS_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}") # Handle the project rebranding from "omnitrace" to "rocprofiler-systems" @@ -223,7 +263,10 @@ endif() string(REPLACE ";" ", " CPACK_RPM_PACKAGE_PROVIDES "${_RPM_PACKAGE_PROVIDES}") set(CPACK_RPM_PACKAGE_PROVIDES "${CPACK_RPM_PACKAGE_PROVIDES}" - CACHE STRING "RPM package provides" FORCE) + CACHE STRING + "RPM package provides" + FORCE +) if(ROCPROFSYS_USE_MPI) if("${ROCPROFSYS_MPI_IMPL}" STREQUAL "openmpi") @@ -243,7 +286,10 @@ endif() string(REPLACE ";" ", " _RPM_PACKAGE_REQUIRES "${_RPM_PACKAGE_REQUIRES}") set(CPACK_RPM_PACKAGE_REQUIRES ${_RPM_PACKAGE_REQUIRES} - CACHE STRING "RPM package requires" FORCE) + CACHE STRING + "RPM package requires" + FORCE +) set(CPACK_RPM_SPEC_MORE_DEFINE "%undefine __brp_mangle_shebangs") set(CPACK_RPM_PACKAGE_LICENSE "MIT") set(CPACK_RPM_FILE_NAME "RPM-DEFAULT") @@ -259,7 +305,7 @@ set(CPACK_RPM_PACKAGE_AUTOREQ ON) set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}" - ) +) if(DEFINED ENV{ROCM_LIBPATCH_VERSION}) set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}.$ENV{ROCM_LIBPATCH_VERSION}") @@ -276,20 +322,25 @@ endif() rocprofiler_systems_add_feature(CPACK_PACKAGE_NAME "Package name") rocprofiler_systems_add_feature(CPACK_PACKAGE_VERSION "Package version") rocprofiler_systems_add_feature(CPACK_PACKAGING_INSTALL_PREFIX - "Package installation prefix") + "Package installation prefix" +) rocprofiler_systems_add_feature(CPACK_DEBIAN_FILE_NAME "Debian file name") rocprofiler_systems_add_feature(CPACK_DEBIAN_PACKAGE_RELEASE - "Debian package release version") + "Debian package release version" +) rocprofiler_systems_add_feature(CPACK_DEBIAN_PACKAGE_DEPENDS - "Debian package dependencies") + "Debian package dependencies" +) rocprofiler_systems_add_feature(CPACK_DEBIAN_PACKAGE_SHLIBDEPS - "Debian package shared library dependencies") + "Debian package shared library dependencies" +) rocprofiler_systems_add_feature(CPACK_RPM_FILE_NAME "RPM file name") rocprofiler_systems_add_feature(CPACK_RPM_PACKAGE_RELEASE "RPM package release version") rocprofiler_systems_add_feature(CPACK_RPM_PACKAGE_AUTOREQPROV - "RPM package auto generate requires and provides") + "RPM package auto generate requires and provides" +) rocprofiler_systems_add_feature(CPACK_RPM_PACKAGE_REQUIRES "RPM package requires") rocprofiler_systems_add_feature(CPACK_RPM_PACKAGE_PROVIDES "RPM package provides") diff --git a/projects/rocprofiler-systems/cmake/ConfigInstall.cmake b/projects/rocprofiler-systems/cmake/ConfigInstall.cmake index 5cd3e920ca..6274191fda 100644 --- a/projects/rocprofiler-systems/cmake/ConfigInstall.cmake +++ b/projects/rocprofiler-systems/cmake/ConfigInstall.cmake @@ -9,7 +9,8 @@ install( EXPORT rocprofiler-systems-library-targets FILE ${PROJECT_NAME}-library-targets.cmake NAMESPACE rocprofiler-systems:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} +) # ------------------------------------------------------------------------------# # install tree @@ -24,19 +25,22 @@ configure_package_config_file( ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config.cmake INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} - PATH_VARS PROJECT_INSTALL_DIR INCLUDE_INSTALL_DIR LIB_INSTALL_DIR) + PATH_VARS PROJECT_INSTALL_DIR INCLUDE_INSTALL_DIR LIB_INSTALL_DIR +) write_basic_package_version_file( ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-version.cmake VERSION ${PROJECT_VERSION} - COMPATIBILITY SameMinorVersion) + COMPATIBILITY SameMinorVersion +) install( FILES ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config.cmake ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-version.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} - OPTIONAL) + OPTIONAL +) export(PACKAGE ${PROJECT_NAME}) @@ -45,16 +49,21 @@ export(PACKAGE ${PROJECT_NAME}) # configure_file( ${PROJECT_SOURCE_DIR}/tests/validate-causal-json.py - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/rocprof-sys-causal-print COPYONLY) + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/rocprof-sys-causal-print + COPYONLY +) -install(PROGRAMS ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/rocprof-sys-causal-print - DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/${PROJECT_NAME}) +install( + PROGRAMS ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/rocprof-sys-causal-print + DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/${PROJECT_NAME} +) # ------------------------------------------------------------------------------# # build tree # set(_BUILDTREE_EXPORT_DIR - "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") + "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" +) if(NOT EXISTS "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}") file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}") @@ -71,8 +80,7 @@ endif() export( EXPORT ${PROJECT_NAME}-library-targets NAMESPACE rocprofiler-systems:: - FILE "${_BUILDTREE_EXPORT_DIR}/${PROJECT_NAME}-library-targets.cmake") + FILE "${_BUILDTREE_EXPORT_DIR}/${PROJECT_NAME}-library-targets.cmake" +) -set(${PROJECT_NAME}_DIR - "${_BUILDTREE_EXPORT_DIR}" - CACHE PATH "${PROJECT_NAME}" FORCE) +set(${PROJECT_NAME}_DIR "${_BUILDTREE_EXPORT_DIR}" CACHE PATH "${PROJECT_NAME}" FORCE) diff --git a/projects/rocprofiler-systems/cmake/DyninstBoost.cmake b/projects/rocprofiler-systems/cmake/DyninstBoost.cmake index a782b6aa78..fd3b4d2355 100644 --- a/projects/rocprofiler-systems/cmake/DyninstBoost.cmake +++ b/projects/rocprofiler-systems/cmake/DyninstBoost.cmake @@ -56,31 +56,29 @@ endif() set(_boost_min_version 1.67.0) # Provide a default, if the user didn't specify -set(Boost_MIN_VERSION - ${_boost_min_version} - CACHE STRING "Minimum Boost version") +set(Boost_MIN_VERSION ${_boost_min_version} CACHE STRING "Minimum Boost version") # Enforce minimum version if(${Boost_MIN_VERSION} VERSION_LESS ${_boost_min_version}) rocprofiler_systems_message( FATAL_ERROR "Requested Boost-${Boost_MIN_VERSION} is less than minimum supported version (${_boost_min_version})" - ) + ) endif() # -------------- RUNTIME CONFIGURATION ---------------------------------------- # Use the multithreaded version of Boost NB: This _must_ be a cache variable as it # controls the tagged layout of Boost library names -set(Boost_USE_MULTITHREADED - ON - CACHE BOOL "Enable multithreaded Boost libraries") +set(Boost_USE_MULTITHREADED ON CACHE BOOL "Enable multithreaded Boost libraries") # Don't use libraries linked statically to the C++ runtime NB: This _must_ be a cache # variable as it controls the tagged layout of Boost library names set(Boost_USE_STATIC_RUNTIME OFF - CACHE BOOL "Enable usage of libraries statically linked to C++ runtime") + CACHE BOOL + "Enable usage of libraries statically linked to C++ runtime" +) # If using multithreaded Boost, make sure Threads has been intialized if(Boost_USE_MULTITHREADED AND NOT DEFINED CMAKE_THREAD_LIBS_INIT) @@ -88,22 +86,23 @@ if(Boost_USE_MULTITHREADED AND NOT DEFINED CMAKE_THREAD_LIBS_INIT) endif() # Enable debug output from FindBoost -set(Boost_DEBUG - OFF - CACHE BOOL "Enable debug output from FindBoost") +set(Boost_DEBUG OFF CACHE BOOL "Enable debug output from FindBoost") # -------------- PATHS -------------------------------------------------------- # By default, search system paths set(Boost_NO_SYSTEM_PATHS OFF - CACHE BOOL "Disable searching in locations not specified by hint variables") + CACHE BOOL + "Disable searching in locations not specified by hint variables" +) # A sanity check This must be done _before_ the cache variables are set if(PATH_BOOST AND Boost_ROOT_DIR) rocprofiler_systems_message( FATAL_ERROR - "PATH_BOOST AND Boost_ROOT_DIR both specified. Please provide only one") + "PATH_BOOST AND Boost_ROOT_DIR both specified. Please provide only one" + ) endif() # Provide a default root directory @@ -112,9 +111,7 @@ if(NOT PATH_BOOST AND NOT Boost_ROOT_DIR) endif() # Set the default location to look for Boost -set(Boost_ROOT_DIR - ${PATH_BOOST} - CACHE PATH "Base directory the of Boost installation") +set(Boost_ROOT_DIR ${PATH_BOOST} CACHE PATH "Base directory the of Boost installation") # In FindBoost, Boost_ROOT_DIR is spelled BOOST_ROOT set(BOOST_ROOT ${Boost_ROOT_DIR}) @@ -135,9 +132,7 @@ if(MSVC) list(APPEND _boost_defines BOOST_NO_CXX11_VARIADIC_TEMPLATES) endif() -set(Boost_DEFINES - ${_boost_defines} - CACHE STRING "Boost compiler defines") +set(Boost_DEFINES ${_boost_defines} CACHE STRING "Boost compiler defines") add_compile_definitions(${Boost_DEFINES}) # -------------- INTERNALS ---------------------------------------------------- @@ -148,7 +143,15 @@ set(Boost_NO_BOOST_CMAKE ON) # The required Boost library components NB: These are just the ones that require # compilation/linking This should _not_ be a cache variable -set(_boost_components atomic chrono date_time filesystem system thread timer) +set(_boost_components + atomic + chrono + date_time + filesystem + system + thread + timer +) if(NOT BUILD_BOOST) find_package(Boost ${Boost_MIN_VERSION} QUIET COMPONENTS ${_boost_components}) @@ -161,28 +164,35 @@ if(Boost_FOUND AND NOT BUILD_BOOST) # However, we need them in the Testsuite set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} - CACHE PATH "Boost include directory" FORCE) + CACHE PATH + "Boost include directory" + FORCE + ) set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} - CACHE PATH "Boost library directory" FORCE) - set(Boost_INCLUDE_DIR - ${Boost_INCLUDE_DIR} - CACHE PATH "Boost include directory" FORCE) + CACHE PATH + "Boost library directory" + FORCE + ) + set(Boost_INCLUDE_DIR ${Boost_INCLUDE_DIR} CACHE PATH "Boost include directory" FORCE) elseif(NOT Boost_FOUND AND STERILE_BUILD) rocprofiler_systems_message( - FATAL_ERROR "Boost not found and cannot be downloaded because build is sterile.") + FATAL_ERROR "Boost not found and cannot be downloaded because build is sterile." + ) elseif(NOT BUILD_BOOST) rocprofiler_systems_message( FATAL_ERROR "Boost was not found. Either configure cmake to find Boost properly or set BUILD_BOOST=ON to download and build" - ) + ) else() rocprofiler_systems_add_option(BOOST_LINK_STATIC "Link to boost libraries statically" - ON) + ON + ) # If we didn't find a suitable version on the system, then download one from the web rocprofiler_systems_add_cache_option( ROCPROFSYS_BOOST_DOWNLOAD_VERSION "Version of boost to download and install" - STRING "1.79.0") + STRING "1.79.0" + ) # If the user specifies a version other than ROCPROFSYS_BOOST_DOWNLOAD_VERSION, use # that version. @@ -190,13 +200,13 @@ else() rocprofiler_systems_message( FATAL_ERROR "Boost download version is set to ${ROCPROFSYS_BOOST_DOWNLOAD_VERSION} but Boost minimum version is set to ${Boost_MIN_VERSION}" - ) + ) endif() rocprofiler_systems_message( STATUS "Attempting to build BOOST(${ROCPROFSYS_BOOST_DOWNLOAD_VERSION}) as external project" - ) + ) if(Boost_USE_MULTITHREADED) set(_boost_threading multi) @@ -213,18 +223,30 @@ else() # Change the base directory set(Boost_ROOT_DIR ${TPL_STAGING_PREFIX}/boost - CACHE PATH "Base directory the of Boost installation" FORCE) + CACHE PATH + "Base directory the of Boost installation" + FORCE + ) # Update the exported variables set(Boost_INCLUDE_DIRS "$;$" - CACHE PATH "Boost include directory" FORCE) + CACHE PATH + "Boost include directory" + FORCE + ) set(Boost_LIBRARY_DIRS "$;$" - CACHE PATH "Boost library directory" FORCE) + CACHE PATH + "Boost library directory" + FORCE + ) set(Boost_INCLUDE_DIR ${Boost_INCLUDE_DIRS} - CACHE PATH "Boost include directory" FORCE) + CACHE PATH + "Boost include directory" + FORCE + ) file(MAKE_DIRECTORY ${Boost_ROOT_DIR}/include) file(MAKE_DIRECTORY ${Boost_ROOT_DIR}/lib) @@ -235,8 +257,11 @@ else() set(_BOOST_LINK shared) endif() - set(BOOST_ARGS link=${_BOOST_LINK} runtime-link=${_boost_runtime_link} - threading=${_boost_threading}) + set(BOOST_ARGS + link=${_BOOST_LINK} + runtime-link=${_boost_runtime_link} + threading=${_boost_threading} + ) if(WIN32) # NB: We need to build both debug/release on windows as we don't use # CMAKE_BUILD_TYPE @@ -283,23 +308,34 @@ else() set(Boost_LIBRARIES "") foreach(c ${_boost_components}) list(APPEND Boost_LIBRARIES "optimized libboost_${c} debug libboost_${c}-gd ") - list(APPEND _boost_build_byproducts - "{Boost_ROOT_DIR}/lib/libboost_${c}${_LIB_SUFFIX}") + list( + APPEND + _boost_build_byproducts + "{Boost_ROOT_DIR}/lib/libboost_${c}${_LIB_SUFFIX}" + ) set(Boost_${c}_LIBRARY $ - $) + $ + ) set(Boost_${c}_LIBRARY_DEBUG $ - $) + $ + ) # Also export cache variables for the file location of each library string(TOUPPER ${c} _basename) set(Boost_${_basename}_LIBRARY_RELEASE "${Boost_${c}_LIBRARY}" - CACHE FILEPATH "" FORCE) + CACHE FILEPATH + "" + FORCE + ) set(Boost_${_basename}_LIBRARY_DEBUG "${Boost_${c}_LIBRARY_DEBUG}" - CACHE FILEPATH "" FORCE) + CACHE FILEPATH + "" + FORCE + ) endforeach() else() # Transform the component names into the library filenames e.g., system -> @@ -309,42 +345,55 @@ else() set(Boost_${c}_LIBRARY $ $/${INSTALL_LIB_DIR}/${TPL_INSTALL_LIB_DIR}/libboost_${c}${_LIB_SUFFIX}> - ) - list(APPEND _boost_build_byproducts - "${Boost_ROOT_DIR}/lib/libboost_${c}${_LIB_SUFFIX}") + ) + list( + APPEND + _boost_build_byproducts + "${Boost_ROOT_DIR}/lib/libboost_${c}${_LIB_SUFFIX}" + ) list(APPEND Boost_LIBRARIES "${Boost_${c}_LIBRARY}") # Also export cache variables for the file location of each library string(TOUPPER ${c} _basename) set(Boost_${_basename}_LIBRARY_RELEASE "${Boost_${c}_LIBRARY}" - CACHE FILEPATH "" FORCE) + CACHE FILEPATH + "" + FORCE + ) set(Boost_${_basename}_LIBRARY_DEBUG "${Boost_${c}_LIBRARY}" - CACHE FILEPATH "" FORCE) + CACHE FILEPATH + "" + FORCE + ) endforeach() endif() include(ExternalProject) - externalproject_add( + ExternalProject_Add( rocprofiler-systems-boost-build PREFIX ${Boost_ROOT_DIR} GIT_REPOSITORY https://github.com/boostorg/boost.git GIT_TAG boost-${ROCPROFSYS_BOOST_DOWNLOAD_VERSION} BUILD_IN_SOURCE 1 - CONFIGURE_COMMAND ${BOOST_BOOTSTRAP} --prefix=${Boost_ROOT_DIR} - --with-libraries=${_boost_lib_names} - BUILD_COMMAND ${BOOST_BUILD} --ignore-site-config --prefix=${Boost_ROOT_DIR} -j2 - ${BOOST_ARGS} -d0 install + CONFIGURE_COMMAND + ${BOOST_BOOTSTRAP} --prefix=${Boost_ROOT_DIR} + --with-libraries=${_boost_lib_names} + BUILD_COMMAND + ${BOOST_BUILD} --ignore-site-config --prefix=${Boost_ROOT_DIR} -j2 + ${BOOST_ARGS} -d0 install BUILD_BYPRODUCTS ${_boost_build_byproducts} - INSTALL_COMMAND "") + INSTALL_COMMAND "" + ) # target for re-executing the installation add_custom_target( rocprofiler-systems-boost-install COMMAND ${BOOST_BUILD} ${BOOST_ARGS} -d0 install WORKING_DIRECTORY ${Boost_ROOT_DIR}/src/Boost-External - COMMENT "Installing Boost...") + COMMENT "Installing Boost..." + ) endif() # -------------- EXPORT VARIABLES --------------------------------------------- @@ -356,7 +405,9 @@ if(Boost_USE_MULTITHREADED AND ${_building_threads}) # the debug/release filenames are the same set(Boost_THREAD_LIBRARY ${Boost_THREAD_LIBRARY_DEBUG} - CACHE FILEPATH "Boost thread library") + CACHE FILEPATH + "Boost thread library" + ) endif() # Add the system thread library @@ -365,12 +416,13 @@ if(Boost_USE_MULTITHREADED) endif() # Export the complete set of libraries -set(Boost_LIBRARIES - ${Boost_LIBRARIES} - CACHE FILEPATH "Boost library files" FORCE) +set(Boost_LIBRARIES ${Boost_LIBRARIES} CACHE FILEPATH "Boost library files" FORCE) -target_include_directories(rocprofiler-systems-boost SYSTEM - INTERFACE ${Boost_INCLUDE_DIRS}) +target_include_directories( + rocprofiler-systems-boost + SYSTEM + INTERFACE ${Boost_INCLUDE_DIRS} +) target_compile_definitions(rocprofiler-systems-boost INTERFACE ${Boost_DEFINITIONS}) target_link_directories(rocprofiler-systems-boost INTERFACE ${Boost_LIBRARY_DIRS}) target_link_libraries(rocprofiler-systems-boost INTERFACE ${Boost_LIBRARIES}) diff --git a/projects/rocprofiler-systems/cmake/DyninstElfUtils.cmake b/projects/rocprofiler-systems/cmake/DyninstElfUtils.cmake index 5baa8f3b09..1ed36cb7f9 100644 --- a/projects/rocprofiler-systems/cmake/DyninstElfUtils.cmake +++ b/projects/rocprofiler-systems/cmake/DyninstElfUtils.cmake @@ -32,9 +32,7 @@ if(NOT BUILD_ELFUTILS) find_package(Elfutils) endif() -if(LibElf_FOUND - AND LibDwarf_FOUND - AND NOT ENABLE_DEBUGINFOD) +if(LibElf_FOUND AND LibDwarf_FOUND AND NOT ENABLE_DEBUGINFOD) return() endif() @@ -48,30 +46,34 @@ set(_min_version 0.178) set(ElfUtils_MIN_VERSION ${_min_version} - CACHE STRING "Minimum acceptable elfutils version") + CACHE STRING + "Minimum acceptable elfutils version" +) if(${ElfUtils_MIN_VERSION} VERSION_LESS ${_min_version}) rocprofiler_systems_message( FATAL_ERROR "Requested version ${ElfUtils_MIN_VERSION} is less than minimum supported version (${_min_version})" - ) + ) endif() # -------------- PATHS -------------------------------------------------------- # Base directory the of elfutils installation -set(ElfUtils_ROOT_DIR - "/usr" - CACHE PATH "Base directory the of elfutils installation") +set(ElfUtils_ROOT_DIR "/usr" CACHE PATH "Base directory the of elfutils installation") # Hint directory that contains the elfutils headers files set(ElfUtils_INCLUDEDIR "${ElfUtils_ROOT_DIR}/include" - CACHE PATH "Hint directory that contains the elfutils headers files") + CACHE PATH + "Hint directory that contains the elfutils headers files" +) # Hint directory that contains the elfutils library files set(ElfUtils_LIBRARYDIR "${ElfUtils_ROOT_DIR}/lib" - CACHE PATH "Hint directory that contains the elfutils library files") + CACHE PATH + "Hint directory that contains the elfutils library files" +) # libelf/dwarf-specific directory hints foreach(l LibElf LibDwarf LibDebuginfod) @@ -96,15 +98,19 @@ endif() # -------------- SOURCE BUILD ------------------------------------------------- -if(LibElf_FOUND - AND LibDwarf_FOUND - AND (NOT ENABLE_DEBUGINFOD OR LibDebuginfod_FOUND)) +if(LibElf_FOUND AND LibDwarf_FOUND AND (NOT ENABLE_DEBUGINFOD OR LibDebuginfod_FOUND)) if(ENABLE_DEBUGINFOD AND LibDebuginfod_FOUND) set(_eu_root ${ElfUtils_ROOT_DIR}) - set(_eu_inc_dirs ${LibElf_INCLUDE_DIRS} ${LibDwarf_INCLUDE_DIRS} - ${LibDebuginfod_INCLUDE_DIRS}) - set(_eu_lib_dirs ${LibElf_LIBRARY_DIRS} ${LibDwarf_LIBRARY_DIRS} - ${LibDebuginfod_LIBRARY_DIRS}) + set(_eu_inc_dirs + ${LibElf_INCLUDE_DIRS} + ${LibDwarf_INCLUDE_DIRS} + ${LibDebuginfod_INCLUDE_DIRS} + ) + set(_eu_lib_dirs + ${LibElf_LIBRARY_DIRS} + ${LibDwarf_LIBRARY_DIRS} + ${LibDebuginfod_LIBRARY_DIRS} + ) set(_eu_libs ${LibElf_LIBRARIES} ${LibDwarf_LIBRARIES} ${LibDebuginfod_LIBRARIES}) else() set(_eu_root ${ElfUtils_ROOT_DIR}) @@ -115,17 +121,19 @@ if(LibElf_FOUND elseif(NOT (LibElf_FOUND AND LibDwarf_FOUND) AND STERILE_BUILD) rocprofiler_systems_message( FATAL_ERROR - "ElfUtils not found and cannot be downloaded because build is sterile.") + "ElfUtils not found and cannot be downloaded because build is sterile." + ) elseif(NOT BUILD_ELFUTILS) rocprofiler_systems_message( FATAL_ERROR "ElfUtils was not found. Either configure cmake to find ElfUtils properly or set BUILD_ELFUTILS=ON to download and build" - ) + ) else() # If we didn't find a suitable version on the system, then download one from the web rocprofiler_systems_add_cache_option( ELFUTILS_DOWNLOAD_VERSION "Version of elfutils to download and install" STRING - "0.188") + "0.188" + ) set(ELFUTILS_DOWNLOAD_VERSION ${ElfUtils_DOWNLOAD_VERSION}) # make sure we are not downloading a version less than minimum @@ -133,36 +141,45 @@ else() rocprofiler_systems_message( FATAL_ERROR "elfutils download version is set to ${ELFUTILS_DOWNLOAD_VERSION} but elfutils minimum version is set to ${ElfUtils_MIN_VERSION}" - ) + ) endif() rocprofiler_systems_message(STATUS "${ElfUtils_ERROR_REASON}") rocprofiler_systems_message( STATUS - "Attempting to build elfutils(${ELFUTILS_DOWNLOAD_VERSION}) as external project") + "Attempting to build elfutils(${ELFUTILS_DOWNLOAD_VERSION}) as external project" + ) - if(NOT (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR NOT (${CMAKE_C_COMPILER_ID} - STREQUAL "GNU")) + if( + NOT (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") + OR NOT (${CMAKE_C_COMPILER_ID} STREQUAL "GNU") + ) rocprofiler_systems_message(FATAL_ERROR - "ElfUtils will only build with the GNU compiler") + "ElfUtils will only build with the GNU compiler" + ) endif() set(_eu_root ${TPL_STAGING_PREFIX}/elfutils) set(_eu_inc_dirs $) set(_eu_lib_dirs $) - set(_eu_libs $ - $) - set(_eu_build_byproducts "${_eu_root}/lib/libdw${CMAKE_SHARED_LIBRARY_SUFFIX}" - "${_eu_root}/lib/libelf${CMAKE_SHARED_LIBRARY_SUFFIX}") + set(_eu_libs + $ + $ + ) + set(_eu_build_byproducts + "${_eu_root}/lib/libdw${CMAKE_SHARED_LIBRARY_SUFFIX}" + "${_eu_root}/lib/libelf${CMAKE_SHARED_LIBRARY_SUFFIX}" + ) file(MAKE_DIRECTORY "${_eu_root}/lib") file(MAKE_DIRECTORY "${_eu_root}/include") include(ExternalProject) - externalproject_add( + ExternalProject_Add( rocprofiler-systems-elfutils-build PREFIX ${_eu_root} - URL ${ElfUtils_DOWNLOAD_URL} + URL + ${ElfUtils_DOWNLOAD_URL} "https://sourceware.org/elfutils/ftp/${ELFUTILS_DOWNLOAD_VERSION}/elfutils-${ELFUTILS_DOWNLOAD_VERSION}.tar.bz2" "https://mirrors.kernel.org/sourceware/elfutils/${ELFUTILS_DOWNLOAD_VERSION}/elfutils-${ELFUTILS_DOWNLOAD_VERSION}.tar.bz2" BUILD_IN_SOURCE 1 @@ -175,42 +192,48 @@ else() --libdir=${_eu_root}/lib BUILD_COMMAND make install BUILD_BYPRODUCTS ${_eu_build_byproducts} - INSTALL_COMMAND "") + INSTALL_COMMAND "" + ) # target for re-executing the installation add_custom_target( rocprofiler-systems-elfutils-install COMMAND make install WORKING_DIRECTORY ${${_eu_root}}/src/ElfUtils-External - COMMENT "Installing ElfUtils...") + COMMENT "Installing ElfUtils..." + ) install( DIRECTORY ${_eu_root}/lib/ DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME} FILES_MATCHING - PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*") + PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*" + ) endif() # -------------- EXPORT VARIABLES --------------------------------------------- set(ElfUtils_ROOT_DIR ${_eu_root} - CACHE PATH "Base directory the of elfutils installation" FORCE) -set(ElfUtils_INCLUDE_DIRS - ${_eu_inc_dirs} - CACHE PATH "elfutils include directory" FORCE) -set(ElfUtils_LIBRARY_DIRS - ${_eu_lib_dirs} - CACHE PATH "elfutils library directory" FORCE) + CACHE PATH + "Base directory the of elfutils installation" + FORCE +) +set(ElfUtils_INCLUDE_DIRS ${_eu_inc_dirs} CACHE PATH "elfutils include directory" FORCE) +set(ElfUtils_LIBRARY_DIRS ${_eu_lib_dirs} CACHE PATH "elfutils library directory" FORCE) set(ElfUtils_INCLUDE_DIR ${ElfUtils_INCLUDE_DIRS} - CACHE PATH "elfutils include directory" FORCE) -set(ElfUtils_LIBRARIES - ${_eu_libs} - CACHE FILEPATH "elfutils library files" FORCE) + CACHE PATH + "elfutils include directory" + FORCE +) +set(ElfUtils_LIBRARIES ${_eu_libs} CACHE FILEPATH "elfutils library files" FORCE) -target_include_directories(rocprofiler-systems-elfutils SYSTEM - INTERFACE ${ElfUtils_INCLUDE_DIRS}) +target_include_directories( + rocprofiler-systems-elfutils + SYSTEM + INTERFACE ${ElfUtils_INCLUDE_DIRS} +) target_compile_definitions(rocprofiler-systems-elfutils INTERFACE ${ElfUtils_DEFINITIONS}) target_link_directories(rocprofiler-systems-elfutils INTERFACE ${ElfUtils_LIBRARY_DIRS}) target_link_libraries(rocprofiler-systems-elfutils INTERFACE ${ElfUtils_LIBRARIES}) diff --git a/projects/rocprofiler-systems/cmake/DyninstExternals.cmake b/projects/rocprofiler-systems/cmake/DyninstExternals.cmake index 239d792df7..92d6aa15bd 100644 --- a/projects/rocprofiler-systems/cmake/DyninstExternals.cmake +++ b/projects/rocprofiler-systems/cmake/DyninstExternals.cmake @@ -5,8 +5,8 @@ foreach(dep BOOST TBB ELFUTILS LIBIBERTY) if(DYNINST_BUILD_${dep}) message( WARNING - "DYNINST_BUILD_${dep} is deprecated. Using ROCPROFSYS_BUILD_${dep} instead." - ) + "DYNINST_BUILD_${dep} is deprecated. Using ROCPROFSYS_BUILD_${dep} instead." + ) set(ROCPROFSYS_BUILD_${dep} ON) endif() endforeach() @@ -16,22 +16,27 @@ foreach(dep BOOST TBB ELFUTILS LIBIBERTY) if(ROCPROFSYS_BUILD_${dep}) if(dep STREQUAL "BOOST") rocprofiler_systems_add_option(BUILD_BOOST "Enable building Boost internally" - ON) + ON + ) elseif(dep STREQUAL "TBB") rocprofiler_systems_add_option(BUILD_TBB "Enable building TBB internally" ON) elseif(dep STREQUAL "ELFUTILS") rocprofiler_systems_add_option(BUILD_ELFUTILS - "Enable building elfutils internally" ON) + "Enable building elfutils internally" ON + ) elseif(dep STREQUAL "LIBIBERTY") rocprofiler_systems_add_option(BUILD_LIBIBERTY - "Enable building libiberty internally" ON) + "Enable building libiberty internally" ON + ) endif() endif() endforeach() set(TPL_STAGING_PREFIX "${PROJECT_BINARY_DIR}/external" - CACHE PATH "Third-party library build-tree install prefix") + CACHE PATH + "Third-party library build-tree install prefix" +) file(MAKE_DIRECTORY "${TPL_STAGING_PREFIX}") file(MAKE_DIRECTORY "${TPL_STAGING_PREFIX}/include") @@ -42,8 +47,9 @@ include(DyninstBoost) if(TARGET rocprofiler-systems-boost-build) # Make Boost build serially set_target_properties( - rocprofiler-systems-boost PROPERTIES JOB_POOL_COMPILE external_deps_pool - JOB_POOL_LINK external_deps_pool) + rocprofiler-systems-boost + PROPERTIES JOB_POOL_COMPILE external_deps_pool JOB_POOL_LINK external_deps_pool + ) # Create a prebuild target that depends on Boost add_dependencies(external-prebuild rocprofiler-systems-boost-build) endif() @@ -52,24 +58,27 @@ include(DyninstTBB) if(TARGET rocprofiler-systems-tbb-build AND TARGET external-prebuild) # Make TBB build serially and wait for Boost set_target_properties( - rocprofiler-systems-tbb-build PROPERTIES JOB_POOL_COMPILE external_deps_pool - JOB_POOL_LINK external_deps_pool) + rocprofiler-systems-tbb-build + PROPERTIES JOB_POOL_COMPILE external_deps_pool JOB_POOL_LINK external_deps_pool + ) add_dependencies(external-prebuild rocprofiler-systems-tbb-build) endif() include(DyninstElfUtils) if(TARGET rocprofiler-systems-elfutils-build AND TARGET external-prebuild) set_target_properties( - rocprofiler-systems-elfutils-build PROPERTIES JOB_POOL_COMPILE external_deps_pool - JOB_POOL_LINK external_deps_pool) + rocprofiler-systems-elfutils-build + PROPERTIES JOB_POOL_COMPILE external_deps_pool JOB_POOL_LINK external_deps_pool + ) add_dependencies(external-prebuild rocprofiler-systems-elfutils-build) endif() include(DyninstLibIberty) if(TARGET rocprofiler-systems-libiberty-build AND TARGET external-prebuild) set_target_properties( - rocprofiler-systems-libiberty-build PROPERTIES JOB_POOL_COMPILE external_deps_pool - JOB_POOL_LINK external_deps_pool) + rocprofiler-systems-libiberty-build + PROPERTIES JOB_POOL_COMPILE external_deps_pool JOB_POOL_LINK external_deps_pool + ) add_dependencies(external-prebuild rocprofiler-systems-libiberty-build) endif() @@ -86,34 +95,45 @@ endif() if(NOT TARGET Dyninst::Boost AND TARGET rocprofiler-systems-boost) add_library(Dyninst::Boost INTERFACE IMPORTED) - set_target_properties(Dyninst::Boost PROPERTIES INTERFACE_LINK_LIBRARIES - rocprofiler-systems-boost) + set_target_properties( + Dyninst::Boost + PROPERTIES INTERFACE_LINK_LIBRARIES rocprofiler-systems-boost + ) message( STATUS - "Created imported target Dyninst::Boost linked to rocprofiler-systems-boost") + "Created imported target Dyninst::Boost linked to rocprofiler-systems-boost" + ) endif() if(NOT TARGET Dyninst::ElfUtils AND TARGET rocprofiler-systems-elfutils) add_library(Dyninst::ElfUtils INTERFACE IMPORTED) - set_target_properties(Dyninst::ElfUtils PROPERTIES INTERFACE_LINK_LIBRARIES - rocprofiler-systems-elfutils) + set_target_properties( + Dyninst::ElfUtils + PROPERTIES INTERFACE_LINK_LIBRARIES rocprofiler-systems-elfutils + ) message(STATUS "Created imported target Dyninst::ElfUtils linked to ElfUtils") endif() if(NOT TARGET Dyninst::TBB AND TARGET rocprofiler-systems-tbb) add_library(Dyninst::TBB INTERFACE IMPORTED) - set_target_properties(Dyninst::TBB PROPERTIES INTERFACE_LINK_LIBRARIES - rocprofiler-systems-tbb) + set_target_properties( + Dyninst::TBB + PROPERTIES INTERFACE_LINK_LIBRARIES rocprofiler-systems-tbb + ) message( - STATUS "Created imported target Dyninst::TBB linked to rocprofiler-systems-tbb") + STATUS + "Created imported target Dyninst::TBB linked to rocprofiler-systems-tbb" + ) endif() if(NOT TARGET Dyninst::LibIberty AND TARGET rocprofiler-systems-libiberty) add_library(Dyninst::LibIberty INTERFACE IMPORTED) - set_target_properties(Dyninst::LibIberty PROPERTIES INTERFACE_LINK_LIBRARIES - rocprofiler-systems-libiberty) + set_target_properties( + Dyninst::LibIberty + PROPERTIES INTERFACE_LINK_LIBRARIES rocprofiler-systems-libiberty + ) message( STATUS - "Created imported target Dyninst::LibIberty linked to rocprofiler-systems-libiberty" - ) + "Created imported target Dyninst::LibIberty linked to rocprofiler-systems-libiberty" + ) endif() diff --git a/projects/rocprofiler-systems/cmake/DyninstLibIberty.cmake b/projects/rocprofiler-systems/cmake/DyninstLibIberty.cmake index 0ae6c4afef..66b52b1bee 100644 --- a/projects/rocprofiler-systems/cmake/DyninstLibIberty.cmake +++ b/projects/rocprofiler-systems/cmake/DyninstLibIberty.cmake @@ -28,14 +28,14 @@ endif() # -------------- PATHS -------------------------------------------------------- # Base directory the of LibIberty installation -set(LibIberty_ROOT_DIR - "/usr" - CACHE PATH "Base directory the of LibIberty installation") +set(LibIberty_ROOT_DIR "/usr" CACHE PATH "Base directory the of LibIberty installation") # Hint directory that contains the LibIberty library files set(LibIberty_LIBRARYDIR "${LibIberty_ROOT_DIR}/lib" - CACHE PATH "Hint directory that contains the LibIberty library files") + CACHE PATH + "Hint directory that contains the LibIberty library files" +) # -------------- PACKAGES ----------------------------------------------------- @@ -53,16 +53,18 @@ if(LibIberty_FOUND) elseif(STERILE_BUILD) rocprofiler_systems_message( FATAL_ERROR - "LibIberty not found and cannot be downloaded because build is sterile.") + "LibIberty not found and cannot be downloaded because build is sterile." + ) elseif(NOT BUILD_LIBIBERTY) rocprofiler_systems_message( FATAL_ERROR "LibIberty was not found. Either configure cmake to find TBB properly or set BUILD_LIBIBERTY=ON to download and build" - ) + ) else() rocprofiler_systems_message(STATUS "${LibIberty_ERROR_REASON}") rocprofiler_systems_message(STATUS - "Attempting to build LibIberty as external project") + "Attempting to build LibIberty as external project" + ) set(_li_root ${TPL_STAGING_PREFIX}/binutils) set(_li_project_name rocprofiler-systems-libiberty-build) @@ -70,17 +72,19 @@ else() set(_li_inc_dirs $) set(_li_lib_dirs $) set(_li_libs - $) + $ + ) set(_li_build_byproducts "${_li_root}/lib/libiberty${CMAKE_STATIC_LIBRARY_SUFFIX}") file(MAKE_DIRECTORY "${_li_root}/lib") file(MAKE_DIRECTORY "${_li_root}/include") include(ExternalProject) - externalproject_add( + ExternalProject_Add( ${_li_project_name} PREFIX ${_li_root} - URL ${DYNINST_BINUTILS_DOWNLOAD_URL} + URL + ${DYNINST_BINUTILS_DOWNLOAD_URL} http://ftpmirror.gnu.org/gnu/binutils/binutils-2.42.tar.gz http://mirrors.kernel.org/sourceware/binutils/releases/binutils-2.42.tar.gz BUILD_IN_SOURCE 1 @@ -90,14 +94,18 @@ else() --prefix=${_li_root} BUILD_COMMAND make BUILD_BYPRODUCTS ${_li_build_byproducts} - INSTALL_COMMAND "") + INSTALL_COMMAND "" + ) add_custom_command( TARGET ${_li_project_name} POST_BUILD - COMMAND install ARGS -C ${_li_working_dir}/libiberty/libiberty.a ${_li_root}/lib - COMMAND install ARGS -C ${_li_working_dir}/include/*.h ${_li_root}/include - COMMENT "Installing LibIberty...") + COMMAND install + ARGS -C ${_li_working_dir}/libiberty/libiberty.a ${_li_root}/lib + COMMAND install + ARGS -C ${_li_working_dir}/include/*.h ${_li_root}/include + COMMENT "Installing LibIberty..." + ) # target for re-executing the installation add_custom_target( @@ -105,7 +113,8 @@ else() COMMAND install -C ${_li_working_dir}/libiberty/libiberty.a ${_li_root}/lib COMMAND install ARGS -C ${_li_working_dir}/include/*.h ${_li_root}/include WORKING_DIRECTORY ${_li_working_dir} - COMMENT "Installing LibIberty...") + COMMENT "Installing LibIberty..." + ) # For backward compatibility set(IBERTY_FOUND TRUE) @@ -126,16 +135,18 @@ target_link_libraries(rocprofiler-systems-libiberty INTERFACE ${_li_libs}) set(LibIberty_ROOT_DIR ${_li_root} - CACHE PATH "Base directory the of LibIberty installation" FORCE) + CACHE PATH + "Base directory the of LibIberty installation" + FORCE +) set(LibIberty_INCLUDE_DIRS ${_li_inc_dirs} - CACHE PATH "LibIberty include directories" FORCE) -set(LibIberty_LIBRARY_DIRS - ${_li_lib_dirs} - CACHE PATH "LibIberty library directory" FORCE) -set(LibIberty_LIBRARIES - ${_li_libs} - CACHE FILEPATH "LibIberty library files" FORCE) + CACHE PATH + "LibIberty include directories" + FORCE +) +set(LibIberty_LIBRARY_DIRS ${_li_lib_dirs} CACHE PATH "LibIberty library directory" FORCE) +set(LibIberty_LIBRARIES ${_li_libs} CACHE FILEPATH "LibIberty library files" FORCE) # For backward compatibility only set(IBERTY_LIBRARIES ${LibIberty_LIBRARIES}) diff --git a/projects/rocprofiler-systems/cmake/DyninstTBB.cmake b/projects/rocprofiler-systems/cmake/DyninstTBB.cmake index 6ef8fbe06d..110d00f8e8 100644 --- a/projects/rocprofiler-systems/cmake/DyninstTBB.cmake +++ b/projects/rocprofiler-systems/cmake/DyninstTBB.cmake @@ -40,9 +40,7 @@ endif() # -------------- RUNTIME CONFIGURATION ---------------------------------------- # Use debug versions of TBB libraries -set(TBB_USE_DEBUG_BUILD - OFF - CACHE BOOL "Use debug versions of TBB libraries") +set(TBB_USE_DEBUG_BUILD OFF CACHE BOOL "Use debug versions of TBB libraries") # Minimum version of TBB (assumes a dotted-decimal format: YYYY.XX) if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") @@ -53,31 +51,27 @@ endif() set(TBB_MIN_VERSION ${_tbb_min_version} - CACHE STRING "Minimum version of TBB (assumes a dotted-decimal format: YYYY.XX)") + CACHE STRING + "Minimum version of TBB (assumes a dotted-decimal format: YYYY.XX)" +) if(${TBB_MIN_VERSION} VERSION_LESS ${_tbb_min_version}) dyninst_message( FATAL_ERROR "Requested TBB version ${TBB_MIN_VERSION} is less than minimum supported version ${_tbb_min_version}" - ) + ) endif() # -------------- PATHS -------------------------------------------------------- # TBB root directory -set(TBB_ROOT_DIR - "/usr" - CACHE PATH "TBB root directory") +set(TBB_ROOT_DIR "/usr" CACHE PATH "TBB root directory") # TBB include directory hint -set(TBB_INCLUDEDIR - "${TBB_ROOT_DIR}/include" - CACHE INTERNAL "TBB include directory") +set(TBB_INCLUDEDIR "${TBB_ROOT_DIR}/include" CACHE INTERNAL "TBB include directory") # TBB library directory hint -set(TBB_LIBRARYDIR - "${TBB_ROOT_DIR}/lib" - CACHE INTERNAL "TBB library directory") +set(TBB_LIBRARYDIR "${TBB_ROOT_DIR}/lib" CACHE INTERNAL "TBB library directory") # Translate to FindTBB names set(TBB_LIBRARY ${TBB_LIBRARYDIR}) @@ -94,59 +88,49 @@ endif() if(TBB_FOUND) # Force the cache entries to be updated Normally, these would not be exported. # However, we need them in the Testsuite - set(TBB_INCLUDE_DIRS - ${TBB_INCLUDE_DIRS} - CACHE PATH "TBB include directory" FORCE) - set(TBB_LIBRARY_DIRS - ${TBB_LIBRARY_DIRS} - CACHE PATH "TBB library directory" FORCE) - set(TBB_DEFINITIONS - ${TBB_DEFINITIONS} - CACHE STRING "TBB compiler definitions" FORCE) - set(TBB_LIBRARIES - ${TBB_LIBRARIES} - CACHE FILEPATH "TBB library files" FORCE) + set(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIRS} CACHE PATH "TBB include directory" FORCE) + set(TBB_LIBRARY_DIRS ${TBB_LIBRARY_DIRS} CACHE PATH "TBB library directory" FORCE) + set(TBB_DEFINITIONS ${TBB_DEFINITIONS} CACHE STRING "TBB compiler definitions" FORCE) + set(TBB_LIBRARIES ${TBB_LIBRARIES} CACHE FILEPATH "TBB library files" FORCE) elseif(STERILE_BUILD) rocprofiler_systems_message( - FATAL_ERROR "TBB not found and cannot be downloaded because build is sterile.") + FATAL_ERROR "TBB not found and cannot be downloaded because build is sterile." + ) elseif(NOT BUILD_TBB) rocprofiler_systems_message( FATAL_ERROR "TBB was not found. Either configure cmake to find TBB properly or set BUILD_TBB=ON to download and build" - ) + ) else() # If we didn't find a suitable version on the system, then download one from the web rocprofiler_systems_message(STATUS "${ThreadingBuildingBlocks_ERROR_REASON}") rocprofiler_systems_message( - STATUS "Attempting to build TBB(${TBB_MIN_VERSION}) as external project") + STATUS "Attempting to build TBB(${TBB_MIN_VERSION}) as external project" + ) if(NOT UNIX) rocprofiler_systems_message( - FATAL_ERROR "Building TBB from source is not supported on this platform") + FATAL_ERROR "Building TBB from source is not supported on this platform" + ) endif() - set(TBB_ROOT_DIR - ${TPL_STAGING_PREFIX}/tbb - CACHE PATH "TBB root directory" FORCE) + set(TBB_ROOT_DIR ${TPL_STAGING_PREFIX}/tbb CACHE PATH "TBB root directory" FORCE) set(_tbb_libraries) set(_tbb_components_cfg) - set(_tbb_library_dirs $ - $) + set(_tbb_library_dirs + $ + $ + ) set(_tbb_include_dirs $ - $) + $ + ) # Forcibly update the cache variables - set(TBB_INCLUDE_DIRS - "${_tbb_include_dirs}" - CACHE PATH "TBB include directory" FORCE) - set(TBB_LIBRARY_DIRS - "${_tbb_library_dirs}" - CACHE PATH "TBB library directory" FORCE) - set(TBB_DEFINITIONS - "" - CACHE STRING "TBB compiler definitions" FORCE) + set(TBB_INCLUDE_DIRS "${_tbb_include_dirs}" CACHE PATH "TBB include directory" FORCE) + set(TBB_LIBRARY_DIRS "${_tbb_library_dirs}" CACHE PATH "TBB library directory" FORCE) + set(TBB_DEFINITIONS "" CACHE STRING "TBB compiler definitions" FORCE) file(MAKE_DIRECTORY "${TBB_ROOT_DIR}/include") file(MAKE_DIRECTORY "${TBB_ROOT_DIR}/lib") @@ -162,23 +146,23 @@ else() set(_tbb_${c}_lib $ - $) + $ + ) # Generate library filenames list(APPEND _tbb_libraries ${_tbb_${c}_lib}) - list(APPEND _tbb_build_byproducts - "${TBB_ROOT_DIR}/lib/lib${c}${CMAKE_SHARED_LIBRARY_SUFFIX}") + list( + APPEND + _tbb_build_byproducts + "${TBB_ROOT_DIR}/lib/lib${c}${CMAKE_SHARED_LIBRARY_SUFFIX}" + ) foreach(t RELEASE DEBUG) - set(TBB_${c}_LIBRARY_${t} - "${_tbb_${c}_lib}" - CACHE FILEPATH "" FORCE) + set(TBB_${c}_LIBRARY_${t} "${_tbb_${c}_lib}" CACHE FILEPATH "" FORCE) endforeach() endforeach() - set(TBB_LIBRARIES - "${_tbb_libraries}" - CACHE FILEPATH "TBB library files" FORCE) + set(TBB_LIBRARIES "${_tbb_libraries}" CACHE FILEPATH "TBB library files" FORCE) # Split the dotted decimal version into major/minor parts string(REGEX REPLACE "\\." ";" _tbb_download_name ${TBB_MIN_VERSION}) @@ -191,25 +175,23 @@ else() set(_tbb_compiler "compiler=clang") endif() - find_program( - MAKE_EXECUTABLE - NAMES make gmake - PATH_SUFFIXES bin) + find_program(MAKE_EXECUTABLE NAMES make gmake PATH_SUFFIXES bin) if(NOT MAKE_EXECUTABLE AND CMAKE_GENERATOR MATCHES "Ninja") dyninst_message( FATAL_ERROR "make/gmake executable not found. Please re-run with -DMAKE_EXECUTABLE=/path/to/make" - ) + ) elseif(NOT MAKE_EXECUTABLE AND CMAKE_GENERATOR MATCHES "Makefiles") set(MAKE_EXECUTABLE "$(MAKE)") endif() include(ExternalProject) - externalproject_add( + ExternalProject_Add( rocprofiler-systems-tbb-build PREFIX ${TBB_ROOT_DIR} - URL https://github.com/ajanicijamd/oneTBB/archive/refs/tags/v${_tbb_ver_major}.${_tbb_ver_minor}.01.tar.gz + URL + https://github.com/ajanicijamd/oneTBB/archive/refs/tags/v${_tbb_ver_major}.${_tbb_ver_minor}.01.tar.gz BUILD_IN_SOURCE 1 CONFIGURE_COMMAND "" BUILD_COMMAND @@ -218,31 +200,35 @@ else() ${_tbb_components_cfg} tbb_build_dir=${TBB_ROOT_DIR}/src tbb_build_prefix=tbb ${_tbb_compiler} BUILD_BYPRODUCTS ${_tbb_build_byproducts} - INSTALL_COMMAND "") + INSTALL_COMMAND "" + ) # post-build target for installing build add_custom_command( TARGET rocprofiler-systems-tbb-build POST_BUILD - COMMAND - ${CMAKE_COMMAND} ARGS -DLIBDIR=${TBB_LIBRARY_DIRS} - -DINCDIR=${TBB_INCLUDE_DIRS} -DPREFIX=${TBB_ROOT_DIR} - -DCMAKE_STRIP=${CMAKE_STRIP} -P + COMMAND ${CMAKE_COMMAND} + ARGS + -DLIBDIR=${TBB_LIBRARY_DIRS} -DINCDIR=${TBB_INCLUDE_DIRS} + -DPREFIX=${TBB_ROOT_DIR} -DCMAKE_STRIP=${CMAKE_STRIP} -P ${CMAKE_CURRENT_LIST_DIR}/DyninstTBBInstall.cmake - COMMENT "Installing TBB...") + COMMENT "Installing TBB..." + ) add_custom_target( rocprofiler-systems-tbb-install COMMAND ${CMAKE_COMMAND} -DLIBDIR=${TBB_LIBRARY_DIRS} -DINCDIR=${TBB_INCLUDE_DIRS} -DPREFIX=${TBB_ROOT_DIR} -P ${CMAKE_CURRENT_LIST_DIR}/DyninstTBBInstall.cmake - COMMENT "Installing TBB...") + COMMENT "Installing TBB..." + ) install( DIRECTORY ${TPL_STAGING_PREFIX}/tbb/lib/ DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME} FILES_MATCHING - PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*") + PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*" + ) endif() foreach(_DIR_TYPE INCLUDE LIBRARY) diff --git a/projects/rocprofiler-systems/cmake/DyninstTBBInstall.cmake b/projects/rocprofiler-systems/cmake/DyninstTBBInstall.cmake index cbd2ca95e2..efebee6f11 100644 --- a/projects/rocprofiler-systems/cmake/DyninstTBBInstall.cmake +++ b/projects/rocprofiler-systems/cmake/DyninstTBBInstall.cmake @@ -20,15 +20,18 @@ file( COPY ${PREFIX}/src/tbb_release/ DESTINATION ${LIBDIR} FILES_MATCHING - PATTERN "*.so.*") + PATTERN "*.so.*" +) file(COPY ${PREFIX}/src/rocprofiler-systems-tbb-build/include/tbb DESTINATION ${INCDIR}) file(GLOB _tbb_libs ${LIBDIR}/libtbb*.so.*) foreach(_lib ${_tbb_libs}) string(REGEX REPLACE "\\.2$" "" _lib_short ${_lib}) get_filename_component(_lib "${_lib}" NAME) - execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${_lib} ${_lib_short} - WORKING_DIRECTORY ${LIBDIR}) + execute_process( + COMMAND ${CMAKE_COMMAND} -E create_symlink ${_lib} ${_lib_short} + WORKING_DIRECTORY ${LIBDIR} + ) endforeach() foreach(_lib ${_tbb_libs}) diff --git a/projects/rocprofiler-systems/cmake/Formatting.cmake b/projects/rocprofiler-systems/cmake/Formatting.cmake index 06370b7d2f..b1451ff91d 100644 --- a/projects/rocprofiler-systems/cmake/Formatting.cmake +++ b/projects/rocprofiler-systems/cmake/Formatting.cmake @@ -13,7 +13,8 @@ macro(ROCPROFILER_SYSTEMS_ACTIVATE_CLANG_TIDY) rocprofiler_systems_add_feature(CLANG_TIDY_COMMAND "Path to clang-tidy command") if(NOT CLANG_TIDY_COMMAND) timemory_message( - WARNING "ROCPROFSYS_USE_CLANG_TIDY is ON but clang-tidy is not found!") + WARNING "ROCPROFSYS_USE_CLANG_TIDY is ON but clang-tidy is not found!" + ) set(ROCPROFSYS_USE_CLANG_TIDY OFF) else() set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_COMMAND}) @@ -39,7 +40,7 @@ endmacro() find_program(ROCPROFSYS_CLANG_FORMAT_EXE NAMES clang-format-18 clang-format) -find_program(ROCPROFSYS_CMAKE_FORMAT_EXE NAMES cmake-format) +find_program(ROCPROFSYS_CMAKE_FORMAT_EXE NAMES gersemi) find_program(ROCPROFSYS_BLACK_FORMAT_EXE NAMES black) add_custom_target(format-rocprofiler-systems) @@ -52,23 +53,38 @@ foreach(_TYPE source python cmake) endif() endforeach() -if(ROCPROFSYS_CLANG_FORMAT_EXE - OR ROCPROFSYS_BLACK_FORMAT_EXE - OR ROCPROFSYS_CMAKE_FORMAT_EXE) - file(GLOB_RECURSE sources ${PROJECT_SOURCE_DIR}/source/*.cpp - ${PROJECT_SOURCE_DIR}/source/*.c) - file(GLOB_RECURSE headers ${PROJECT_SOURCE_DIR}/source/*.hpp - ${PROJECT_SOURCE_DIR}/source/*.hpp.in ${PROJECT_SOURCE_DIR}/source/*.h - ${PROJECT_SOURCE_DIR}/source/*.h.in) - file(GLOB_RECURSE examples ${PROJECT_SOURCE_DIR}/examples/*.cpp - ${PROJECT_SOURCE_DIR}/examples/*.c ${PROJECT_SOURCE_DIR}/examples/*.hpp - ${PROJECT_SOURCE_DIR}/examples/*.h) - file(GLOB_RECURSE tests_source ${PROJECT_SOURCE_DIR}/tests/source/*.cpp - ${PROJECT_SOURCE_DIR}/tests/source/*.hpp) +if( + ROCPROFSYS_CLANG_FORMAT_EXE + OR ROCPROFSYS_BLACK_FORMAT_EXE + OR ROCPROFSYS_CMAKE_FORMAT_EXE +) + file( + GLOB_RECURSE sources + ${PROJECT_SOURCE_DIR}/source/*.cpp + ${PROJECT_SOURCE_DIR}/source/*.c + ) + file( + GLOB_RECURSE headers + ${PROJECT_SOURCE_DIR}/source/*.hpp + ${PROJECT_SOURCE_DIR}/source/*.hpp.in + ${PROJECT_SOURCE_DIR}/source/*.h + ${PROJECT_SOURCE_DIR}/source/*.h.in + ) + file( + GLOB_RECURSE examples + ${PROJECT_SOURCE_DIR}/examples/*.cpp + ${PROJECT_SOURCE_DIR}/examples/*.c + ${PROJECT_SOURCE_DIR}/examples/*.hpp + ${PROJECT_SOURCE_DIR}/examples/*.h + ) + file( + GLOB_RECURSE tests_source + ${PROJECT_SOURCE_DIR}/tests/source/*.cpp + ${PROJECT_SOURCE_DIR}/tests/source/*.hpp + ) file(GLOB_RECURSE external ${PROJECT_SOURCE_DIR}/examples/lulesh/external/kokkos/*) file( - GLOB_RECURSE - cmake_files + GLOB_RECURSE cmake_files ${PROJECT_SOURCE_DIR}/source/*CMakeLists.txt ${PROJECT_SOURCE_DIR}/examples/*CMakeLists.txt ${PROJECT_SOURCE_DIR}/tests/*CMakeLists.txt @@ -76,7 +92,8 @@ if(ROCPROFSYS_CLANG_FORMAT_EXE ${PROJECT_SOURCE_DIR}/examples/*.cmake ${PROJECT_SOURCE_DIR}/tests/*.cmake ${PROJECT_SOURCE_DIR}/cmake/*.cmake - ${PROJECT_SOURCE_DIR}/source/*.cmake) + ${PROJECT_SOURCE_DIR}/source/*.cmake + ) list(APPEND cmake_files ${PROJECT_SOURCE_DIR}/CMakeLists.txt) if(external) list(REMOVE_ITEM examples ${external}) @@ -90,7 +107,7 @@ if(ROCPROFSYS_CLANG_FORMAT_EXE ${tests_source} COMMENT "[rocprofiler-systems] Running C++ formatter ${ROCPROFSYS_CLANG_FORMAT_EXE}..." - ) + ) endif() if(ROCPROFSYS_BLACK_FORMAT_EXE) @@ -99,7 +116,7 @@ if(ROCPROFSYS_CLANG_FORMAT_EXE ${ROCPROFSYS_BLACK_FORMAT_EXE} -q ${PROJECT_SOURCE_DIR} COMMENT "[rocprofiler-systems] Running Python formatter ${ROCPROFSYS_BLACK_FORMAT_EXE}..." - ) + ) if(NOT TARGET format-python) add_custom_target(format-python) endif() @@ -111,7 +128,7 @@ if(ROCPROFSYS_CLANG_FORMAT_EXE ${ROCPROFSYS_CMAKE_FORMAT_EXE} -i ${cmake_files} COMMENT "[rocprofiler-systems] Running CMake formatter ${ROCPROFSYS_CMAKE_FORMAT_EXE}..." - ) + ) if(NOT TARGET format-cmake) add_custom_target(format-cmake) endif() @@ -119,8 +136,10 @@ if(ROCPROFSYS_CLANG_FORMAT_EXE foreach(_TYPE source python cmake) if(TARGET format-rocprofiler-systems-${_TYPE}) - add_dependencies(format-rocprofiler-systems - format-rocprofiler-systems-${_TYPE}) + add_dependencies( + format-rocprofiler-systems + format-rocprofiler-systems-${_TYPE} + ) add_dependencies(format-${_TYPE} format-rocprofiler-systems-${_TYPE}) endif() endforeach() diff --git a/projects/rocprofiler-systems/cmake/MacroUtilities.cmake b/projects/rocprofiler-systems/cmake/MacroUtilities.cmake index 4c2c5b6d84..d7004bc3c4 100644 --- a/projects/rocprofiler-systems/cmake/MacroUtilities.cmake +++ b/projects/rocprofiler-systems/cmake/MacroUtilities.cmake @@ -31,7 +31,8 @@ macro(ROCPROFILER_SYSTEMS_SAVE_VARIABLES _PREFIX) "" # options "CONDITION" # single value args "VARIABLES" # multiple value args - ${ARGN}) + ${ARGN} + ) if(DEFINED SAVE_CONDITION AND NOT "${SAVE_CONDITION}" STREQUAL "") if(${SAVE_CONDITION}) foreach(_VAR ${SAVE_VARIABLES}) @@ -65,7 +66,8 @@ macro(ROCPROFILER_SYSTEMS_RESTORE_VARIABLES _PREFIX) "" # options "CONDITION" # single value args "VARIABLES" # multiple value args - ${ARGN}) + ${ARGN} + ) if(DEFINED RESTORE_CONDITION AND NOT "${RESTORE_CONDITION}" STREQUAL "") if(${RESTORE_CONDITION}) foreach(_VAR ${RESTORE_VARIABLES}) @@ -102,9 +104,7 @@ function(ROCPROFILER_SYSTEMS_CAPITALIZE str var) string(TOUPPER "${_first}" _first) string(SUBSTRING "${str}" 1 -1 _remainder) string(CONCAT str "${_first}" "${_remainder}") - set(${var} - "${str}" - PARENT_SCOPE) + set(${var} "${str}" PARENT_SCOPE) endfunction() # ------------------------------------------------------------------------------# @@ -122,13 +122,15 @@ function(ROCPROFILER_SYSTEMS_STRIP_TARGET) else() rocprofiler_systems_message( FATAL_ERROR - "rocprofiler_systems_strip_target cannot deduce target from \"${ARGN}\"") + "rocprofiler_systems_strip_target cannot deduce target from \"${ARGN}\"" + ) endif() if(NOT TARGET "${_TARGET}") rocprofiler_systems_message( FATAL_ERROR - "rocprofiler_systems_strip_target not provided valid target: \"${_TARGET}\"") + "rocprofiler_systems_strip_target not provided valid target: \"${_TARGET}\"" + ) endif() if(CMAKE_STRIP AND (STRIP_FORCE OR ROCPROFSYS_STRIP_LIBRARIES)) @@ -138,7 +140,8 @@ function(ROCPROFILER_SYSTEMS_STRIP_TARGET) POST_BUILD COMMAND ${CMAKE_STRIP} ${STRIP_ARGS} $ WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMENT "Stripping ${_TARGET}...") + COMMENT "Stripping ${_TARGET}..." + ) else() add_custom_command( TARGET ${_TARGET} @@ -159,7 +162,8 @@ function(ROCPROFILER_SYSTEMS_STRIP_TARGET) --keep-symbol="OnUnloadTool" --keep-symbol="__libc_start_main" ${STRIP_ARGS} $ WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMENT "Stripping ${_TARGET}...") + COMMENT "Stripping ${_TARGET}..." + ) endif() endif() endfunction() @@ -187,9 +191,12 @@ endfunction() function(ROCPROFILER_SYSTEMS_CHECKOUT_GIT_SUBMODULE) # parse args cmake_parse_arguments( - CHECKOUT "RECURSIVE" + CHECKOUT + "RECURSIVE" "RELATIVE_PATH;WORKING_DIRECTORY;TEST_FILE;REPO_URL;REPO_BRANCH" - "ADDITIONAL_CMDS" ${ARGN}) + "ADDITIONAL_CMDS" + ${ARGN} + ) if(NOT CHECKOUT_WORKING_DIRECTORY) set(CHECKOUT_WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) @@ -244,15 +251,19 @@ function(ROCPROFILER_SYSTEMS_CHECKOUT_GIT_SUBMODULE) if(NOT _TEST_FILE_EXISTS AND _SUBMODULE_EXISTS) # perform the checkout execute_process( - COMMAND ${GIT_EXECUTABLE} submodule update --init ${_RECURSE} - ${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH} + COMMAND + ${GIT_EXECUTABLE} submodule update --init ${_RECURSE} + ${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH} WORKING_DIRECTORY ${CHECKOUT_WORKING_DIRECTORY} - RESULT_VARIABLE RET) + RESULT_VARIABLE RET + ) # check the return code if(RET GREATER 0) - set(_CMD "${GIT_EXECUTABLE} submodule update --init ${_RECURSE} - ${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH}") + set(_CMD + "${GIT_EXECUTABLE} submodule update --init ${_RECURSE} + ${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH}" + ) message(STATUS "function(rocprofiler_systems_checkout_git_submodule) failed.") message(FATAL_ERROR "Command: \"${_CMD}\"") else() @@ -262,7 +273,9 @@ function(ROCPROFILER_SYSTEMS_CHECKOUT_GIT_SUBMODULE) if(NOT _TEST_FILE_EXISTS AND _HAS_REPO_URL) message( - STATUS "Checking out '${CHECKOUT_REPO_URL}' @ '${CHECKOUT_REPO_BRANCH}'...") + STATUS + "Checking out '${CHECKOUT_REPO_URL}' @ '${CHECKOUT_REPO_BRANCH}'..." + ) # remove the existing directory if(EXISTS "${_DIR}") @@ -275,16 +288,16 @@ function(ROCPROFILER_SYSTEMS_CHECKOUT_GIT_SUBMODULE) ${GIT_EXECUTABLE} clone -b ${CHECKOUT_REPO_BRANCH} ${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_REPO_URL} ${CHECKOUT_RELATIVE_PATH} WORKING_DIRECTORY ${CHECKOUT_WORKING_DIRECTORY} - RESULT_VARIABLE RET) + RESULT_VARIABLE RET + ) # perform the submodule update - if(CHECKOUT_RECURSIVE - AND EXISTS "${_DIR}" - AND IS_DIRECTORY "${_DIR}") + if(CHECKOUT_RECURSIVE AND EXISTS "${_DIR}" AND IS_DIRECTORY "${_DIR}") execute_process( COMMAND ${GIT_EXECUTABLE} submodule update --init ${_RECURSE} WORKING_DIRECTORY ${_DIR} - RESULT_VARIABLE RET) + RESULT_VARIABLE RET + ) endif() # check the return code @@ -292,7 +305,7 @@ function(ROCPROFILER_SYSTEMS_CHECKOUT_GIT_SUBMODULE) set(_CMD "${GIT_EXECUTABLE} clone -b ${CHECKOUT_REPO_BRANCH} ${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_REPO_URL} ${CHECKOUT_RELATIVE_PATH}" - ) + ) message(STATUS "function(rocprofiler_systems_checkout_git_submodule) failed.") message(FATAL_ERROR "Command: \"${_CMD}\"") else() @@ -303,9 +316,9 @@ function(ROCPROFILER_SYSTEMS_CHECKOUT_GIT_SUBMODULE) if(NOT EXISTS "${_TEST_FILE}" OR NOT _TEST_FILE_EXISTS) message( FATAL_ERROR - "Error checking out submodule: '${CHECKOUT_RELATIVE_PATH}' to '${_DIR}'") + "Error checking out submodule: '${CHECKOUT_RELATIVE_PATH}' to '${_DIR}'" + ) endif() - endfunction() # ----------------------------------------------------------------------------------------# @@ -315,13 +328,9 @@ function(ROCPROFILER_SYSTEMS_TEST_FIND_PACKAGE PACKAGE_NAME OUTPUT_VAR) cmake_parse_arguments(PACKAGE "" "" "UNSET" ${ARGN}) find_package(${PROJECT_NAME} QUIET ${PACKAGE_UNPARSED_ARGUMENTS}) if(NOT ${PROJECT_NAME}_FOUND) - set(${OUTPUT_VAR} - OFF - PARENT_SCOPE) + set(${OUTPUT_VAR} OFF PARENT_SCOPE) else() - set(${OUTPUT_VAR} - ON - PARENT_SCOPE) + set(${OUTPUT_VAR} ON PARENT_SCOPE) endif() foreach(_ARG ${PACKAGE_UNSET} FIND_PACKAGE_MESSAGE_DETAILS_${PROJECT_NAME}) unset(${_ARG} CACHE) @@ -339,10 +348,16 @@ macro(ROCPROFILER_SYSTEMS_ADD_INTERFACE_LIBRARY _TARGET) DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT core EXPORT ${PROJECT_NAME}-interface-targets - OPTIONAL) + OPTIONAL + ) if(NOT "${ARGN}" STREQUAL "") - set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_INTERFACE_DOC - "${PROJECT_NAME}::${_TARGET}` | ${ARGN} |") + set_property( + GLOBAL + APPEND + PROPERTY + ${PROJECT_NAME}_CMAKE_INTERFACE_DOC + "${PROJECT_NAME}::${_TARGET}` | ${ARGN} |" + ) endif() endmacro() @@ -354,10 +369,12 @@ endmacro() function(ROCPROFILER_SYSTEMS_ADD_FEATURE _var _description) set(EXTRA_DESC "") foreach(currentArg ${ARGN}) - if(NOT "${currentArg}" STREQUAL "${_var}" - AND NOT "${currentArg}" STREQUAL "${_description}" - AND NOT "${currentArg}" STREQUAL "CMAKE_DEFINE" - AND NOT "${currentArg}" STREQUAL "DOC") + if( + NOT "${currentArg}" STREQUAL "${_var}" + AND NOT "${currentArg}" STREQUAL "${_description}" + AND NOT "${currentArg}" STREQUAL "CMAKE_DEFINE" + AND NOT "${currentArg}" STREQUAL "DOC" + ) set(EXTRA_DESC "${EXTA_DESC}${currentArg}") endif() endforeach() @@ -366,16 +383,28 @@ function(ROCPROFILER_SYSTEMS_ADD_FEATURE _var _description) set_property(GLOBAL PROPERTY ${_var}_DESCRIPTION "${_description}${EXTRA_DESC}") if("CMAKE_DEFINE" IN_LIST ARGN) - set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_DEFINES - "${_var} @${_var}@") + set_property( + GLOBAL + APPEND + PROPERTY ${PROJECT_NAME}_CMAKE_DEFINES "${_var} @${_var}@" + ) if(ROCPROFSYS_BUILD_DOCS) set_property( - GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_OPTIONS_DOC - "${_var}` | ${_description}${EXTRA_DESC} |") + GLOBAL + APPEND + PROPERTY + ${PROJECT_NAME}_CMAKE_OPTIONS_DOC + "${_var}` | ${_description}${EXTRA_DESC} |" + ) endif() elseif("DOC" IN_LIST ARGN AND ROCPROFSYS_BUILD_DOCS) - set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_OPTIONS_DOC - "${_var}` | ${_description}${EXTRA_DESC} |") + set_property( + GLOBAL + APPEND + PROPERTY + ${PROJECT_NAME}_CMAKE_OPTIONS_DOC + "${_var}` | ${_description}${EXTRA_DESC} |" + ) endif() endfunction() @@ -390,8 +419,11 @@ function(ROCPROFILER_SYSTEMS_ADD_OPTION _NAME _MESSAGE _DEFAULT) else() rocprofiler_systems_add_feature(${_NAME} "${_MESSAGE}") if(ROCPROFSYS_BUILD_DOCS) - set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_OPTIONS_DOC - "${_NAME}` | ${_MESSAGE} |") + set_property( + GLOBAL + APPEND + PROPERTY ${PROJECT_NAME}_CMAKE_OPTIONS_DOC "${_NAME}` | ${_MESSAGE} |" + ) endif() endif() if("ADVANCED" IN_LIST ARGN) @@ -412,9 +444,7 @@ function(ROCPROFILER_SYSTEMS_ADD_CACHE_OPTION _NAME _MESSAGE _TYPE _DEFAULT) set(_FORCE FORCE) endif() - set(${_NAME} - "${_DEFAULT}" - CACHE ${_TYPE} "${_MESSAGE}" ${_FORCE}) + set(${_NAME} "${_DEFAULT}" CACHE ${_TYPE} "${_MESSAGE}" ${_FORCE}) if("NO_FEATURE" IN_LIST ARGN) mark_as_advanced(${_NAME}) @@ -422,8 +452,11 @@ function(ROCPROFILER_SYSTEMS_ADD_CACHE_OPTION _NAME _MESSAGE _TYPE _DEFAULT) rocprofiler_systems_add_feature(${_NAME} "${_MESSAGE}") if(ROCPROFSYS_BUILD_DOCS) - set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_OPTIONS_DOC - "${_NAME}` | ${_MESSAGE} |") + set_property( + GLOBAL + APPEND + PROPERTY ${PROJECT_NAME}_CMAKE_OPTIONS_DOC "${_NAME}` | ${_MESSAGE} |" + ) endif() endif() @@ -473,13 +506,21 @@ function(ROCPROFILER_SYSTEMS_PRINT_ENABLED_FEATURES) get_property(_desc GLOBAL PROPERTY ${_feature}_DESCRIPTION) # print description, if not standard ON/OFF, print what is set to if(_desc) - if(NOT "${${_feature}}" STREQUAL "ON" AND NOT "${${_feature}}" STREQUAL - "TRUE") + if( + NOT "${${_feature}}" STREQUAL "ON" + AND NOT "${${_feature}}" STREQUAL "TRUE" + ) set(_currentFeatureText - "${_currentFeatureText}: ${_desc} -- [\"${${_feature}}\"]") + "${_currentFeatureText}: ${_desc} -- [\"${${_feature}}\"]" + ) else() - string(REGEX REPLACE "^${PROJECT_NAME}_USE_" "" _feature_tmp - "${_feature}") + string( + REGEX REPLACE + "^${PROJECT_NAME}_USE_" + "" + _feature_tmp + "${_feature}" + ) string(TOLOWER "${_feature_tmp}" _feature_tmp_l) rocprofiler_systems_capitalize("${_feature_tmp}" _feature_tmp_c) foreach(_var _feature _feature_tmp _feature_tmp_l _feature_tmp_c) @@ -548,8 +589,13 @@ endfunction() # a project/subproject # function(rocprofiler_systems_custom_compilation) - cmake_parse_arguments(COMP "GLOBAL;PROJECT" "COMPILER" "DIRECTORY;TARGET;SOURCE" - ${ARGN}) + cmake_parse_arguments( + COMP + "GLOBAL;PROJECT" + "COMPILER" + "DIRECTORY;TARGET;SOURCE" + ${ARGN} + ) # find rocprof-sys-launch-compiler find_program( @@ -557,20 +603,23 @@ function(rocprofiler_systems_custom_compilation) NAMES rocprof-sys-launch-compiler HINTS ${PROJECT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} PATHS ${PROJECT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} - PATH_SUFFIXES scripts bin) + PATH_SUFFIXES scripts bin + ) message(STATUS "rocprof_sys_compile_launcher: ${ROCPROFSYS_COMPILE_LAUNCHER}") if(NOT COMP_COMPILER) message( - FATAL_ERROR "rocprof_sys_custom_compilation not provided COMPILER argument") + FATAL_ERROR + "rocprof_sys_custom_compilation not provided COMPILER argument" + ) endif() if(NOT ROCPROFSYS_COMPILE_LAUNCHER) message( FATAL_ERROR - "rocprofiler-systems could not find 'rocprof-sys-launch-compiler'. Please set '-DROCPROFSYS_COMPILE_LAUNCHER=/path/to/launcher'" - ) + "rocprofiler-systems could not find 'rocprof-sys-launch-compiler'. Please set '-DROCPROFSYS_COMPILE_LAUNCHER=/path/to/launcher'" + ) endif() if(COMP_GLOBAL) @@ -579,12 +628,14 @@ function(rocprofiler_systems_custom_compilation) GLOBAL PROPERTY RULE_LAUNCH_COMPILE - "${ROCPROFSYS_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}") + "${ROCPROFSYS_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}" + ) set_property( GLOBAL PROPERTY RULE_LAUNCH_LINK - "${ROCPROFSYS_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}") + "${ROCPROFSYS_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}" + ) else() foreach(_TYPE PROJECT DIRECTORY TARGET SOURCE) # make project/subproject scoping easy, e.g. @@ -597,17 +648,19 @@ function(rocprofiler_systems_custom_compilation) if(COMP_${_TYPE}) foreach(_VAL ${COMP_${_TYPE}}) set_property( - ${_TYPE} ${_VAL} + ${_TYPE} + ${_VAL} PROPERTY RULE_LAUNCH_COMPILE - "${ROCPROFSYS_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}" - ) + "${ROCPROFSYS_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}" + ) set_property( - ${_TYPE} ${_VAL} + ${_TYPE} + ${_VAL} PROPERTY RULE_LAUNCH_LINK - "${ROCPROFSYS_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}" - ) + "${ROCPROFSYS_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}" + ) endforeach() endif() endforeach() @@ -624,9 +677,7 @@ function(ROCPROFILER_SYSTEMS_WATCH_FOR_CHANGE _var) macro(update_var _VAL) if(_VAR) - set(${_VAR} - ${_VAL} - PARENT_SCOPE) + set(${_VAR} ${_VAL} PARENT_SCOPE) endif() endmacro() @@ -640,7 +691,7 @@ function(ROCPROFILER_SYSTEMS_WATCH_FOR_CHANGE _var) rocprofiler_systems_message( STATUS "${_var} changed :: ${${_rocprofiler_systems_watch_var_name}} --> ${${_var}}" - ) + ) update_var(ON) endif() else() @@ -653,24 +704,33 @@ function(ROCPROFILER_SYSTEMS_WATCH_FOR_CHANGE _var) # store the value for the next run set(${_rocprofiler_systems_watch_var_name} "${${_var}}" - CACHE INTERNAL "Last value of ${_var}" FORCE) + CACHE INTERNAL + "Last value of ${_var}" + FORCE + ) endfunction() function(ROCPROFILER_SYSTEMS_DIRECTORY) - cmake_parse_arguments(F "MKDIR;FAIL;FORCE" "PREFIX;OUTPUT_VARIABLE;WORKING_DIRECTORY" - "PATHS" ${ARGN}) + cmake_parse_arguments( + F + "MKDIR;FAIL;FORCE" + "PREFIX;OUTPUT_VARIABLE;WORKING_DIRECTORY" + "PATHS" + ${ARGN} + ) if(F_PREFIX AND NOT IS_ABSOLUTE "${F_PREFIX}") if(F_WORKING_DIRECTORY) rocprofiler_systems_message( STATUS "PREFIX was specified as a relative path, using working directory + prefix :: '${F_WORKING_DIRECTORY}/${F_PREFIX}'..." - ) + ) set(F_PREFIX ${F_WORKING_DIRECTORY}/${F_PREFIX}) else() rocprofiler_systems_message( FATAL_ERROR - "PREFIX was specified but it is not an absolute path: ${F_PREFIX}") + "PREFIX was specified but it is not an absolute path: ${F_PREFIX}" + ) endif() endif() @@ -693,27 +753,29 @@ function(ROCPROFILER_SYSTEMS_DIRECTORY) rocprofiler_systems_message(FATAL_ERROR "Directory '${_PATH}' does not exist") elseif(NOT IS_DIRECTORY "${_PATH}" AND F_FAIL) rocprofiler_systems_message(FATAL_ERROR - "'${_PATH}' exists but is not a directory") + "'${_PATH}' exists but is not a directory" + ) elseif(NOT EXISTS "${_PATH}" AND F_MKDIR) - execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${_PATH} - WORKING_DIRECTORY ${F_WORKING_DIRECTORY}) - elseif( - EXISTS "${_PATH}" - AND NOT IS_DIRECTORY "${_PATH}" - AND F_MKDIR) + execute_process( + COMMAND ${CMAKE_COMMAND} -E make_directory ${_PATH} + WORKING_DIRECTORY ${F_WORKING_DIRECTORY} + ) + elseif(EXISTS "${_PATH}" AND NOT IS_DIRECTORY "${_PATH}" AND F_MKDIR) if(F_FORCE) - execute_process(COMMAND ${CMAKE_COMMAND} -E rm ${_PATH} - WORKING_DIRECTORY ${F_WORKING_DIRECTORY}) + execute_process( + COMMAND ${CMAKE_COMMAND} -E rm ${_PATH} + WORKING_DIRECTORY ${F_WORKING_DIRECTORY} + ) endif() - execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${_PATH} - WORKING_DIRECTORY ${F_WORKING_DIRECTORY}) + execute_process( + COMMAND ${CMAKE_COMMAND} -E make_directory ${_PATH} + WORKING_DIRECTORY ${F_WORKING_DIRECTORY} + ) endif() endforeach() if(F_OUTPUT_VARIABLE) - set(${F_OUTPUT_VARIABLE} - "${_OUTPUT_VAR}" - PARENT_SCOPE) + set(${F_OUTPUT_VARIABLE} "${_OUTPUT_VAR}" PARENT_SCOPE) endif() endfunction() @@ -728,16 +790,12 @@ function(ROCPROFILER_SYSTEMS_CHECK_PYTHON_DIRS_AND_VERSIONS) else() set(_RET 0) if(F_OUTPUT_VARIABLE) - set(${F_OUTPUT_VARIABLE} - ${_NUM_PYTHON_VERSIONS} - PARENT_SCOPE) + set(${F_OUTPUT_VARIABLE} ${_NUM_PYTHON_VERSIONS} PARENT_SCOPE) endif() endif() if(F_RESULT_VARIABLE) - set(${F_RESULT_VARIABLE} - ${_RET} - PARENT_SCOPE) + set(${F_RESULT_VARIABLE} ${_RET} PARENT_SCOPE) endif() if(NOT ${_RET} EQUAL 0) @@ -745,14 +803,15 @@ function(ROCPROFILER_SYSTEMS_CHECK_PYTHON_DIRS_AND_VERSIONS) rocprofiler_systems_message( WARNING "Error! Number of python versions : ${_NUM_PYTHON_VERSIONS}. VERSIONS :: ${ROCPROFSYS_PYTHON_VERSIONS}" - ) + ) rocprofiler_systems_message( WARNING "Error! Number of python root directories : ${_NUM_PYTHON_ROOT_DIRS}. ROOT DIRS :: ${ROCPROFSYS_PYTHON_ROOT_DIRS}" - ) + ) rocprofiler_systems_message( FATAL_ERROR - "Error! Number of python versions != number of python root directories") + "Error! Number of python versions != number of python root directories" + ) elseif(F_UNSET) unset(ROCPROFSYS_PYTHON_VERSIONS CACHE) unset(ROCPROFSYS_PYTHON_ROOT_DIRS CACHE) @@ -776,46 +835,59 @@ function(ROCPROFILER_SYSTEMS_PYTHON_CONSOLE_SCRIPT SCRIPT_NAME SCRIPT_SUBMODULE) set(Python3_ROOT_DIR "${ARG_ROOT_DIR}") find_package(Python3 ${ARG_VERSION} EXACT QUIET MODULE COMPONENTS Interpreter) set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}") - configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/console-script.in - ${PROJECT_BINARY_DIR}/bin/${SCRIPT_NAME}-${ARG_VERSION} @ONLY) + configure_file( + ${PROJECT_SOURCE_DIR}/cmake/Templates/console-script.in + ${PROJECT_BINARY_DIR}/bin/${SCRIPT_NAME}-${ARG_VERSION} + @ONLY + ) if(CMAKE_INSTALL_PYTHONDIR) install( PROGRAMS ${PROJECT_BINARY_DIR}/bin/${SCRIPT_NAME}-${ARG_VERSION} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT python - OPTIONAL) + OPTIONAL + ) endif() if(ROCPROFSYS_BUILD_TESTING OR ROCPROFSYS_BUILD_PYTHON) add_test( NAME ${SCRIPT_NAME}-console-script-test-${ARG_VERSION} COMMAND ${PROJECT_BINARY_DIR}/bin/${SCRIPT_NAME}-${ARG_VERSION} --help - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) set_tests_properties( ${SCRIPT_NAME}-console-script-test-${ARG_VERSION} - PROPERTIES LABELS "python;python-${ARG_VERSION};console-script") + PROPERTIES LABELS "python;python-${ARG_VERSION};console-script" + ) add_test( NAME ${SCRIPT_NAME}-generic-console-script-test-${ARG_VERSION} COMMAND ${PROJECT_BINARY_DIR}/bin/${SCRIPT_NAME} --help - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) set_tests_properties( ${SCRIPT_NAME}-generic-console-script-test-${ARG_VERSION} - PROPERTIES ENVIRONMENT "PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}" LABELS - "python;python-${ARG_VERSION};console-script") + PROPERTIES + ENVIRONMENT "PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}" + LABELS "python;python-${ARG_VERSION};console-script" + ) endif() else() set(PYTHON_EXECUTABLE "python3") - configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/console-script.in - ${PROJECT_BINARY_DIR}/bin/${SCRIPT_NAME} @ONLY) + configure_file( + ${PROJECT_SOURCE_DIR}/cmake/Templates/console-script.in + ${PROJECT_BINARY_DIR}/bin/${SCRIPT_NAME} + @ONLY + ) if(CMAKE_INSTALL_PYTHONDIR) install( PROGRAMS ${PROJECT_BINARY_DIR}/bin/${SCRIPT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT python - OPTIONAL) + OPTIONAL + ) endif() endif() endfunction() @@ -837,8 +909,12 @@ function(ROCPROFILER_SYSTEMS_BUILDTREE_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR set(_TPL_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX}) set(_TPL_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}) - foreach(_TAIL ${_TPL_SUFFIX} ${_TPL_SUFFIX}.${_TPL_SOVERSION} - ${_TPL_SUFFIX}.${_TPL_VERSION}) + foreach( + _TAIL + ${_TPL_SUFFIX} + ${_TPL_SUFFIX}.${_TPL_SOVERSION} + ${_TPL_SUFFIX}.${_TPL_VERSION} + ) set(_INP ${_TPL_PREFIX}${_TPL_NAME}${_TAIL}) set(_OUT ${_TPL_PREFIX}${_NEW_NAME}${_TAIL}) endforeach() @@ -847,7 +923,8 @@ function(ROCPROFILER_SYSTEMS_BUILDTREE_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR # build tree symbolic links add_custom_target( - ${_NEW_NAME}-build-tree-library${_TAIL} ALL + ${_NEW_NAME}-build-tree-library${_TAIL} + ALL ${CMAKE_COMMAND} -E create_symlink $ ${_TPL_PREFIX}${_NEW_NAME}${_TPL_SUFFIX}.${_TPL_VERSION} COMMAND @@ -860,7 +937,8 @@ function(ROCPROFILER_SYSTEMS_BUILDTREE_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR ${_BUILD_TREE_DIR}/${_TPL_PREFIX}${_NEW_NAME}${_TPL_SUFFIX} WORKING_DIRECTORY ${_BUILD_TREE_DIR} DEPENDS ${_TPL_TARGET} - COMMENT "Creating ${_NEW_NAME} from ${_TPL_TARGET}...") + COMMENT "Creating ${_NEW_NAME} from ${_TPL_TARGET}..." + ) endfunction() function(ROCPROFILER_SYSTEMS_INSTALL_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR _COMPONENT) @@ -870,29 +948,35 @@ function(ROCPROFILER_SYSTEMS_INSTALL_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR _ set(_TPL_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX}) set(_TPL_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}) - foreach(_TAIL ${_TPL_SUFFIX} ${_TPL_SUFFIX}.${_TPL_SOVERSION} - ${_TPL_SUFFIX}.${_TPL_VERSION}) + foreach( + _TAIL + ${_TPL_SUFFIX} + ${_TPL_SUFFIX}.${_TPL_SOVERSION} + ${_TPL_SUFFIX}.${_TPL_VERSION} + ) set(_INP ${_TPL_PREFIX}${_TPL_NAME}${_TAIL}) set(_OUT ${_TPL_PREFIX}${_NEW_NAME}${_TAIL}) endforeach() # build tree symbolic links rocprofiler_systems_buildtree_tpl("${_TPL_TARGET}" "${_NEW_NAME}" - "${_BUILD_TREE_DIR}" ${ARGN}) + "${_BUILD_TREE_DIR}" ${ARGN} + ) install( FILES $ DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_COMPONENT} - RENAME ${_TPL_PREFIX}${_NEW_NAME}${_TPL_SUFFIX}.${_TPL_VERSION}) + RENAME ${_TPL_PREFIX}${_NEW_NAME}${_TPL_SUFFIX}.${_TPL_VERSION} + ) install( FILES ${_BUILD_TREE_DIR}/${_TPL_PREFIX}${_NEW_NAME}${_TPL_SUFFIX}.${_TPL_SOVERSION} ${_BUILD_TREE_DIR}/${_TPL_PREFIX}${_NEW_NAME}${_TPL_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT ${_COMPONENT}) - + COMPONENT ${_COMPONENT} + ) endfunction() function(COMPUTE_POW2_CEIL _OUTPUT _VALUE) @@ -906,23 +990,17 @@ function(COMPUTE_POW2_CEIL _OUTPUT _VALUE) RESULT_VARIABLE _POW2_RET OUTPUT_VARIABLE _POW2_OUT ERROR_VARIABLE _POW2_ERR - OUTPUT_STRIP_TRAILING_WHITESPACE) + OUTPUT_STRIP_TRAILING_WHITESPACE + ) if(_POW2_RET EQUAL 0) - set(${_OUTPUT} - ${_POW2_OUT} - PARENT_SCOPE) + set(${_OUTPUT} ${_POW2_OUT} PARENT_SCOPE) else() - set(${_OUTPUT} - "-1" - PARENT_SCOPE) + set(${_OUTPUT} "-1" PARENT_SCOPE) endif() else() - set(${_OUTPUT} - "-1" - PARENT_SCOPE) + set(${_OUTPUT} "-1" PARENT_SCOPE) endif() - endfunction() cmake_policy(POP) diff --git a/projects/rocprofiler-systems/cmake/Modules/FindBoost.cmake b/projects/rocprofiler-systems/cmake/Modules/FindBoost.cmake index acf44b8ec9..ec7e36005c 100644 --- a/projects/rocprofiler-systems/cmake/Modules/FindBoost.cmake +++ b/projects/rocprofiler-systems/cmake/Modules/FindBoost.cmake @@ -258,10 +258,12 @@ function(_boost_get_existing_target component target_var) # handle pythonXY and numpyXY versioned components and also python X.Y, mpi_python # etc. list( - APPEND names "${CMAKE_MATCH_1}${CMAKE_MATCH_2}" # python + APPEND + names + "${CMAKE_MATCH_1}${CMAKE_MATCH_2}" # python "${CMAKE_MATCH_1}${CMAKE_MATCH_2}${CMAKE_MATCH_3}" # pythonX "${CMAKE_MATCH_1}${CMAKE_MATCH_2}${CMAKE_MATCH_3}${CMAKE_MATCH_4}" # pythonXY - ) + ) endif() # https://github.com/boost-cmake/boost-cmake uses boost::file_system etc. So handle # similar constructions of target names @@ -276,34 +278,26 @@ function(_boost_get_existing_target component target_var) if("${name}" MATCHES "^(python|numpy|mpi_python)([1-9])([0-9])$") set(name_nv "${CMAKE_MATCH_1}") if(TARGET "${prefix}::${name_nv}") - get_property( - type - TARGET "${prefix}::${name}" - PROPERTY TYPE) + get_property(type TARGET "${prefix}::${name}" PROPERTY TYPE) if(type STREQUAL "INTERFACE_LIBRARY") get_property( lib TARGET "${prefix}::${name}" - PROPERTY INTERFACE_LINK_LIBRARIES) + PROPERTY INTERFACE_LINK_LIBRARIES + ) if("${lib}" STREQUAL "${prefix}::${name_nv}") - set(${target_var} - "${prefix}::${name_nv}" - PARENT_SCOPE) + set(${target_var} "${prefix}::${name_nv}" PARENT_SCOPE) return() endif() endif() endif() endif() - set(${target_var} - "${prefix}::${name}" - PARENT_SCOPE) + set(${target_var} "${prefix}::${name}" PARENT_SCOPE) return() endif() endforeach() endforeach() - set(${target_var} - "" - PARENT_SCOPE) + set(${target_var} "" PARENT_SCOPE) endfunction() function(_boost_get_canonical_target_name component target_var) @@ -311,21 +305,15 @@ function(_boost_get_canonical_target_name component target_var) if(component MATCHES "^([a-z_]*)(python|numpy)([1-9])\\.?([0-9])?$") # handle pythonXY and numpyXY versioned components and also python X.Y, mpi_python # etc. - set(${target_var} - "Boost::${CMAKE_MATCH_1}${CMAKE_MATCH_2}" - PARENT_SCOPE) + set(${target_var} "Boost::${CMAKE_MATCH_1}${CMAKE_MATCH_2}" PARENT_SCOPE) else() - set(${target_var} - "Boost::${component}" - PARENT_SCOPE) + set(${target_var} "Boost::${component}" PARENT_SCOPE) endif() endfunction() macro(_boost_set_in_parent_scope name value) # Set a variable in parent scope and make it visibile in current scope - set(${name} - "${value}" - PARENT_SCOPE) + set(${name} "${value}" PARENT_SCOPE) set(${name} "${value}") endmacro() @@ -337,9 +325,7 @@ endmacro() macro(_boost_set_cache_if_unset name value) if(NOT ${name}) - set(${name} - "${value}" - CACHE STRING "" FORCE) + set(${name} "${value}" CACHE STRING "" FORCE) endif() endmacro() @@ -373,20 +359,18 @@ function(_boost_set_legacy_variables_from_config) if(Boost_DEBUG OR Boost_VERBOSE) message( WARNING - "Could not find imported target for required component '${comp}'. Legacy variables for this component might be missing. Refer to the documentation of your Boost installation for help on variables to use." - ) + "Could not find imported target for required component '${comp}'. Legacy variables for this component might be missing. Refer to the documentation of your Boost installation for help on variables to use." + ) endif() continue() endif() _boost_append_include_dir("${target}") _boost_set_if_unset(Boost_${uppercomp}_LIBRARY "${target}") _boost_set_if_unset( - Boost_${uppercomp}_LIBRARIES "${target}") # Very old legacy variable + Boost_${uppercomp}_LIBRARIES "${target}" + ) # Very old legacy variable list(APPEND libraries "${target}") - get_property( - type - TARGET "${target}" - PROPERTY TYPE) + get_property(type TARGET "${target}" PROPERTY TYPE) if(NOT type STREQUAL "INTERFACE_LIBRARY") foreach(cfg RELEASE DEBUG) get_target_property(lib ${target} IMPORTED_LOCATION_${cfg}) @@ -394,7 +378,8 @@ function(_boost_set_legacy_variables_from_config) get_filename_component(lib_dir "${lib}" DIRECTORY) list(APPEND library_dirs ${lib_dir}) _boost_set_cache_if_unset(Boost_${uppercomp}_LIBRARY_${cfg} - "${lib}") + "${lib}" + ) endif() endforeach() elseif(Boost_DEBUG OR Boost_VERBOSE) @@ -403,8 +388,8 @@ function(_boost_set_legacy_variables_from_config) if(NOT Boost_FIND_QUIETLY) message( WARNING - "Imported target '${target}' for required component '${comp}' has no artifact. Legacy variables for this component might be missing. Refer to the documentation of your Boost installation for help on variables to use." - ) + "Imported target '${target}' for required component '${comp}' has no artifact. Legacy variables for this component might be missing. Refer to the documentation of your Boost installation for help on variables to use." + ) endif() endif() _boost_get_canonical_target_name("${comp}" canonical_target) @@ -421,12 +406,14 @@ function(_boost_set_legacy_variables_from_config) _boost_set_if_unset(Boost_LIBRARIES "${libraries}") _boost_set_if_unset( Boost_VERSION_STRING - "${Boost_VERSION_MAJOR}.${Boost_VERSION_MINOR}.${Boost_VERSION_PATCH}") + "${Boost_VERSION_MAJOR}.${Boost_VERSION_MINOR}.${Boost_VERSION_PATCH}" + ) find_path( Boost_INCLUDE_DIR NAMES boost/version.hpp boost/config.hpp HINTS ${Boost_INCLUDE_DIRS} - NO_DEFAULT_PATH) + NO_DEFAULT_PATH + ) if(NOT Boost_VERSION_MACRO OR NOT Boost_LIB_VERSION) set(version_file ${Boost_INCLUDE_DIR}/boost/version.hpp) if(EXISTS "${version_file}") @@ -592,8 +579,11 @@ macro(_Boost_ADJUST_LIB_VARS basename) get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(_isMultiConfig OR CMAKE_BUILD_TYPE) set(Boost_${basename}_LIBRARY - optimized ${Boost_${basename}_LIBRARY_RELEASE} debug - ${Boost_${basename}_LIBRARY_DEBUG}) + optimized + ${Boost_${basename}_LIBRARY_RELEASE} + debug + ${Boost_${basename}_LIBRARY_DEBUG} + ) else() # For single-config generators where CMAKE_BUILD_TYPE has no value, just # use the release libraries @@ -601,8 +591,11 @@ macro(_Boost_ADJUST_LIB_VARS basename) endif() # FIXME: This probably should be set for both cases set(Boost_${basename}_LIBRARIES - optimized ${Boost_${basename}_LIBRARY_RELEASE} debug - ${Boost_${basename}_LIBRARY_DEBUG}) + optimized + ${Boost_${basename}_LIBRARY_RELEASE} + debug + ${Boost_${basename}_LIBRARY_DEBUG} + ) endif() # if only the release version was found, set the debug variable also to the @@ -622,8 +615,11 @@ macro(_Boost_ADJUST_LIB_VARS basename) endif() # If the debug & release library ends up being the same, omit the keywords - if("${Boost_${basename}_LIBRARY_RELEASE}" STREQUAL - "${Boost_${basename}_LIBRARY_DEBUG}") + if( + "${Boost_${basename}_LIBRARY_RELEASE}" + STREQUAL + "${Boost_${basename}_LIBRARY_DEBUG}" + ) set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE}) set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE}) endif() @@ -635,7 +631,6 @@ macro(_Boost_ADJUST_LIB_VARS basename) set(Boost_THREAD_FOUND OFF) endif() endif() - endif() # Make variables changeable to the advanced user mark_as_advanced(Boost_${basename}_LIBRARY_RELEASE Boost_${basename}_LIBRARY_DEBUG) @@ -672,7 +667,6 @@ endmacro() # RELEASE or DEBUG builds # macro(_Boost_FIND_LIBRARY var build_type) - find_library(${var} ${ARGN}) if(${var}) @@ -681,7 +675,10 @@ macro(_Boost_FIND_LIBRARY var build_type) get_filename_component(_dir "${${var}}" PATH) set(Boost_LIBRARY_DIR_${build_type} "${_dir}" - CACHE PATH "Boost library directory ${build_type}" FORCE) + CACHE PATH + "Boost library directory ${build_type}" + FORCE + ) endif() elseif(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) # Try component-specific hints but do not save Boost_LIBRARY_DIR_[RELEASE,DEBUG]. @@ -691,36 +688,50 @@ macro(_Boost_FIND_LIBRARY var build_type) # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is known then search only there. if(Boost_LIBRARY_DIR_${build_type}) set(_boost_LIBRARY_SEARCH_DIRS_${build_type} - ${Boost_LIBRARY_DIR_${build_type}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + ${Boost_LIBRARY_DIR_${build_type}} + NO_DEFAULT_PATH + NO_CMAKE_FIND_ROOT_PATH + ) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "Boost_LIBRARY_DIR_${build_type}") + "Boost_LIBRARY_DIR_${build_type}" + ) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "_boost_LIBRARY_SEARCH_DIRS_${build_type}") + "_boost_LIBRARY_SEARCH_DIRS_${build_type}" + ) endif() endmacro() # ------------------------------------------------------------------------------- # Convert CMAKE_CXX_COMPILER_VERSION to boost compiler suffix version. -function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION _OUTPUT_VERSION_MAJOR - _OUTPUT_VERSION_MINOR) - string(REGEX REPLACE "([0-9]+)\\.([0-9]+)(\\.[0-9]+)?" "\\1" - _boost_COMPILER_VERSION_MAJOR "${CMAKE_CXX_COMPILER_VERSION}") - string(REGEX REPLACE "([0-9]+)\\.([0-9]+)(\\.[0-9]+)?" "\\2" - _boost_COMPILER_VERSION_MINOR "${CMAKE_CXX_COMPILER_VERSION}") +function( + _Boost_COMPILER_DUMPVERSION + _OUTPUT_VERSION + _OUTPUT_VERSION_MAJOR + _OUTPUT_VERSION_MINOR +) + string( + REGEX REPLACE + "([0-9]+)\\.([0-9]+)(\\.[0-9]+)?" + "\\1" + _boost_COMPILER_VERSION_MAJOR + "${CMAKE_CXX_COMPILER_VERSION}" + ) + string( + REGEX REPLACE + "([0-9]+)\\.([0-9]+)(\\.[0-9]+)?" + "\\2" + _boost_COMPILER_VERSION_MINOR + "${CMAKE_CXX_COMPILER_VERSION}" + ) set(_boost_COMPILER_VERSION - "${_boost_COMPILER_VERSION_MAJOR}${_boost_COMPILER_VERSION_MINOR}") + "${_boost_COMPILER_VERSION_MAJOR}${_boost_COMPILER_VERSION_MINOR}" + ) - set(${_OUTPUT_VERSION} - ${_boost_COMPILER_VERSION} - PARENT_SCOPE) - set(${_OUTPUT_VERSION_MAJOR} - ${_boost_COMPILER_VERSION_MAJOR} - PARENT_SCOPE) - set(${_OUTPUT_VERSION_MINOR} - ${_boost_COMPILER_VERSION_MINOR} - PARENT_SCOPE) + set(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE) + set(${_OUTPUT_VERSION_MAJOR} ${_boost_COMPILER_VERSION_MAJOR} PARENT_SCOPE) + set(${_OUTPUT_VERSION_MINOR} ${_boost_COMPILER_VERSION_MINOR} PARENT_SCOPE) endfunction() # @@ -729,11 +740,14 @@ endfunction() # function(_Boost_PREPEND_LIST_WITH_THREADAPI _output) set(_orig_libnames ${ARGN}) - string(REPLACE "thread" "thread_${Boost_THREADAPI}" _threadapi_libnames - "${_orig_libnames}") - set(${_output} - ${_threadapi_libnames} ${_orig_libnames} - PARENT_SCOPE) + string( + REPLACE + "thread" + "thread_${Boost_THREADAPI}" + _threadapi_libnames + "${_orig_libnames}" + ) + set(${_output} ${_threadapi_libnames} ${_orig_libnames} PARENT_SCOPE) endfunction() # @@ -743,9 +757,7 @@ function(_Boost_SWAP_WITH_REALPATH _library _docstring) if(${_library}) get_filename_component(_boost_filepathreal ${${_library}} REALPATH) unset(${_library} CACHE) - set(${_library} - ${_boost_filepathreal} - CACHE FILEPATH "${_docstring}") + set(${_library} ${_boost_filepathreal} CACHE FILEPATH "${_docstring}") endif() endfunction() @@ -754,8 +766,8 @@ function(_Boost_CHECK_SPELLING _var) string(TOUPPER ${_var} _var_UC) message( FATAL_ERROR - "ERROR: ${_var} is not the correct spelling. The proper spelling is ${_var_UC}." - ) + "ERROR: ${_var} is not the correct spelling. The proper spelling is ${_var_UC}." + ) endif() endfunction() @@ -770,8 +782,10 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) endif() elseif(GHSMULTI) set(_boost_COMPILER "-ghs") - elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC" OR "x${CMAKE_CXX_SIMULATE_ID}" - STREQUAL "xMSVC") + elseif( + "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC" + OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC" + ) if(MSVC_TOOLSET_VERSION GREATER_EQUAL 150) # Not yet known. set(_boost_COMPILER "") @@ -789,7 +803,8 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) 3 2 1 - 0) + 0 + ) if(MSVC_TOOLSET_VERSION GREATER_EQUAL 14${v}) list(APPEND _boost_COMPILER "-vc14${v}") endif() @@ -821,21 +836,27 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) else() _boost_compiler_dumpversion( _boost_COMPILER_VERSION _boost_COMPILER_VERSION_MAJOR - _boost_COMPILER_VERSION_MINOR) + _boost_COMPILER_VERSION_MINOR + ) set(_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}") endif() elseif(UNIX) _boost_compiler_dumpversion(_boost_COMPILER_VERSION _boost_COMPILER_VERSION_MAJOR - _boost_COMPILER_VERSION_MINOR) + _boost_COMPILER_VERSION_MINOR + ) if(NOT Boost_VERSION_STRING VERSION_LESS 1.69.0) # From GCC 5 and clang 4, versioning changes and minor becomes patch. For # those compilers, patch is exclude from compiler tag in Boost 1.69+ library # naming. - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND _boost_COMPILER_VERSION_MAJOR - VERSION_GREATER 4) + if( + CMAKE_CXX_COMPILER_ID STREQUAL "GNU" + AND _boost_COMPILER_VERSION_MAJOR VERSION_GREATER 4 + ) set(_boost_COMPILER_VERSION "${_boost_COMPILER_VERSION_MAJOR}") - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" - AND _boost_COMPILER_VERSION_MAJOR VERSION_GREATER 3) + elseif( + CMAKE_CXX_COMPILER_ID STREQUAL "Clang" + AND _boost_COMPILER_VERSION_MAJOR VERSION_GREATER 3 + ) set(_boost_COMPILER_VERSION "${_boost_COMPILER_VERSION_MAJOR}") endif() endif() @@ -867,10 +888,9 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) set(_boost_COMPILER "") endif() _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "_boost_COMPILER" SOURCE "guessed") - set(${_ret} - ${_boost_COMPILER} - PARENT_SCOPE) + "_boost_COMPILER" SOURCE "guessed" + ) + set(${_ret} ${_boost_COMPILER} PARENT_SCOPE) endfunction() # @@ -925,8 +945,8 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) if(NOT Boost_FIND_QUIETLY) message( WARNING - "Imported targets and dependency information not available for Boost version ${Boost_VERSION_STRING} (all versions older than 1.33)" - ) + "Imported targets and dependency information not available for Boost version ${Boost_VERSION_STRING} (all versions older than 1.33)" + ) endif() set(_Boost_IMPORTED_TARGETS FALSE) elseif(Boost_VERSION_STRING VERSION_LESS 1.35.0) @@ -938,205 +958,459 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_WAVE_DEPENDENCIES filesystem system thread) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.38.0) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_WAVE_DEPENDENCIES filesystem system thread) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.43.0) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_THREAD_DEPENDENCIES date_time) set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.44.0) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l random) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + random + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_THREAD_DEPENDENCIES date_time) set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.45.0) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l random serialization) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + random + serialization + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_THREAD_DEPENDENCIES date_time) - set(_Boost_WAVE_DEPENDENCIES serialization filesystem system thread date_time) + set(_Boost_WAVE_DEPENDENCIES + serialization + filesystem + system + thread + date_time + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.47.0) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l random) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + random + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_THREAD_DEPENDENCIES date_time) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) + set(_Boost_WAVE_DEPENDENCIES + filesystem + system + serialization + thread + date_time + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.48.0) set(_Boost_CHRONO_DEPENDENCIES system) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l random) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + random + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_THREAD_DEPENDENCIES date_time) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) + set(_Boost_WAVE_DEPENDENCIES + filesystem + system + serialization + thread + date_time + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.50.0) set(_Boost_CHRONO_DEPENDENCIES system) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l random) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + random + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_THREAD_DEPENDENCIES date_time) set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) + set(_Boost_WAVE_DEPENDENCIES + filesystem + system + serialization + thread + date_time + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.53.0) set(_Boost_CHRONO_DEPENDENCIES system) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l regex random) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + regex + random + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_THREAD_DEPENDENCIES chrono system date_time) set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono - date_time) + set(_Boost_WAVE_DEPENDENCIES + filesystem + system + serialization + thread + chrono + date_time + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.54.0) set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time) set(_Boost_CHRONO_DEPENDENCIES system) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l regex random) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + regex + random + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono - date_time) + set(_Boost_WAVE_DEPENDENCIES + filesystem + system + serialization + thread + chrono + date_time + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.55.0) set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time) set(_Boost_CHRONO_DEPENDENCIES system) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread - regex chrono) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l regex random) + set(_Boost_LOG_DEPENDENCIES + log_setup + date_time + system + filesystem + thread + regex + chrono + ) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + regex + random + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono - date_time atomic) + set(_Boost_WAVE_DEPENDENCIES + filesystem + system + serialization + thread + chrono + date_time + atomic + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.56.0) set(_Boost_CHRONO_DEPENDENCIES system) set(_Boost_COROUTINE_DEPENDENCIES context system) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread - regex chrono) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l regex random) + set(_Boost_LOG_DEPENDENCIES + log_setup + date_time + system + filesystem + thread + regex + chrono + ) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + regex + random + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono - date_time atomic) + set(_Boost_WAVE_DEPENDENCIES + filesystem + system + serialization + thread + chrono + date_time + atomic + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.59.0) set(_Boost_CHRONO_DEPENDENCIES system) set(_Boost_COROUTINE_DEPENDENCIES context system) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread - regex chrono) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l atomic) + set(_Boost_LOG_DEPENDENCIES + log_setup + date_time + system + filesystem + thread + regex + chrono + ) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + atomic + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_RANDOM_DEPENDENCIES system) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono - date_time atomic) + set(_Boost_WAVE_DEPENDENCIES + filesystem + system + serialization + thread + chrono + date_time + atomic + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.60.0) set(_Boost_CHRONO_DEPENDENCIES system) set(_Boost_COROUTINE_DEPENDENCIES context system) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread - regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l atomic) + set(_Boost_LOG_DEPENDENCIES + log_setup + date_time + system + filesystem + thread + regex + chrono + atomic + ) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + atomic + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_RANDOM_DEPENDENCIES system) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono - date_time atomic) + set(_Boost_WAVE_DEPENDENCIES + filesystem + system + serialization + thread + chrono + date_time + atomic + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.61.0) set(_Boost_CHRONO_DEPENDENCIES system) set(_Boost_COROUTINE_DEPENDENCIES context system) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread - regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l atomic) + set(_Boost_LOG_DEPENDENCIES + date_time + log_setup + system + filesystem + thread + regex + chrono + atomic + ) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + atomic + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_RANDOM_DEPENDENCIES system) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono - date_time atomic) + set(_Boost_WAVE_DEPENDENCIES + filesystem + system + serialization + thread + chrono + date_time + atomic + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.62.0) set(_Boost_CHRONO_DEPENDENCIES system) @@ -1144,215 +1418,495 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_COROUTINE_DEPENDENCIES context system) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread - regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l atomic) + set(_Boost_LOG_DEPENDENCIES + date_time + log_setup + system + filesystem + thread + regex + chrono + atomic + ) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + atomic + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_RANDOM_DEPENDENCIES system) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono - date_time atomic) + set(_Boost_WAVE_DEPENDENCIES + filesystem + system + serialization + thread + chrono + date_time + atomic + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.63.0) set(_Boost_CHRONO_DEPENDENCIES system) set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) + set(_Boost_FIBER_DEPENDENCIES + context + thread + chrono + system + date_time + ) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread - regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l atomic) + set(_Boost_LOG_DEPENDENCIES + date_time + log_setup + system + filesystem + thread + regex + chrono + atomic + ) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + atomic + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_RANDOM_DEPENDENCIES system) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono - date_time atomic) + set(_Boost_WAVE_DEPENDENCIES + filesystem + system + serialization + thread + chrono + date_time + atomic + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.65.0) set(_Boost_CHRONO_DEPENDENCIES system) set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_COROUTINE2_DEPENDENCIES context fiber thread chrono system - date_time) - set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) + set(_Boost_COROUTINE2_DEPENDENCIES + context + fiber + thread + chrono + system + date_time + ) + set(_Boost_FIBER_DEPENDENCIES + context + thread + chrono + system + date_time + ) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread - regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l atomic) + set(_Boost_LOG_DEPENDENCIES + date_time + log_setup + system + filesystem + thread + regex + chrono + atomic + ) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + atomic + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_RANDOM_DEPENDENCIES system) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono - date_time atomic) + set(_Boost_WAVE_DEPENDENCIES + filesystem + system + serialization + thread + chrono + date_time + atomic + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.67.0) set(_Boost_CHRONO_DEPENDENCIES system) set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) + set(_Boost_FIBER_DEPENDENCIES + context + thread + chrono + system + date_time + ) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread - regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l atomic) + set(_Boost_LOG_DEPENDENCIES + date_time + log_setup + system + filesystem + thread + regex + chrono + atomic + ) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + atomic + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) set(_Boost_RANDOM_DEPENDENCIES system) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono - date_time atomic) + set(_Boost_WAVE_DEPENDENCIES + filesystem + system + serialization + thread + chrono + date_time + atomic + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.68.0) set(_Boost_CHRONO_DEPENDENCIES system) set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) + set(_Boost_FIBER_DEPENDENCIES + context + thread + chrono + system + date_time + ) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread - regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l atomic) + set(_Boost_LOG_DEPENDENCIES + date_time + log_setup + system + filesystem + thread + regex + chrono + atomic + ) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + atomic + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) set(_Boost_RANDOM_DEPENDENCIES system) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono - date_time atomic) + set(_Boost_WAVE_DEPENDENCIES + filesystem + system + serialization + thread + chrono + date_time + atomic + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.69.0) set(_Boost_CHRONO_DEPENDENCIES system) set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) set(_Boost_CONTRACT_DEPENDENCIES thread chrono system date_time) set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) + set(_Boost_FIBER_DEPENDENCIES + context + thread + chrono + system + date_time + ) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread - regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l atomic) + set(_Boost_LOG_DEPENDENCIES + date_time + log_setup + system + filesystem + thread + regex + chrono + atomic + ) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + atomic + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) set(_Boost_RANDOM_DEPENDENCIES system) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono - date_time atomic) + set(_Boost_WAVE_DEPENDENCIES + filesystem + system + serialization + thread + chrono + date_time + atomic + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.70.0) set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) set(_Boost_COROUTINE_DEPENDENCIES context) set(_Boost_FIBER_DEPENDENCIES context) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex - chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l atomic) + set(_Boost_LOG_DEPENDENCIES + date_time + log_setup + filesystem + thread + regex + chrono + atomic + ) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + atomic + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time - atomic) + set(_Boost_WAVE_DEPENDENCIES + filesystem + serialization + thread + chrono + date_time + atomic + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.72.0) set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) set(_Boost_COROUTINE_DEPENDENCIES context) set(_Boost_FIBER_DEPENDENCIES context) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex - chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l atomic) + set(_Boost_LOG_DEPENDENCIES + date_time + log_setup + filesystem + thread + regex + chrono + atomic + ) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + atomic + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) set(_Boost_TIMER_DEPENDENCIES chrono) - set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time - atomic) + set(_Boost_WAVE_DEPENDENCIES + filesystem + serialization + thread + chrono + date_time + atomic + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(Boost_VERSION_STRING VERSION_LESS 1.73.0) set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) set(_Boost_COROUTINE_DEPENDENCIES context) set(_Boost_FIBER_DEPENDENCIES context) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex - chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l chrono atomic) + set(_Boost_LOG_DEPENDENCIES + date_time + log_setup + filesystem + thread + regex + chrono + atomic + ) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + chrono + atomic + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) set(_Boost_TIMER_DEPENDENCIES chrono) - set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time - atomic) + set(_Boost_WAVE_DEPENDENCIES + filesystem + serialization + thread + chrono + date_time + atomic + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) else() set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) set(_Boost_COROUTINE_DEPENDENCIES context) set(_Boost_FIBER_DEPENDENCIES context) set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex - chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f - math_tr1l atomic) + set(_Boost_LOG_DEPENDENCIES + date_time + log_setup + filesystem + thread + regex + chrono + atomic + ) + set(_Boost_MATH_DEPENDENCIES + math_c99 + math_c99f + math_c99l + math_tr1 + math_tr1f + math_tr1l + atomic + ) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi - serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES + python${component_python_version} + mpi + serialization + ) set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) set(_Boost_TIMER_DEPENDENCIES chrono) - set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time - atomic) + set(_Boost_WAVE_DEPENDENCIES + filesystem + serialization + thread + chrono + date_time + atomic + ) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.74.0) if(NOT Boost_FIND_QUIETLY) message( WARNING - "New Boost version may have incorrect or missing dependencies and imported targets" - ) + "New Boost version may have incorrect or missing dependencies and imported targets" + ) endif() endif() endif() endif() string(TOUPPER ${component} uppercomponent) - set(${_ret} - ${_Boost_${uppercomponent}_DEPENDENCIES} - PARENT_SCOPE) - set(_Boost_IMPORTED_TARGETS - ${_Boost_IMPORTED_TARGETS} - PARENT_SCOPE) + set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) + set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE) - string(REGEX REPLACE ";" " " _boost_DEPS_STRING - "${_Boost_${uppercomponent}_DEPENDENCIES}") + string( + REGEX REPLACE + ";" + " " + _boost_DEPS_STRING + "${_Boost_${uppercomponent}_DEPENDENCIES}" + ) if(NOT _boost_DEPS_STRING) set(_boost_DEPS_STRING "(none)") endif() @@ -1433,9 +1987,7 @@ function(_Boost_COMPONENT_HEADERS component _hdrs) endif() string(TOUPPER ${component} uppercomponent) - set(${_hdrs} - ${_Boost_${uppercomponent}_HEADERS} - PARENT_SCOPE) + set(${_hdrs} ${_Boost_${uppercomponent}_HEADERS} PARENT_SCOPE) string(REGEX REPLACE ";" " " _boost_HDRS_STRING "${_Boost_${uppercomponent}_HEADERS}") if(NOT _boost_HDRS_STRING) @@ -1465,20 +2017,22 @@ function(_Boost_MISSING_DEPENDENCIES componentvar extravar) list(APPEND _boost_processed_components ${_boost_unprocessed_components}) foreach(component ${_boost_unprocessed_components}) string(TOUPPER ${component} uppercomponent) - set(${_ret} - ${_Boost_${uppercomponent}_DEPENDENCIES} - PARENT_SCOPE) + set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) _boost_component_dependencies("${component}" - _Boost_${uppercomponent}_DEPENDENCIES) + _Boost_${uppercomponent}_DEPENDENCIES + ) set(_Boost_${uppercomponent}_DEPENDENCIES ${_Boost_${uppercomponent}_DEPENDENCIES} - PARENT_SCOPE) - set(_Boost_IMPORTED_TARGETS - ${_Boost_IMPORTED_TARGETS} - PARENT_SCOPE) + PARENT_SCOPE + ) + set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE) foreach(componentdep ${_Boost_${uppercomponent}_DEPENDENCIES}) - if(NOT ("${componentdep}" IN_LIST _boost_processed_components - OR "${componentdep}" IN_LIST _boost_new_components)) + if( + NOT ( + "${componentdep}" IN_LIST _boost_processed_components + OR "${componentdep}" IN_LIST _boost_new_components + ) + ) list(APPEND _boost_new_components ${componentdep}) endif() endforeach() @@ -1490,12 +2044,8 @@ function(_Boost_MISSING_DEPENDENCIES componentvar extravar) if(_boost_extra_components AND ${componentvar}) list(REMOVE_ITEM _boost_extra_components ${${componentvar}}) endif() - set(${componentvar} - ${_boost_processed_components} - PARENT_SCOPE) - set(${extravar} - ${_boost_extra_components} - PARENT_SCOPE) + set(${componentvar} ${_boost_processed_components} PARENT_SCOPE) + set(${extravar} ${_boost_extra_components} PARENT_SCOPE) endfunction() # @@ -1523,7 +2073,8 @@ function(_Boost_COMPILER_FEATURES component _ret) cxx_nullptr cxx_rvalue_references cxx_thread_local - cxx_variadic_templates) + cxx_variadic_templates + ) # Compiler feature for `context` same as for `fiber`. set(_Boost_CONTEXT_COMPILER_FEATURES ${_Boost_FIBER_COMPILER_FEATURES}) endif() @@ -1535,9 +2086,7 @@ function(_Boost_COMPILER_FEATURES component _ret) endif() string(TOUPPER ${component} uppercomponent) - set(${_ret} - ${_Boost_${uppercomponent}_COMPILER_FEATURES} - PARENT_SCOPE) + set(${_ret} ${_Boost_${uppercomponent}_COMPILER_FEATURES} PARENT_SCOPE) endfunction() # @@ -1549,8 +2098,11 @@ endfunction() # function would append corresponding directories if MSVC is a current compiler, so having # `BOOST_ROOT` would be enough to specify to find everything. # -function(_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS componentlibvar - basedir) +function( + _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS + componentlibvar + basedir +) if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(_arch_suffix 64) @@ -1572,20 +2124,25 @@ function(_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS component 3 2 1 - 0) + 0 + ) if(MSVC_TOOLSET_VERSION GREATER_EQUAL 14${v}) - list(APPEND ${componentlibvar} - ${basedir}/lib${_arch_suffix}-msvc-14.${v}) + list( + APPEND + ${componentlibvar} + ${basedir}/lib${_arch_suffix}-msvc-14.${v} + ) endif() endforeach() elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 80) math(EXPR _toolset_major_version "${MSVC_TOOLSET_VERSION} / 10") - list(APPEND ${componentlibvar} - ${basedir}/lib${_arch_suffix}-msvc-${_toolset_major_version}.0) + list( + APPEND + ${componentlibvar} + ${basedir}/lib${_arch_suffix}-msvc-${_toolset_major_version}.0 + ) endif() - set(${componentlibvar} - ${${componentlibvar}} - PARENT_SCOPE) + set(${componentlibvar} ${${componentlibvar}} PARENT_SCOPE) endif() endfunction() @@ -1623,8 +2180,8 @@ endif() if(Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR) message( SEND_ERROR - "When requesting a specific version of Boost, you must provide at least the major and minor version numbers, e.g., 1.34" - ) + "When requesting a specific version of Boost, you must provide at least the major and minor version numbers, e.g., 1.34" + ) endif() if(Boost_FIND_VERSION_EXACT) @@ -1632,7 +2189,8 @@ if(Boost_FIND_VERSION_EXACT) # patch level is non-zero. set(_boost_TEST_VERSIONS "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}" - "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") + "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}" + ) else() # The user has not requested an exact version. Among known versions, find those that # are acceptable to the user request. @@ -1727,12 +2285,14 @@ else() "1.34" "1.33.1" "1.33.0" - "1.33") + "1.33" + ) set(_boost_TEST_VERSIONS) if(Boost_FIND_VERSION) set(_Boost_FIND_VERSION_SHORT - "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") + "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}" + ) # Select acceptable versions. foreach(version ${_Boost_KNOWN_VERSIONS}) if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}") @@ -1751,17 +2311,23 @@ else() endif() _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "_boost_TEST_VERSIONS") + "_boost_TEST_VERSIONS" +) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "Boost_USE_MULTITHREADED") + "Boost_USE_MULTITHREADED" +) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "Boost_USE_STATIC_LIBS") + "Boost_USE_STATIC_LIBS" +) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "Boost_USE_STATIC_RUNTIME") + "Boost_USE_STATIC_RUNTIME" +) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "Boost_ADDITIONAL_VERSIONS") + "Boost_ADDITIONAL_VERSIONS" +) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "Boost_NO_SYSTEM_PATHS") + "Boost_NO_SYSTEM_PATHS" +) cmake_policy(GET CMP0074 _Boost_CMP0074) if(NOT "x${_Boost_CMP0074}x" STREQUAL "xNEWx") @@ -1791,17 +2357,23 @@ endif() set(_Boost_VARS_DIR BOOST_ROOT Boost_NO_SYSTEM_PATHS) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "BOOST_ROOT") + "BOOST_ROOT" +) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "BOOST_ROOT" ENVIRONMENT) + "BOOST_ROOT" ENVIRONMENT +) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "BOOST_INCLUDEDIR") + "BOOST_INCLUDEDIR" +) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "BOOST_INCLUDEDIR" ENVIRONMENT) + "BOOST_INCLUDEDIR" ENVIRONMENT +) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "BOOST_LIBRARYDIR") + "BOOST_LIBRARYDIR" +) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "BOOST_LIBRARYDIR" ENVIRONMENT) + "BOOST_LIBRARYDIR" ENVIRONMENT +) # ------------------------------------------------------------------------ # Search for Boost include DIR @@ -1826,13 +2398,21 @@ if(NOT Boost_INCLUDE_DIR) if(BOOST_ROOT) list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_ROOT}/include ${BOOST_ROOT}) elseif(_ENV_BOOST_ROOT) - list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_ROOT}/include - ${_ENV_BOOST_ROOT}) + list( + APPEND + _boost_INCLUDE_SEARCH_DIRS + ${_ENV_BOOST_ROOT}/include + ${_ENV_BOOST_ROOT} + ) endif() if(Boost_NO_SYSTEM_PATHS) - list(APPEND _boost_INCLUDE_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH - NO_SYSTEM_ENVIRONMENT_PATH) + list( + APPEND + _boost_INCLUDE_SEARCH_DIRS + NO_CMAKE_SYSTEM_PATH + NO_SYSTEM_ENVIRONMENT_PATH + ) else() if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") foreach(ver ${_boost_TEST_VERSIONS}) @@ -1840,8 +2420,14 @@ if(NOT Boost_INCLUDE_DIR) list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS "C:/local/boost_${ver}") endforeach() endif() - list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS C:/boost/include C:/boost - /sw/local/include) + list( + APPEND + _boost_INCLUDE_SEARCH_DIRS + PATHS + C:/boost/include + C:/boost + /sw/local/include + ) endif() # Try to find Boost by stepping backwards through the Boost versions we know about. @@ -1855,7 +2441,8 @@ if(NOT Boost_INCLUDE_DIR) # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0 if(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)") set(_boost_BOOSTIFIED_VERSION - "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}_${CMAKE_MATCH_3}") + "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}_${CMAKE_MATCH_3}" + ) elseif(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)") set(_boost_BOOSTIFIED_VERSION "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}") endif() @@ -1866,21 +2453,24 @@ if(NOT Boost_INCLUDE_DIR) "boost-${_boost_BOOSTIFIED_VERSION}" "boost_${_boost_BOOSTIFIED_VERSION}" "boost/boost-${_boost_BOOSTIFIED_VERSION}" - "boost/boost_${_boost_BOOSTIFIED_VERSION}") - + "boost/boost_${_boost_BOOSTIFIED_VERSION}" + ) endforeach() _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "_boost_INCLUDE_SEARCH_DIRS") + "_boost_INCLUDE_SEARCH_DIRS" + ) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "_boost_PATH_SUFFIXES") + "_boost_PATH_SUFFIXES" + ) # Look for a standard boost header file. find_path( Boost_INCLUDE_DIR NAMES boost/config.hpp HINTS ${_boost_INCLUDE_SEARCH_DIRS} - PATH_SUFFIXES ${_boost_PATH_SUFFIXES}) + PATH_SUFFIXES ${_boost_PATH_SUFFIXES} + ) endif() # ------------------------------------------------------------------------ @@ -1889,13 +2479,18 @@ endif() if(Boost_INCLUDE_DIR) _boost_debug_print("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp") + "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp" + ) # Extract Boost_VERSION_MACRO and Boost_LIB_VERSION from version.hpp set(Boost_VERSION_MACRO 0) set(Boost_LIB_VERSION "") - file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS - REGEX "#define BOOST_(LIB_)?VERSION ") + file( + STRINGS + "${Boost_INCLUDE_DIR}/boost/version.hpp" + _boost_VERSION_HPP_CONTENTS + REGEX "#define BOOST_(LIB_)?VERSION " + ) if("${_boost_VERSION_HPP_CONTENTS}" MATCHES "#define BOOST_VERSION ([0-9]+)") set(Boost_VERSION_MACRO "${CMAKE_MATCH_1}") endif() @@ -1917,14 +2512,18 @@ if(Boost_INCLUDE_DIR) # Define Boost version in x.y.z format set(Boost_VERSION_STRING - "${Boost_VERSION_MAJOR}.${Boost_VERSION_MINOR}.${Boost_VERSION_PATCH}") + "${Boost_VERSION_MAJOR}.${Boost_VERSION_MINOR}.${Boost_VERSION_PATCH}" + ) if(NOT CMAKE_VERSION VERSION_LESS 3.15) # Define final Boost_VERSION cmake_policy( - GET CMP0093 _Boost_CMP0093 PARENT_SCOPE # undocumented, do not use outside of - # CMake - ) + GET + CMP0093 + _Boost_CMP0093 + PARENT_SCOPE # undocumented, do not use outside of + # CMake + ) if("x${_Boost_CMP0093}x" STREQUAL "xNEWx") set(Boost_VERSION ${Boost_VERSION_STRING}) else() @@ -1934,19 +2533,26 @@ if(Boost_INCLUDE_DIR) endif() _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "Boost_VERSION") + "Boost_VERSION" + ) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "Boost_VERSION_STRING") + "Boost_VERSION_STRING" + ) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "Boost_VERSION_MACRO") + "Boost_VERSION_MACRO" + ) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "Boost_VERSION_MAJOR") + "Boost_VERSION_MAJOR" + ) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "Boost_VERSION_MINOR") + "Boost_VERSION_MINOR" + ) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "Boost_VERSION_PATCH") + "Boost_VERSION_PATCH" + ) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "Boost_VERSION_COUNT") + "Boost_VERSION_COUNT" + ) endif() # ------------------------------------------------------------------------ @@ -1954,10 +2560,10 @@ endif() # ------------------------------------------------------------------------ set(Boost_LIB_PREFIX "") -if((GHSMULTI AND Boost_USE_STATIC_LIBS) - OR (WIN32 - AND Boost_USE_STATIC_LIBS - AND NOT CYGWIN)) +if( + (GHSMULTI AND Boost_USE_STATIC_LIBS) + OR (WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) +) set(Boost_LIB_PREFIX "lib") endif() @@ -1966,9 +2572,11 @@ if(NOT Boost_NAMESPACE) endif() _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "Boost_LIB_PREFIX") + "Boost_LIB_PREFIX" +) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "Boost_NAMESPACE") + "Boost_NAMESPACE" +) # ------------------------------------------------------------------------ # Suffix initialization and compiler suffix detection. @@ -1983,14 +2591,16 @@ set(_Boost_VARS_NAME Boost_USE_STATIC_LIBS Boost_USE_STATIC_RUNTIME Boost_USE_STLPORT - Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS) + Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS +) _boost_change_detect(_Boost_CHANGE_LIBNAME ${_Boost_VARS_NAME}) # Setting some more suffixes for the library if(Boost_COMPILER) set(_boost_COMPILER ${Boost_COMPILER}) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "_boost_COMPILER" SOURCE "user-specified via Boost_COMPILER") + "_boost_COMPILER" SOURCE "user-specified via Boost_COMPILER" + ) else() # Attempt to guess the compiler suffix NOTE: this is not perfect yet, if you # experience any issues please report them and use the Boost_COMPILER variable to work @@ -2003,7 +2613,8 @@ if(NOT Boost_USE_MULTITHREADED) set(_boost_MULTITHREADED "") endif() _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "_boost_MULTITHREADED") + "_boost_MULTITHREADED" +) # ====================== # Systematically build up the Boost ABI tag for the 'tagged' and 'versioned' layouts @@ -2021,9 +2632,11 @@ if(Boost_USE_STATIC_RUNTIME) endif() # g using debug versions of the standard and runtime support libraries if(WIN32 AND Boost_USE_DEBUG_RUNTIME) - if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC" - OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang" - OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntel") + if( + "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC" + OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang" + OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntel" + ) string(APPEND _boost_DEBUG_ABI_TAG "g") endif() endif() @@ -2052,19 +2665,24 @@ if(DEFINED Boost_ARCHITECTURE) set(_boost_ARCHITECTURE_TAG "${Boost_ARCHITECTURE}") _boost_debug_print_var( "${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "_boost_ARCHITECTURE_TAG" SOURCE "user-specified via Boost_ARCHITECTURE") + "_boost_ARCHITECTURE_TAG" SOURCE "user-specified via Boost_ARCHITECTURE" + ) else() set(_boost_ARCHITECTURE_TAG "") # {CMAKE_CXX_COMPILER_ARCHITECTURE_ID} is not currently set for all compilers - if(NOT "x${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "x" - AND NOT Boost_VERSION_STRING VERSION_LESS 1.66.0) + if( + NOT "x${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "x" + AND NOT Boost_VERSION_STRING VERSION_LESS 1.66.0 + ) string(APPEND _boost_ARCHITECTURE_TAG "-") # This needs to be kept in-sync with the section of CMakePlatformId.h.in inside # 'defined(_WIN32) && defined(_MSC_VER)' if(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "IA64") string(APPEND _boost_ARCHITECTURE_TAG "i") - elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "X86" - OR CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "x64") + elseif( + CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "X86" + OR CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "x64" + ) string(APPEND _boost_ARCHITECTURE_TAG "x") elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID MATCHES "^ARM") string(APPEND _boost_ARCHITECTURE_TAG "a") @@ -2079,13 +2697,16 @@ else() endif() endif() _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "_boost_ARCHITECTURE_TAG" SOURCE "detected") + "_boost_ARCHITECTURE_TAG" SOURCE "detected" + ) endif() _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "_boost_RELEASE_ABI_TAG") + "_boost_RELEASE_ABI_TAG" +) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "_boost_DEBUG_ABI_TAG") + "_boost_DEBUG_ABI_TAG" +) # ------------------------------------------------------------------------ # Begin finding boost libraries @@ -2096,7 +2717,8 @@ foreach(c DEBUG RELEASE) set(_Boost_VARS_LIB_${c} BOOST_LIBRARYDIR Boost_LIBRARY_DIR_${c}) list(APPEND _Boost_VARS_LIB ${_Boost_VARS_LIB_${c}}) _boost_change_detect(_Boost_CHANGE_LIBDIR_${c} ${_Boost_VARS_DIR} - ${_Boost_VARS_LIB_${c}} Boost_INCLUDE_DIR) + ${_Boost_VARS_LIB_${c}} Boost_INCLUDE_DIR + ) # Clear Boost_LIBRARY_DIR_${c} if it did not change but other input affecting the # location did. We will find a new one based on the new inputs. if(_Boost_CHANGE_LIBDIR_${c} AND NOT _Boost_LIBRARY_DIR_${c}_CHANGED) @@ -2105,8 +2727,11 @@ foreach(c DEBUG RELEASE) # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is set, prefer its value. if(Boost_LIBRARY_DIR_${c}) - set(_boost_LIBRARY_SEARCH_DIRS_${c} ${Boost_LIBRARY_DIR_${c}} NO_DEFAULT_PATH - NO_CMAKE_FIND_ROOT_PATH) + set(_boost_LIBRARY_SEARCH_DIRS_${c} + ${Boost_LIBRARY_DIR_${c}} + NO_DEFAULT_PATH + NO_CMAKE_FIND_ROOT_PATH + ) else() set(_boost_LIBRARY_SEARCH_DIRS_${c} "") if(BOOST_LIBRARYDIR) @@ -2116,44 +2741,75 @@ foreach(c DEBUG RELEASE) endif() if(BOOST_ROOT) - list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_ROOT}/lib - ${BOOST_ROOT}/stage/lib) + list( + APPEND + _boost_LIBRARY_SEARCH_DIRS_${c} + ${BOOST_ROOT}/lib + ${BOOST_ROOT}/stage/lib + ) _boost_update_windows_library_search_dirs_with_prebuilt_paths( - _boost_LIBRARY_SEARCH_DIRS_${c} "${BOOST_ROOT}") + _boost_LIBRARY_SEARCH_DIRS_${c} "${BOOST_ROOT}" + ) elseif(_ENV_BOOST_ROOT) - list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_ROOT}/lib - ${_ENV_BOOST_ROOT}/stage/lib) + list( + APPEND + _boost_LIBRARY_SEARCH_DIRS_${c} + ${_ENV_BOOST_ROOT}/lib + ${_ENV_BOOST_ROOT}/stage/lib + ) _boost_update_windows_library_search_dirs_with_prebuilt_paths( - _boost_LIBRARY_SEARCH_DIRS_${c} "${_ENV_BOOST_ROOT}") + _boost_LIBRARY_SEARCH_DIRS_${c} "${_ENV_BOOST_ROOT}" + ) endif() - list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${Boost_INCLUDE_DIR}/lib - ${Boost_INCLUDE_DIR}/../lib ${Boost_INCLUDE_DIR}/stage/lib) + list( + APPEND + _boost_LIBRARY_SEARCH_DIRS_${c} + ${Boost_INCLUDE_DIR}/lib + ${Boost_INCLUDE_DIR}/../lib + ${Boost_INCLUDE_DIR}/stage/lib + ) _boost_update_windows_library_search_dirs_with_prebuilt_paths( - _boost_LIBRARY_SEARCH_DIRS_${c} "${Boost_INCLUDE_DIR}/..") + _boost_LIBRARY_SEARCH_DIRS_${c} "${Boost_INCLUDE_DIR}/.." + ) _boost_update_windows_library_search_dirs_with_prebuilt_paths( - _boost_LIBRARY_SEARCH_DIRS_${c} "${Boost_INCLUDE_DIR}") + _boost_LIBRARY_SEARCH_DIRS_${c} "${Boost_INCLUDE_DIR}" + ) if(Boost_NO_SYSTEM_PATHS) - list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} NO_CMAKE_SYSTEM_PATH - NO_SYSTEM_ENVIRONMENT_PATH) + list( + APPEND + _boost_LIBRARY_SEARCH_DIRS_${c} + NO_CMAKE_SYSTEM_PATH + NO_SYSTEM_ENVIRONMENT_PATH + ) else() foreach(ver ${_boost_TEST_VERSIONS}) string(REPLACE "." "_" ver "${ver}") _boost_update_windows_library_search_dirs_with_prebuilt_paths( - _boost_LIBRARY_SEARCH_DIRS_${c} "C:/local/boost_${ver}") + _boost_LIBRARY_SEARCH_DIRS_${c} "C:/local/boost_${ver}" + ) endforeach() _boost_update_windows_library_search_dirs_with_prebuilt_paths( - _boost_LIBRARY_SEARCH_DIRS_${c} "C:/boost") - list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} PATHS C:/boost/lib C:/boost - /sw/local/lib) + _boost_LIBRARY_SEARCH_DIRS_${c} "C:/boost" + ) + list( + APPEND + _boost_LIBRARY_SEARCH_DIRS_${c} + PATHS + C:/boost/lib + C:/boost + /sw/local/lib + ) endif() endif() endforeach() _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "_boost_LIBRARY_SEARCH_DIRS_RELEASE") + "_boost_LIBRARY_SEARCH_DIRS_RELEASE" +) _boost_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "_boost_LIBRARY_SEARCH_DIRS_DEBUG") + "_boost_LIBRARY_SEARCH_DIRS_DEBUG" +) # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES if(Boost_USE_STATIC_LIBS) @@ -2214,9 +2870,7 @@ if("thread" IN_LIST Boost_FIND_COMPONENTS) endif() # If the user changed any of our control inputs flush previous results. -if(_Boost_CHANGE_LIBDIR_DEBUG - OR _Boost_CHANGE_LIBDIR_RELEASE - OR _Boost_CHANGE_LIBNAME) +if(_Boost_CHANGE_LIBDIR_DEBUG OR _Boost_CHANGE_LIBDIR_RELEASE OR _Boost_CHANGE_LIBNAME) foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED}) string(TOUPPER ${COMPONENT} UPPERCOMPONENT) foreach(c DEBUG RELEASE) @@ -2236,9 +2890,11 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) # Compute component-specific hints. set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "") - if(${COMPONENT} STREQUAL "mpi" - OR ${COMPONENT} STREQUAL "mpi_python" - OR ${COMPONENT} STREQUAL "graph_parallel") + if( + ${COMPONENT} STREQUAL "mpi" + OR ${COMPONENT} STREQUAL "mpi_python" + OR ${COMPONENT} STREQUAL "graph_parallel" + ) foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES}) if(IS_ABSOLUTE "${lib}") get_filename_component(libdir "${lib}" PATH) @@ -2267,35 +2923,38 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}" - ) + ) # Debian/Ubuntu (Some versions omit the 2 and/or 3 from the suffix) list( APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}-py${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}" - ) + ) list( APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-py${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}" - ) + ) # Gentoo list( APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-${COMPONENT_PYTHON_VERSION_MAJOR}.${COMPONENT_PYTHON_VERSION_MINOR}" - ) + ) # RPMs list( APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}" - ) + ) endif() if(COMPONENT_PYTHON_VERSION_MAJOR AND NOT COMPONENT_PYTHON_VERSION_MINOR) # Boost < 1.67 - list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME - "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}") + list( + APPEND + _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME + "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}" + ) endif() # Consolidate and report component-specific hints. @@ -2305,7 +2964,7 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) "${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "Component-specific library search names for ${COMPONENT_NAME}: ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME}" - ) + ) endif() if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) @@ -2313,7 +2972,7 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) "${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "Component-specific library search paths for ${COMPONENT}: ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT}" - ) + ) endif() # @@ -2330,8 +2989,11 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) else() set(Boost_${UPPERCOMPONENT}_HEADER ON) if(NOT Boost_FIND_QUIETLY) - message(WARNING "No header defined for ${COMPONENT}; skipping header check " - "(note: header-only libraries have no designated component)") + message( + WARNING + "No header defined for ${COMPONENT}; skipping header check " + "(note: header-only libraries have no designated component)" + ) endif() endif() @@ -2347,7 +3009,7 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} - ) + ) endforeach() list( APPEND @@ -2356,7 +3018,8 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}) + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component} + ) if(_boost_STATIC_RUNTIME_WORKAROUND) set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}") foreach(compiler IN LISTS _boost_COMPILER) @@ -2366,7 +3029,7 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} - ) + ) endforeach() list( APPEND @@ -2374,7 +3037,7 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} - ) + ) endif() endforeach() if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") @@ -2382,7 +3045,8 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) endif() _boost_debug_print( "${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}") + "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}" + ) # if Boost_LIBRARY_DIR_RELEASE is not defined, but Boost_LIBRARY_DIR_DEBUG is, look # there first for RELEASE libs @@ -2391,8 +3055,13 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) endif() # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing. - string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp - "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}") + string( + REPLACE + "\\" + "/" + _boost_LIBRARY_SEARCH_DIRS_tmp + "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}" + ) if(Boost_USE_RELEASE_LIBS) _boost_find_library( @@ -2404,7 +3073,8 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) ${_boost_LIBRARY_SEARCH_DIRS_tmp} NAMES_PER_DIR DOC - "${_boost_docstring_release}") + "${_boost_docstring_release}" + ) endif() # @@ -2419,7 +3089,7 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} - ) + ) endforeach() list( APPEND @@ -2428,7 +3098,8 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}) + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component} + ) if(_boost_STATIC_RUNTIME_WORKAROUND) set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}") foreach(compiler IN LISTS _boost_COMPILER) @@ -2438,7 +3109,7 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} - ) + ) endforeach() list( APPEND @@ -2446,7 +3117,7 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} - ) + ) endif() endforeach() if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") @@ -2454,7 +3125,8 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) endif() _boost_debug_print( "${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" - "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}") + "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}" + ) # if Boost_LIBRARY_DIR_DEBUG is not defined, but Boost_LIBRARY_DIR_RELEASE is, look # there first for DEBUG libs @@ -2463,8 +3135,13 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) endif() # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing. - string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp - "${_boost_LIBRARY_SEARCH_DIRS_DEBUG}") + string( + REPLACE + "\\" + "/" + _boost_LIBRARY_SEARCH_DIRS_tmp + "${_boost_LIBRARY_SEARCH_DIRS_DEBUG}" + ) if(Boost_USE_DEBUG_LIBS) _boost_find_library( @@ -2476,21 +3153,23 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) ${_boost_LIBRARY_SEARCH_DIRS_tmp} NAMES_PER_DIR DOC - "${_boost_docstring_debug}") + "${_boost_docstring_debug}" + ) endif() if(Boost_REALPATH) _boost_swap_with_realpath(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE - "${_boost_docstring_release}") + "${_boost_docstring_release}" + ) _boost_swap_with_realpath(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG - "${_boost_docstring_debug}") + "${_boost_docstring_debug}" + ) endif() _boost_adjust_lib_vars(${UPPERCOMPONENT}) # Check if component requires some compiler features _boost_compiler_features(${COMPONENT} _Boost_${UPPERCOMPONENT}_COMPILER_FEATURES) - endforeach() # Restore the original find library ordering @@ -2531,7 +3210,8 @@ find_package_handle_standard_args( Boost REQUIRED_VARS Boost_INCLUDE_DIR VERSION_VAR Boost_VERSION_STRING - HANDLE_COMPONENTS) + HANDLE_COMPONENTS +) if(Boost_FOUND) if(NOT Boost_LIBRARY_DIRS) @@ -2562,7 +3242,6 @@ if(Boost_FOUND) if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR}) endif() - endif() else() # Boost headers were not found so no components were found. @@ -2582,16 +3261,20 @@ if(Boost_FOUND) if(NOT TARGET Boost::headers) add_library(Boost::headers INTERFACE IMPORTED) if(Boost_INCLUDE_DIRS) - set_target_properties(Boost::headers PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${Boost_INCLUDE_DIRS}") + set_target_properties( + Boost::headers + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}" + ) endif() endif() # Define the old target name for header-only libraries for backwards compat. if(NOT TARGET Boost::boost) add_library(Boost::boost INTERFACE IMPORTED) - set_target_properties(Boost::boost PROPERTIES INTERFACE_LINK_LIBRARIES - Boost::headers) + set_target_properties( + Boost::boost + PROPERTIES INTERFACE_LINK_LIBRARIES Boost::headers + ) endif() foreach(COMPONENT ${Boost_FIND_COMPONENTS}) @@ -2607,57 +3290,76 @@ if(Boost_FOUND) endif() if(Boost_INCLUDE_DIRS) set_target_properties( - Boost::${COMPONENT} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${Boost_INCLUDE_DIRS}") + Boost::${COMPONENT} + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}" + ) endif() if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY}") set_target_properties( Boost::${COMPONENT} - PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_LOCATION "${Boost_${UPPERCOMPONENT}_LIBRARY}") + PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${Boost_${UPPERCOMPONENT}_LIBRARY}" + ) endif() if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}") set_property( TARGET Boost::${COMPONENT} APPEND - PROPERTY IMPORTED_CONFIGURATIONS RELEASE) + PROPERTY IMPORTED_CONFIGURATIONS RELEASE + ) set_target_properties( Boost::${COMPONENT} - PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" - IMPORTED_LOCATION_RELEASE - "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}") + PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" + IMPORTED_LOCATION_RELEASE + "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}" + ) endif() if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") set_property( TARGET Boost::${COMPONENT} APPEND - PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + PROPERTY IMPORTED_CONFIGURATIONS DEBUG + ) set_target_properties( Boost::${COMPONENT} - PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" - IMPORTED_LOCATION_DEBUG - "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") + PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" + IMPORTED_LOCATION_DEBUG + "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}" + ) endif() if(_Boost_${UPPERCOMPONENT}_DEPENDENCIES) unset(_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES) foreach(dep ${_Boost_${UPPERCOMPONENT}_DEPENDENCIES}) - list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES - Boost::${dep}) + list( + APPEND + _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES + Boost::${dep} + ) endforeach() if(COMPONENT STREQUAL "thread") - list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES - Threads::Threads) + list( + APPEND + _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES + Threads::Threads + ) endif() set_target_properties( Boost::${COMPONENT} - PROPERTIES INTERFACE_LINK_LIBRARIES - "${_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES}") + PROPERTIES + INTERFACE_LINK_LIBRARIES + "${_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES}" + ) endif() if(_Boost_${UPPERCOMPONENT}_COMPILER_FEATURES) set_target_properties( Boost::${COMPONENT} - PROPERTIES INTERFACE_COMPILE_FEATURES - "${_Boost_${UPPERCOMPONENT}_COMPILER_FEATURES}") + PROPERTIES + INTERFACE_COMPILE_FEATURES + "${_Boost_${UPPERCOMPONENT}_COMPILER_FEATURES}" + ) endif() endif() endif() @@ -2672,8 +3374,9 @@ if(Boost_FOUND) add_library(Boost::disable_autolinking INTERFACE IMPORTED) add_library(Boost::dynamic_linking INTERFACE IMPORTED) set_target_properties( - Boost::dynamic_linking PROPERTIES INTERFACE_COMPILE_DEFINITIONS - "BOOST_ALL_DYN_LINK") + Boost::dynamic_linking + PROPERTIES INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_DYN_LINK" + ) endif() if(WIN32) # In windows, automatic linking is performed, so you do not have to specify the @@ -2692,10 +3395,13 @@ if(Boost_FOUND) # each time a library is selected for linking. set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC") set_target_properties( - Boost::diagnostic_definitions PROPERTIES INTERFACE_COMPILE_DEFINITIONS - "BOOST_LIB_DIAGNOSTIC") - set_target_properties(Boost::disable_autolinking - PROPERTIES INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB") + Boost::diagnostic_definitions + PROPERTIES INTERFACE_COMPILE_DEFINITIONS "BOOST_LIB_DIAGNOSTIC" + ) + set_target_properties( + Boost::disable_autolinking + PROPERTIES INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB" + ) endif() endif() @@ -2717,10 +3423,7 @@ endforeach() # Configure display of cache entries in GUI. foreach(v BOOSTROOT BOOST_ROOT ${_Boost_VARS_INC} ${_Boost_VARS_LIB}) - get_property( - _type - CACHE ${v} - PROPERTY TYPE) + get_property(_type CACHE ${v} PROPERTY TYPE) if(_type) set_property(CACHE ${v} PROPERTY ADVANCED 1) if("x${_type}" STREQUAL "xUNINITIALIZED") @@ -2737,9 +3440,7 @@ endforeach() # changed them. foreach(v ${_Boost_VARS_INC} ${_Boost_VARS_LIB} ${_Boost_VARS_DIR} ${_Boost_VARS_NAME}) if(DEFINED ${v}) - set(_${v}_LAST - "${${v}}" - CACHE INTERNAL "Last used ${v} value.") + set(_${v}_LAST "${${v}}" CACHE INTERNAL "Last used ${v} value.") else() unset(_${v}_LAST CACHE) endif() @@ -2752,7 +3453,9 @@ list(REMOVE_DUPLICATES _Boost_COMPONENTS_SEARCHED) list(SORT _Boost_COMPONENTS_SEARCHED) set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}" - CACHE INTERNAL "Components requested for this build tree.") + CACHE INTERNAL + "Components requested for this build tree." +) # Restore project's policies cmake_policy(POP) diff --git a/projects/rocprofiler-systems/cmake/Modules/FindLibDW.cmake b/projects/rocprofiler-systems/cmake/Modules/FindLibDW.cmake index 6fa6f9077f..8030e78638 100644 --- a/projects/rocprofiler-systems/cmake/Modules/FindLibDW.cmake +++ b/projects/rocprofiler-systems/cmake/Modules/FindLibDW.cmake @@ -61,29 +61,21 @@ if(PC_LIBDW_FOUND) pkg_get_variable(PC_LIBDW_INCLUDE_DIRS libdw includedir) endif() - set(LibDW_INCLUDE_DIRS - ${PC_LIBDW_INCLUDE_DIRS} - CACHE PATH "") - set(LibDW_LIBRARIES - ${PC_LIBDW_LINK_LIBRARIES} - CACHE PATH "") - set(LibDW_VERSION - ${PC_LIBDW_VERSION} - CACHE STRING "") + set(LibDW_INCLUDE_DIRS ${PC_LIBDW_INCLUDE_DIRS} CACHE PATH "") + set(LibDW_LIBRARIES ${PC_LIBDW_LINK_LIBRARIES} CACHE PATH "") + set(LibDW_VERSION ${PC_LIBDW_VERSION} CACHE STRING "") else() - find_path( - LibDW_INCLUDE_DIRS - NAMES libdw.h - PATH_SUFFIXES elfutils ${_find_path_args}) + find_path(LibDW_INCLUDE_DIRS NAMES libdw.h PATH_SUFFIXES elfutils ${_find_path_args}) - find_library( - LibDW_LIBRARIES - NAMES libdw dw - PATH_SUFFIXES elfutils ${_find_path_args}) + find_library(LibDW_LIBRARIES NAMES libdw dw PATH_SUFFIXES elfutils ${_find_path_args}) if(EXISTS "${LibDW_INCLUDE_DIRS}/version.h") - file(STRINGS "${LibDW_INCLUDE_DIRS}/version.h" _version_line - REGEX "^#define _ELFUTILS_VERSION[ \t]+[0-9]+") + file( + STRINGS + "${LibDW_INCLUDE_DIRS}/version.h" + _version_line + REGEX "^#define _ELFUTILS_VERSION[ \t]+[0-9]+" + ) string(REGEX MATCH "[0-9]+" _version "${_version_line}") if(NOT "x${_version}" STREQUAL "x") set(LibDW_VERSION "0.${_version}") @@ -98,7 +90,8 @@ find_package_handle_standard_args( LibDW FOUND_VAR LibDW_FOUND REQUIRED_VARS LibDW_LIBRARIES LibDW_INCLUDE_DIRS - VERSION_VAR LibDW_VERSION) + VERSION_VAR LibDW_VERSION +) if(LibDW_FOUND) mark_as_advanced(LibDW_INCLUDE_DIRS) @@ -120,21 +113,29 @@ if(LibDW_FOUND) if(NOT TARGET LibDW::LibDW) add_library(LibDW::LibDW UNKNOWN IMPORTED) - set_target_properties(LibDW::LibDW PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${LibDW_INCLUDE_DIRS}") + set_target_properties( + LibDW::LibDW + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LibDW_INCLUDE_DIRS}" + ) if(NOT "x${_link_libs}" STREQUAL "x") set_target_properties( - LibDW::LibDW PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LINK_DEPENDENT_LIBRARIES "${_link_libs}") + LibDW::LibDW + PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LINK_DEPENDENT_LIBRARIES "${_link_libs}" + ) set(LibDW_LIBRARIES ${_libdw}) unset(_libdw) unset(_link_libs) endif() set_target_properties( - LibDW::LibDW PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${LibDW_LIBRARIES}") + LibDW::LibDW + PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${LibDW_LIBRARIES}" + ) endif() endif() diff --git a/projects/rocprofiler-systems/cmake/Modules/FindLibDebuginfod.cmake b/projects/rocprofiler-systems/cmake/Modules/FindLibDebuginfod.cmake index 50e697fba8..695c815a6a 100644 --- a/projects/rocprofiler-systems/cmake/Modules/FindLibDebuginfod.cmake +++ b/projects/rocprofiler-systems/cmake/Modules/FindLibDebuginfod.cmake @@ -61,29 +61,29 @@ if(PC_LIBDEBUGINFOD_FOUND) pkg_get_variable(PC_LIBDEBUGINFOD_INCLUDE_DIRS libdebuginfod includedir) endif() - set(LibDebuginfod_INCLUDE_DIRS - ${PC_LIBDEBUGINFOD_INCLUDE_DIRS} - CACHE PATH "") - set(LibDebuginfod_LIBRARIES - ${PC_LIBDEBUGINFOD_LINK_LIBRARIES} - CACHE PATH "") - set(LibDebuginfod_VERSION - ${PC_LIBDEBUGINFOD_VERSION} - CACHE STRING "") + set(LibDebuginfod_INCLUDE_DIRS ${PC_LIBDEBUGINFOD_INCLUDE_DIRS} CACHE PATH "") + set(LibDebuginfod_LIBRARIES ${PC_LIBDEBUGINFOD_LINK_LIBRARIES} CACHE PATH "") + set(LibDebuginfod_VERSION ${PC_LIBDEBUGINFOD_VERSION} CACHE STRING "") else() find_path( LibDebuginfod_INCLUDE_DIRS NAMES debuginfod.h - PATH_SUFFIXES elfutils ${_find_path_args}) + PATH_SUFFIXES elfutils ${_find_path_args} + ) find_library( LibDebuginfod_LIBRARIES NAMES libdebuginfod debuginfod - PATH_SUFFIXES elfutils ${_find_path_args}) + PATH_SUFFIXES elfutils ${_find_path_args} + ) if(EXISTS "${LibDebuginfod_INCLUDE_DIRS}/version.h") - file(STRINGS "${LibDebuginfod_INCLUDE_DIRS}/version.h" _version_line - REGEX "^#define _ELFUTILS_VERSION[ \t]+[0-9]+") + file( + STRINGS + "${LibDebuginfod_INCLUDE_DIRS}/version.h" + _version_line + REGEX "^#define _ELFUTILS_VERSION[ \t]+[0-9]+" + ) string(REGEX MATCH "[0-9]+" _version "${_version_line}") if(NOT "x${_version}" STREQUAL "x") set(LibDebuginfod_VERSION "0.${_version}") @@ -98,7 +98,8 @@ find_package_handle_standard_args( LibDebuginfod FOUND_VAR LibDebuginfod_FOUND REQUIRED_VARS LibDebuginfod_LIBRARIES LibDebuginfod_INCLUDE_DIRS - VERSION_VAR LibDebuginfod_VERSION) + VERSION_VAR LibDebuginfod_VERSION +) if(LibDebuginfod_FOUND) mark_as_advanced(LibDebuginfod_INCLUDE_DIR) @@ -109,9 +110,11 @@ if(LibDebuginfod_FOUND) add_library(LibDebuginfod::LibDebuginfod UNKNOWN IMPORTED) set_target_properties( LibDebuginfod::LibDebuginfod - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LibDebuginfod_INCLUDE_DIRS}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${LibDebuginfod_LIBRARIES}") + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${LibDebuginfod_INCLUDE_DIRS}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${LibDebuginfod_LIBRARIES}" + ) endif() endif() diff --git a/projects/rocprofiler-systems/cmake/Modules/FindLibDwarf.cmake b/projects/rocprofiler-systems/cmake/Modules/FindLibDwarf.cmake index d5c4bd1183..c9d4a956ef 100644 --- a/projects/rocprofiler-systems/cmake/Modules/FindLibDwarf.cmake +++ b/projects/rocprofiler-systems/cmake/Modules/FindLibDwarf.cmake @@ -33,14 +33,16 @@ find_path( HINTS ${LibDwarf_ROOT_DIR}/include ${LibDwarf_ROOT_DIR} ${LibDwarf_INCLUDEDIR} PATHS ${DYNINST_SYSTEM_INCLUDE_PATHS} PATH_SUFFIXES ${_path_suffixes} - DOC "libdw include directories") + DOC "libdw include directories" +) find_library( LibDwarf_LIBRARIES NAMES libdw.so.1 libdw.so HINTS ${LibDwarf_ROOT_DIR}/lib ${LibDwarf_ROOT_DIR} ${LibDwarf_LIBRARYDIR} PATHS ${DYNINST_SYSTEM_LIBRARY_PATHS} - PATH_SUFFIXES ${_path_suffixes}) + PATH_SUFFIXES ${_path_suffixes} +) # Find the library with the highest version set(_max_ver 0.0) @@ -67,7 +69,8 @@ find_package_handle_standard_args( LibDwarf FOUND_VAR LibDwarf_FOUND REQUIRED_VARS LibDwarf_LIBRARIES LibDwarf_INCLUDE_DIR - VERSION_VAR LibDwarf_VERSION) + VERSION_VAR LibDwarf_VERSION +) # Export cache variables if(LibDwarf_FOUND) diff --git a/projects/rocprofiler-systems/cmake/Modules/FindLibElf.cmake b/projects/rocprofiler-systems/cmake/Modules/FindLibElf.cmake index a339b02993..782a688006 100644 --- a/projects/rocprofiler-systems/cmake/Modules/FindLibElf.cmake +++ b/projects/rocprofiler-systems/cmake/Modules/FindLibElf.cmake @@ -35,14 +35,16 @@ find_path( HINTS ${LibElf_ROOT_DIR}/include ${LibElf_ROOT_DIR} ${LibElf_INCLUDEDIR} PATHS ${DYNINST_SYSTEM_INCLUDE_PATHS} PATH_SUFFIXES ${_path_suffixes} - DOC "libelf include directories") + DOC "libelf include directories" +) find_library( LibElf_LIBRARIES NAMES libelf.so.1 libelf.so HINTS ${LibElf_ROOT_DIR}/lib ${LibElf_ROOT_DIR} ${LibElf_LIBRARYDIR} PATHS ${DYNINST_SYSTEM_LIBRARY_PATHS} - PATH_SUFFIXES ${_path_suffixes}) + PATH_SUFFIXES ${_path_suffixes} +) # Find the library with the highest version set(_max_ver 0.0) @@ -69,7 +71,8 @@ find_package_handle_standard_args( LibElf FOUND_VAR LibElf_FOUND REQUIRED_VARS LibElf_LIBRARIES LibElf_INCLUDE_DIR - VERSION_VAR LibElf_VERSION) + VERSION_VAR LibElf_VERSION +) # Export cache variables if(LibElf_FOUND) diff --git a/projects/rocprofiler-systems/cmake/Modules/FindLibIberty.cmake b/projects/rocprofiler-systems/cmake/Modules/FindLibIberty.cmake index 4caebe9d0c..36d38db4ab 100644 --- a/projects/rocprofiler-systems/cmake/Modules/FindLibIberty.cmake +++ b/projects/rocprofiler-systems/cmake/Modules/FindLibIberty.cmake @@ -44,7 +44,8 @@ find_path( HINTS ${LibIberty_ROOT_DIR} ${LibIberty_ROOT_DIR}/include ${LibIberty_INCLUDEDIR} PATHS ${DYNINST_SYSTEM_INCLUDE_PATHS} PATH_SUFFIXES ${_path_suffixes} - DOC "LibIberty include directories") + DOC "LibIberty include directories" +) # iberty_pic is for Debian <= wheezy find_library( @@ -52,13 +53,15 @@ find_library( NAMES iberty_pic iberty HINTS ${LibIberty_ROOT_DIR} ${LibIberty_LIBRARYDIR} ${IBERTY_LIBRARIES} PATHS ${DYNINST_SYSTEM_LIBRARY_PATHS} - PATH_SUFFIXES ${_path_suffixes}) + PATH_SUFFIXES ${_path_suffixes} +) include(FindPackageHandleStandardArgs) find_package_handle_standard_args( LibIberty FOUND_VAR LibIberty_FOUND - REQUIRED_VARS LibIberty_INCLUDE_DIRS LibIberty_LIBRARIES) + REQUIRED_VARS LibIberty_INCLUDE_DIRS LibIberty_LIBRARIES +) # For backwards compatibility only set(IBERTY_FOUND ${LibIberty_FOUND}) diff --git a/projects/rocprofiler-systems/cmake/Modules/FindLibva-headers.cmake b/projects/rocprofiler-systems/cmake/Modules/FindLibva-headers.cmake index 5bc28e4b1f..e4b463cc2e 100644 --- a/projects/rocprofiler-systems/cmake/Modules/FindLibva-headers.cmake +++ b/projects/rocprofiler-systems/cmake/Modules/FindLibva-headers.cmake @@ -7,26 +7,33 @@ include(FindPackageHandleStandardArgs) set(LIBVA_HEADERS_INCLUDE_DIR_INTERNAL "${PROJECT_SOURCE_DIR}/source/lib/rocprof-sys/library/tpls" - CACHE PATH "Path to internal va headers") + CACHE PATH + "Path to internal va headers" +) # ----------------------------------------------------------------------------------------# find_path( LIBVA_HEADERS_INCLUDE_DIR NAMES va/va.h PATHS /opt/amdgpu/include - NO_DEFAULT_PATH) + NO_DEFAULT_PATH +) if(NOT EXISTS "${LIBVA_HEADERS_INCLUDE_DIR}") rocprofiler_systems_message( AUTHOR_WARNING "VA API header does not exist! Setting LIBVA_HEADERS_INCLUDE_DIR to internal directory: ${LIBVA_HEADERS_INCLUDE_DIR}" - ) + ) set(LIBVA_HEADERS_INCLUDE_DIR "${LIBVA_HEADERS_INCLUDE_DIR_INTERNAL}" - CACHE PATH "Path to VA API headers" FORCE) + CACHE PATH + "Path to VA API headers" + FORCE + ) else() rocprofiler_systems_message(STATUS - "VA API header found: ${LIBVA_HEADERS_INCLUDE_DIR}") + "VA API header found: ${LIBVA_HEADERS_INCLUDE_DIR}" + ) endif() mark_as_advanced(LIBVA_HEADERS_INCLUDE_DIR) @@ -39,8 +46,11 @@ find_package_handle_standard_args(Libva-headers DEFAULT_MSG LIBVA_HEADERS_INCLUD if(Libva-headers_FOUND) add_library(roc::libva-headers INTERFACE IMPORTED) - target_include_directories(roc::libva-headers SYSTEM - INTERFACE ${LIBVA_HEADERS_INCLUDE_DIR}) + target_include_directories( + roc::libva-headers + SYSTEM + INTERFACE ${LIBVA_HEADERS_INCLUDE_DIR} + ) endif() # ------------------------------------------------------------------------------# diff --git a/projects/rocprofiler-systems/cmake/Modules/FindMPI-Headers.cmake b/projects/rocprofiler-systems/cmake/Modules/FindMPI-Headers.cmake index 2417d3f1d3..ae625c75de 100644 --- a/projects/rocprofiler-systems/cmake/Modules/FindMPI-Headers.cmake +++ b/projects/rocprofiler-systems/cmake/Modules/FindMPI-Headers.cmake @@ -8,19 +8,29 @@ include(FindPackageHandleStandardArgs) set(MPI_HEADERS_VENDOR_INTERNAL "OpenMPI" - CACHE STRING "Distribution type of internal mpi.h") + CACHE STRING + "Distribution type of internal mpi.h" +) set(MPI_HEADERS_INCLUDE_DIR_INTERNAL "${PROJECT_SOURCE_DIR}/source/lib/rocprof-sys/library/tpls/mpi" - CACHE PATH "Path to internal ${MPI_HEADERS_VENDOR_INTERNAL} mpi.h") + CACHE PATH + "Path to internal ${MPI_HEADERS_VENDOR_INTERNAL} mpi.h" +) mark_as_advanced(MPI_HEADERS_VENDOR_INTERNAL) mark_as_advanced(MPI_HEADERS_INCLUDE_DIR_INTERNAL) -if(DEFINED _MPI_HEADERS_LAST_MPI_HEADERS_INCLUDE_DIR - AND NOT _MPI_HEADERS_LAST_MPI_HEADERS_INCLUDE_DIR STREQUAL MPI_HEADERS_INCLUDE_DIR) +if( + DEFINED _MPI_HEADERS_LAST_MPI_HEADERS_INCLUDE_DIR + AND NOT _MPI_HEADERS_LAST_MPI_HEADERS_INCLUDE_DIR STREQUAL MPI_HEADERS_INCLUDE_DIR +) unset(MPI_HEADERS_VENDOR CACHE) # if skip mpicxx is on because of internal unset this value - if(MPI_HEADERS_SKIP_MPICXX AND "${_MPI_HEADERS_LAST_MPI_HEADERS_INCLUDE_DIR}" - STREQUAL "${MPI_HEADERS_INCLUDE_DIR_INTERNAL}") + if( + MPI_HEADERS_SKIP_MPICXX + AND "${_MPI_HEADERS_LAST_MPI_HEADERS_INCLUDE_DIR}" + STREQUAL + "${MPI_HEADERS_INCLUDE_DIR_INTERNAL}" + ) unset(MPI_HEADERS_SKIP_MPICXX CACHE) endif() endif() @@ -40,7 +50,8 @@ find_path( NAMES mpi.h PATH_SUFFIXES include/openmpi openmpi include HINTS ${MPI_ROOT_DIR} - PATHS ${MPI_ROOT_DIR}) + PATHS ${MPI_ROOT_DIR} +) # ------------------------------------------------------------------------------# # @@ -53,11 +64,17 @@ if(NOT MPI_HEADERS_INCLUDE_DIR) if(MPI_C_INCLUDE_DIRS) set(MPI_HEADERS_INCLUDE_DIR ${MPI_C_INCLUDE_DIRS} - CACHE PATH "Include directory for MPI" FORCE) + CACHE PATH + "Include directory for MPI" + FORCE + ) elseif(MPI_CXX_INCLUDE_DIRS) set(MPI_HEADERS_INCLUDE_DIR ${MPI_CXX_INCLUDE_DIRS} - CACHE PATH "Include directory for MPI" FORCE) + CACHE PATH + "Include directory for MPI" + FORCE + ) endif() endif() @@ -73,17 +90,23 @@ if(MPI_HEADERS_INCLUDE_DIR) if("${_LINE}" MATCHES "define([ \t]+)OMPI_") set(MPI_HEADERS_VENDOR "OpenMPI" - CACHE STRING "MPI headers are from OpenMPI distribution") + CACHE STRING + "MPI headers are from OpenMPI distribution" + ) break() elseif("${_LINE}" MATCHES "define([ \t]+)MPICH_") set(MPI_HEADERS_VENDOR "MPICH" - CACHE STRING "MPI headers are from MPICH distribution") + CACHE STRING + "MPI headers are from MPICH distribution" + ) break() elseif("${_LINE}" MATCHES "define([ \t]+)MVAPICH_") set(MPI_HEADERS_VENDOR "MVAPICH" - CACHE STRING "MPI headers are from MVAPICH distribution") + CACHE STRING + "MPI headers are from MVAPICH distribution" + ) break() endif() endforeach() @@ -96,42 +119,47 @@ endif() # ------------------------------------------------------------------------------# if(NOT MPI_HEADERS_INCLUDE_DIR) - set(MPI_HEADERS_INCLUDE_DIR - "${MPI_HEADERS_INCLUDE_DIR_INTERNAL}" - CACHE PATH "" FORCE) + set(MPI_HEADERS_INCLUDE_DIR "${MPI_HEADERS_INCLUDE_DIR_INTERNAL}" CACHE PATH "" FORCE) set(MPI_HEADERS_VENDOR "${MPI_HEADERS_VENDOR_INTERNAL}" - CACHE STRING "MPI headers are from OpenMPI distribution" FORCE) - set(MPI_HEADERS_SKIP_MPICXX - ON - CACHE BOOL "" FORCE) + CACHE STRING + "MPI headers are from OpenMPI distribution" + FORCE + ) + set(MPI_HEADERS_SKIP_MPICXX ON CACHE BOOL "" FORCE) elseif("${MPI_HEADERS_VENDOR}" STREQUAL "MPICH") option( MPI_HEADERS_ALLOW_MPICH "Permit the use of MPI headers from MPICH instead of using internal OpenMPI header" - OFF) + OFF + ) mark_as_advanced(MPI_HEADERS_ALLOW_MPICH) if(NOT MPI_HEADERS_ALLOW_MPICH) set(_MESSAGE "\nFound MPI headers belonging to a MPICH distribution. ") set(_MESSAGE "${_MESSAGE}The data types for MPICH will cause segfaults when an application uses OpenMPI, " - ) + ) set(_MESSAGE - "${_MESSAGE}whereas the OpenMPI data types are compatible with both. ") + "${_MESSAGE}whereas the OpenMPI data types are compatible with both. " + ) set(_MESSAGE "${_MESSAGE}Forcing internal OpenMPI header... This can be disabled via MPI_HEADERS_ALLOW_MPICH=ON ...\n" - ) + ) message(AUTHOR_WARNING "${_MESSAGE}") unset(_MESSAGE) set(MPI_HEADERS_INCLUDE_DIR "${MPI_HEADERS_INCLUDE_DIR_INTERNAL}" - CACHE PATH "" FORCE) + CACHE PATH + "" + FORCE + ) set(MPI_HEADERS_VENDOR "${MPI_HEADERS_VENDOR_INTERNAL}" - CACHE STRING "MPI headers are from OpenMPI distribution" FORCE) - set(MPI_HEADERS_SKIP_MPICXX - ON - CACHE BOOL "" FORCE) + CACHE STRING + "MPI headers are from OpenMPI distribution" + FORCE + ) + set(MPI_HEADERS_SKIP_MPICXX ON CACHE BOOL "" FORCE) endif() endif() @@ -145,7 +173,9 @@ mark_as_advanced(MPI_HEADERS_INCLUDE_DIR) # store value to detect changes set(_MPI_HEADERS_LAST_MPI_HEADERS_INCLUDE_DIR "${MPI_HEADERS_INCLUDE_DIR}" - CACHE INTERNAL "Last value of MPI_HEADERS_INCLUDE_DIR") + CACHE INTERNAL + "Last value of MPI_HEADERS_INCLUDE_DIR" +) # handle find_package find_package_handle_standard_args(MPI-Headers REQUIRED_VARS MPI_HEADERS_INCLUDE_DIR) @@ -160,6 +190,9 @@ if(MPI-Headers_FOUND) endif() endif() target_include_directories( - MPI::MPI_HEADERS INTERFACE $<$:${MPI_HEADERS_INCLUDE_DIR}> - $<$:${MPI_HEADERS_INCLUDE_DIR}>) + MPI::MPI_HEADERS + INTERFACE + $<$:${MPI_HEADERS_INCLUDE_DIR}> + $<$:${MPI_HEADERS_INCLUDE_DIR}> + ) endif() diff --git a/projects/rocprofiler-systems/cmake/Modules/FindROCmVersion.cmake b/projects/rocprofiler-systems/cmake/Modules/FindROCmVersion.cmake index 0d792b73c3..97fe56727d 100644 --- a/projects/rocprofiler-systems/cmake/Modules/FindROCmVersion.cmake +++ b/projects/rocprofiler-systems/cmake/Modules/FindROCmVersion.cmake @@ -42,7 +42,8 @@ set(ROCmVersion_VARIABLES TRIPLE NUMERIC CANONICAL - FULL) + FULL +) function(ROCM_VERSION_MESSAGE _TYPE) if(ROCmVersion_DEBUG) @@ -52,7 +53,6 @@ endfunction() # read a .info/version* file and propagate the variables to the calling scope function(ROCM_VERSION_COMPUTE FULL_VERSION_STRING _VAR_PREFIX) - # remove any line endings string(REGEX REPLACE "(\n|\r)" "" FULL_VERSION_STRING "${FULL_VERSION_STRING}") @@ -61,8 +61,13 @@ function(ROCM_VERSION_COMPUTE FULL_VERSION_STRING _VAR_PREFIX) # get number and remove from full version string string(REGEX REPLACE "([0-9]+)\:(.*)" "\\1" EPOCH_VERSION "${FULL_VERSION_STRING}") - string(REGEX REPLACE "([0-9]+)\:(.*)" "\\2" FULL_VERSION_STRING - "${FULL_VERSION_STRING}") + string( + REGEX REPLACE + "([0-9]+)\:(.*)" + "\\2" + FULL_VERSION_STRING + "${FULL_VERSION_STRING}" + ) if(EPOCH_VERSION STREQUAL FULL_VERSION) set(EPOCH_VERSION) @@ -70,18 +75,33 @@ function(ROCM_VERSION_COMPUTE FULL_VERSION_STRING _VAR_PREFIX) # get number and remove from full version string string(REGEX REPLACE "([0-9]+)(.*)" "\\1" MAJOR_VERSION "${FULL_VERSION_STRING}") - string(REGEX REPLACE "([0-9]+)(.*)" "\\2" FULL_VERSION_STRING - "${FULL_VERSION_STRING}") + string( + REGEX REPLACE + "([0-9]+)(.*)" + "\\2" + FULL_VERSION_STRING + "${FULL_VERSION_STRING}" + ) # get number and remove from full version string string(REGEX REPLACE "\.([0-9]+)(.*)" "\\1" MINOR_VERSION "${FULL_VERSION_STRING}") - string(REGEX REPLACE "\.([0-9]+)(.*)" "\\2" FULL_VERSION_STRING - "${FULL_VERSION_STRING}") + string( + REGEX REPLACE + "\.([0-9]+)(.*)" + "\\2" + FULL_VERSION_STRING + "${FULL_VERSION_STRING}" + ) # get number and remove from full version string string(REGEX REPLACE "\.([0-9]+)(.*)" "\\1" PATCH_VERSION "${FULL_VERSION_STRING}") - string(REGEX REPLACE "\.([0-9]+)(.*)" "\\2" FULL_VERSION_STRING - "${FULL_VERSION_STRING}") + string( + REGEX REPLACE + "\.([0-9]+)(.*)" + "\\2" + FULL_VERSION_STRING + "${FULL_VERSION_STRING}" + ) if(NOT PATCH_VERSION LESS 100) set(PATCH_VERSION 0) @@ -89,12 +109,22 @@ function(ROCM_VERSION_COMPUTE FULL_VERSION_STRING _VAR_PREFIX) # get number and remove from full version string string(REGEX REPLACE "\.([0-9]+)(.*)" "\\1" TWEAK_VERSION "${FULL_VERSION_STRING}") - string(REGEX REPLACE "\.([0-9]+)(.*)" "\\2" FULL_VERSION_STRING - "${FULL_VERSION_STRING}") + string( + REGEX REPLACE + "\.([0-9]+)(.*)" + "\\2" + FULL_VERSION_STRING + "${FULL_VERSION_STRING}" + ) # get number - string(REGEX REPLACE "-([0-9A-Za-z+~]+)" "\\1" REVISION_VERSION - "${FULL_VERSION_STRING}") + string( + REGEX REPLACE + "-([0-9A-Za-z+~]+)" + "\\1" + REVISION_VERSION + "${FULL_VERSION_STRING}" + ) set(CANONICAL_VERSION) set(_MAJOR_SEP ":") @@ -103,7 +133,15 @@ function(ROCM_VERSION_COMPUTE FULL_VERSION_STRING _VAR_PREFIX) set(_TWEAK_SEP ".") set(_REVISION_SEP "-") - foreach(_V EPOCH MAJOR MINOR PATCH TWEAK REVISION) + foreach( + _V + EPOCH + MAJOR + MINOR + PATCH + TWEAK + REVISION + ) if(${_V}_VERSION) set(CANONICAL_VERSION "${CANONICAL_VERSION}${_${_V}_SEP}${${_V}_VERSION}") else() @@ -125,13 +163,11 @@ function(ROCM_VERSION_COMPUTE FULL_VERSION_STRING _VAR_PREFIX) EXPR NUMERIC_VERSION "(10000 * (${MAJOR_VERSION}+0)) + (100 * (${MINOR_VERSION}+0)) + (${PATCH_VERSION}+0)" - ) + ) # propagate to parent scopes foreach(_V ${ROCmVersion_VARIABLES}) - set(${_VAR_PREFIX}_${_V}_VERSION - ${${_V}_VERSION} - PARENT_SCOPE) + set(${_VAR_PREFIX}_${_V}_VERSION ${${_V}_VERSION} PARENT_SCOPE) endforeach() endfunction() @@ -147,18 +183,18 @@ function(ROCM_VERSION_WATCH_FOR_CHANGE _var) endif() list(REMOVE_ITEM _REMAIN_VARIABLES ${_var}) - set(_REMAIN_VARIABLES - "${_REMAIN_VARIABLES}" - PARENT_SCOPE) + set(_REMAIN_VARIABLES "${_REMAIN_VARIABLES}" PARENT_SCOPE) return() else() rocm_version_message( STATUS - "${_var} changed :: ${${_rocm_version_watch_var_name}} --> ${${_var}}") + "${_var} changed :: ${${_rocm_version_watch_var_name}} --> ${${_var}}" + ) foreach(_V ${_REMAIN_VARIABLES}) rocm_version_message( - STATUS "${_var} changed :: Unsetting cache variable ${_V}...") + STATUS "${_var} changed :: Unsetting cache variable ${_V}..." + ) unset(${_V} CACHE) endforeach() endif() @@ -171,12 +207,14 @@ function(ROCM_VERSION_WATCH_FOR_CHANGE _var) # store the value for the next run set(${_rocm_version_watch_var_name} "${${_var}}" - CACHE INTERNAL "Last value of ${_var}" FORCE) + CACHE INTERNAL + "Last value of ${_var}" + FORCE + ) endfunction() # scope this to a function to avoid leaking local variables function(ROCM_VERSION_PARSE_VERSION_FILES) - # the list of variables set by module. when one of these changes, we need to unset the # cache variables after it set(_ALL_VARIABLES) @@ -193,23 +231,25 @@ function(ROCM_VERSION_PARSE_VERSION_FILES) # propagate to parent scopes foreach(_V ${ROCmVersion_VARIABLES}) - set(${_VAR_PREFIX}_${_V}_VERSION - ${${_VAR_PREFIX}_${_V}_VERSION} - PARENT_SCOPE) + set(${_VAR_PREFIX}_${_V}_VERSION ${${_VAR_PREFIX}_${_V}_VERSION} PARENT_SCOPE) endforeach() endfunction() # search for HIP to set ROCM_PATH if(NOT hip_FOUND) find_package(hip) endif() function(COMPUTE_ROCM_VERSION_DIR) - if(EXISTS "${ROCmVersion_VERSION_FILE}" AND IS_ABSOLUTE - "${ROCmVersion_VERSION_FILE}") + if( + EXISTS "${ROCmVersion_VERSION_FILE}" + AND IS_ABSOLUTE "${ROCmVersion_VERSION_FILE}" + ) get_filename_component(_VERSION_DIR "${ROCmVersion_VERSION_FILE}" PATH) get_filename_component(_VERSION_DIR "${_VERSION_DIR}/.." REALPATH) set(ROCmVersion_DIR "${_VERSION_DIR}" - CACHE PATH "Root path to ROCm's .info/${ROCmVersion_VERSION_FILE}" - ${ARGN}) + CACHE PATH + "Root path to ROCm's .info/${ROCmVersion_VERSION_FILE}" + ${ARGN} + ) rocm_version_watch_for_change(ROCmVersion_DIR) endif() endfunction() @@ -219,20 +259,36 @@ function(ROCM_VERSION_PARSE_VERSION_FILES) set(_VERSION_FILES ${_VERSION_FILE}) compute_rocm_version_dir(FORCE) else() - set(_VERSION_FILES version version-dev version-hip-libraries version-hiprt - version-hiprt-devel version-hip-sdk version-libs version-utils) + set(_VERSION_FILES + version + version-dev + version-hip-libraries + version-hiprt + version-hiprt-devel + version-hip-sdk + version-libs + version-utils + ) rocm_version_message(STATUS "ROCmVersion version files: ${_VERSION_FILES}") endif() # convert env to cache if not defined - foreach(_PATH ROCmVersion_DIR ROCmVersion_ROOT ROCmVersion_ROOT_DIR - ROCPROFSYS_DEFAULT_ROCM_PATH ROCM_PATH) + foreach( + _PATH + ROCmVersion_DIR + ROCmVersion_ROOT + ROCmVersion_ROOT_DIR + ROCPROFSYS_DEFAULT_ROCM_PATH + ROCM_PATH + ) if(NOT DEFINED ${_PATH} AND DEFINED ENV{${_PATH}}) set(_VAL "$ENV{${_PATH}}") get_filename_component(_VAL "${_VAL}" REALPATH) set(${_PATH} "${_VAL}" - CACHE PATH "Search path for ROCm version for ROCmVersion") + CACHE PATH + "Search path for ROCm version for ROCmVersion" + ) endif() endforeach() @@ -242,9 +298,15 @@ function(ROCM_VERSION_PARSE_VERSION_FILES) set(_PATHS) foreach( _DIR - ${ROCmVersion_DIR} ${ROCmVersion_ROOT} ${ROCmVersion_ROOT_DIR} - $ENV{CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH} ${ROCPROFSYS_DEFAULT_ROCM_PATH} - ${ROCM_PATH} /opt/rocm) + ${ROCmVersion_DIR} + ${ROCmVersion_ROOT} + ${ROCmVersion_ROOT_DIR} + $ENV{CMAKE_PREFIX_PATH} + ${CMAKE_PREFIX_PATH} + ${ROCPROFSYS_DEFAULT_ROCM_PATH} + ${ROCM_PATH} + /opt/rocm + ) if(EXISTS ${_DIR}) get_filename_component(_ABS_DIR "${_DIR}" REALPATH) list(APPEND _PATHS ${_ABS_DIR}) @@ -261,7 +323,9 @@ function(ROCM_VERSION_PARSE_VERSION_FILES) if(EXISTS ${_F}) set(ROCmVersion_VERSION_FILE "${_F}" - CACHE FILEPATH "File with versioning info") + CACHE FILEPATH + "File with versioning info" + ) rocm_version_watch_for_change(ROCmVersion_VERSION_FILE) compute_rocm_version_dir() else() @@ -283,7 +347,9 @@ function(ROCM_VERSION_PARSE_VERSION_FILES) set(_LOCAL_VAR ${_B}_${_V}_VERSION) set(ROCmVersion_${_V}_VERSION "${${_LOCAL_VAR}}" - CACHE STRING "ROCm ${_V} version") + CACHE STRING + "ROCm ${_V} version" + ) rocm_version_watch_for_change(${_CACHE_VAR}) endforeach() endif() @@ -296,7 +362,11 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args( ROCmVersion VERSION_VAR ROCmVersion_FULL_VERSION - REQUIRED_VARS ROCmVersion_FULL_VERSION ROCmVersion_TRIPLE_VERSION ROCmVersion_DIR - ROCmVersion_VERSION_FILE) + REQUIRED_VARS + ROCmVersion_FULL_VERSION + ROCmVersion_TRIPLE_VERSION + ROCmVersion_DIR + ROCmVersion_VERSION_FILE +) # don't add major/minor/patch/etc. version variables to required vars because they might # be zero, which will cause CMake to evaluate it as not set diff --git a/projects/rocprofiler-systems/cmake/Modules/FindTBB.cmake b/projects/rocprofiler-systems/cmake/Modules/FindTBB.cmake index e69e6f1a56..982545f108 100644 --- a/projects/rocprofiler-systems/cmake/Modules/FindTBB.cmake +++ b/projects/rocprofiler-systems/cmake/Modules/FindTBB.cmake @@ -81,8 +81,10 @@ set(TBB_SEARCH_DIR ${TBB_ROOT_DIR} $ENV{TBB_INSTALL_DIR} $ENV{TBBROOT}) # Define the search directories based on the current platform if(CMAKE_SYSTEM_NAME STREQUAL "Windows") - set(TBB_DEFAULT_SEARCH_DIR "C:/Program Files/Intel/TBB" - "C:/Program Files (x86)/Intel/TBB") + set(TBB_DEFAULT_SEARCH_DIR + "C:/Program Files/Intel/TBB" + "C:/Program Files (x86)/Intel/TBB" + ) # Set the target architecture if(CMAKE_SIZEOF_VOID_P EQUAL 8) @@ -106,7 +108,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") # Add the library path search suffix for the VC independent version of TBB list(APPEND TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc_mt") - elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") # OS X set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb") @@ -136,18 +137,22 @@ endif() # Find the TBB include dir # find_path( - TBB_INCLUDE_DIRS tbb/tbb.h + TBB_INCLUDE_DIRS + tbb/tbb.h HINTS ${TBB_INCLUDE_DIRS} ${TBB_SEARCH_DIR} PATHS ${TBB_DEFAULT_SEARCH_DIR} - PATH_SUFFIXES include) + PATH_SUFFIXES include +) # # Set version strings # if(TBB_INCLUDE_DIRS) # Starting in 2020.1.1, tbb_stddef.h is replaced by version.h - set(_version_files "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" - "${TBB_INCLUDE_DIRS}/tbb/version.h") + set(_version_files + "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" + "${TBB_INCLUDE_DIRS}/tbb/version.h" + ) foreach(f IN ITEMS ${_version_files}) if(EXISTS ${f}) set(_version_file ${f}) @@ -156,20 +161,38 @@ if(TBB_INCLUDE_DIRS) unset(_version_files) file(READ ${_version_file} _tbb_version_file) - string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" TBB_VERSION_MAJOR - "${_tbb_version_file}") - string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" TBB_VERSION_MINOR - "${_tbb_version_file}") - string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" - TBB_INTERFACE_VERSION "${_tbb_version_file}") + string( + REGEX REPLACE + ".*#define TBB_VERSION_MAJOR ([0-9]+).*" + "\\1" + TBB_VERSION_MAJOR + "${_tbb_version_file}" + ) + string( + REGEX REPLACE + ".*#define TBB_VERSION_MINOR ([0-9]+).*" + "\\1" + TBB_VERSION_MINOR + "${_tbb_version_file}" + ) + string( + REGEX REPLACE + ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" + "\\1" + TBB_INTERFACE_VERSION + "${_tbb_version_file}" + ) # The TBB_VERSION_MINOR isn't necessarily changed for minor releases Hence, we need to # read the engineering versioning in TBB_INTERFACE_VERSION to get the minor version # correct if("${TBB_VERSION_MINOR}" STREQUAL "0") math(EXPR _tbb_iface_major_ver "${TBB_INTERFACE_VERSION} / 100") - math(EXPR TBB_VERSION_MINOR - "${TBB_INTERFACE_VERSION} - ${_tbb_iface_major_ver} * 100") + math( + EXPR + TBB_VERSION_MINOR + "${TBB_INTERFACE_VERSION} - ${_tbb_iface_major_ver} * 100" + ) endif() set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}") endif() @@ -190,19 +213,24 @@ foreach(_comp ${TBB_SEARCH_COMPOMPONENTS}) # message(STATUS "Searching for ${_comp}...") message(STATUS "Hints: ${TBB_LIBRARY} # ${TBB_SEARCH_DIR}") if(";${TBB_FIND_COMPONENTS};tbb;" MATCHES ";${_comp};") - # Search for the libraries find_library( - TBB_${_comp}_LIBRARY_RELEASE ${_comp} + TBB_${_comp}_LIBRARY_RELEASE + ${_comp} HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR} - PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH - PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX} lib_release) + PATHS ${TBB_DEFAULT_SEARCH_DIR} + ENV LIBRARY_PATH + PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX} lib_release + ) find_library( - TBB_${_comp}_LIBRARY_DEBUG ${_comp}_debug + TBB_${_comp}_LIBRARY_DEBUG + ${_comp}_debug HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR} - PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH - PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX} lib_debug) + PATHS ${TBB_DEFAULT_SEARCH_DIR} + ENV LIBRARY_PATH + PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX} lib_debug + ) if(TBB_${_comp}_LIBRARY_DEBUG) list(APPEND TBB_LIBRARIES_DEBUG "${TBB_${_comp}_LIBRARY_DEBUG}") @@ -258,7 +286,8 @@ find_package_handle_standard_args( TBB REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARIES HANDLE_COMPONENTS - VERSION_VAR TBB_VERSION) + VERSION_VAR TBB_VERSION +) mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES TBB_LIBRARY_DIRS) diff --git a/projects/rocprofiler-systems/cmake/Modules/Findamd-smi.cmake b/projects/rocprofiler-systems/cmake/Modules/Findamd-smi.cmake index bbf4cea613..46965ab4dd 100644 --- a/projects/rocprofiler-systems/cmake/Modules/Findamd-smi.cmake +++ b/projects/rocprofiler-systems/cmake/Modules/Findamd-smi.cmake @@ -23,7 +23,8 @@ find_path( NAMES include/amd_smi/amdsmi.h HINTS ${_AMD_SMI_PATHS} PATHS ${_AMD_SMI_PATHS} - PATH_SUFFIXES amd_smi) + PATH_SUFFIXES amd_smi +) mark_as_advanced(amd-smi_ROOT_DIR) @@ -34,7 +35,8 @@ find_path( NAMES amd_smi/amdsmi.h HINTS ${amd-smi_ROOT_DIR} ${_AMD_SMI_PATHS} PATHS ${amd-smi_ROOT_DIR} ${_AMD_SMI_PATHS} - PATH_SUFFIXES include amd_smi/include) + PATH_SUFFIXES include amd_smi/include +) mark_as_advanced(amd-smi_INCLUDE_DIR) @@ -45,7 +47,8 @@ find_library( NAMES amd_smi HINTS ${amd-smi_ROOT_DIR} ${_AMD_SMI_PATHS} PATHS ${amd-smi_ROOT_DIR} ${_AMD_SMI_PATHS} - PATH_SUFFIXES amd-smi/lib lib) + PATH_SUFFIXES amd-smi/lib lib +) if(amd-smi_LIBRARY) get_filename_component(amd-smi_LIBRARY_DIR "${amd-smi_LIBRARY}" PATH CACHE) @@ -55,8 +58,13 @@ mark_as_advanced(amd-smi_LIBRARY) # ----------------------------------------------------------------------------------------# -find_package_handle_standard_args(amd-smi DEFAULT_MSG amd-smi_ROOT_DIR - amd-smi_INCLUDE_DIR amd-smi_LIBRARY) +find_package_handle_standard_args( + amd-smi + DEFAULT_MSG + amd-smi_ROOT_DIR + amd-smi_INCLUDE_DIR + amd-smi_LIBRARY +) # ------------------------------------------------------------------------------# @@ -69,7 +77,6 @@ if(amd-smi_FOUND) target_include_directories(amd-smi::amd-smi INTERFACE ${amd-smi_INCLUDE_DIR}) target_link_libraries(amd-smi::amd-smi INTERFACE ${amd-smi_LIBRARY}) - endif() # ------------------------------------------------------------------------------# diff --git a/projects/rocprofiler-systems/cmake/PAPI.cmake b/projects/rocprofiler-systems/cmake/PAPI.cmake index 70ec1e9cff..0c793efd71 100644 --- a/projects/rocprofiler-systems/cmake/PAPI.cmake +++ b/projects/rocprofiler-systems/cmake/PAPI.cmake @@ -12,44 +12,51 @@ rocprofiler_systems_checkout_git_submodule( WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} REPO_URL https://bitbucket.org/icl/papi.git REPO_BRANCH effd1ef4e0fd4b80e36546791277215a2d6b9eba - TEST_FILE src/configure) + TEST_FILE src/configure +) -set(PAPI_LIBPFM_SOVERSION - "4.11.1" - CACHE STRING "libpfm.so version") +set(PAPI_LIBPFM_SOVERSION "4.11.1" CACHE STRING "libpfm.so version") set(ROCPROFSYS_PAPI_SOURCE_DIR ${PROJECT_BINARY_DIR}/external/papi/source) set(ROCPROFSYS_PAPI_INSTALL_DIR ${PROJECT_BINARY_DIR}/external/papi/install) if(NOT EXISTS "${ROCPROFSYS_PAPI_SOURCE_DIR}") execute_process( - COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/external/papi - ${ROCPROFSYS_PAPI_SOURCE_DIR}) + COMMAND + ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/external/papi + ${ROCPROFSYS_PAPI_SOURCE_DIR} + ) endif() if(NOT EXISTS "${ROCPROFSYS_PAPI_INSTALL_DIR}") - execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory - ${ROCPROFSYS_PAPI_INSTALL_DIR}) - execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory - ${ROCPROFSYS_PAPI_INSTALL_DIR}/include) - execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory - ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib) + execute_process( + COMMAND ${CMAKE_COMMAND} -E make_directory ${ROCPROFSYS_PAPI_INSTALL_DIR} + ) + execute_process( + COMMAND ${CMAKE_COMMAND} -E make_directory ${ROCPROFSYS_PAPI_INSTALL_DIR}/include + ) + execute_process( + COMMAND ${CMAKE_COMMAND} -E make_directory ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib + ) execute_process( COMMAND ${CMAKE_COMMAND} -E touch ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpapi.a ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.a - ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.so) + ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.so + ) set(_ROCPROFSYS_PAPI_BUILD_BYPRODUCTS ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpapi.a ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.a - ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.so) + ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.so + ) endif() # Set ROCPROFSYS_PAPI_CONFIGURE_JOBS for commands that need to be run nonparallel set(ROCPROFSYS_PAPI_CONFIGURE_JOBS 1) rocprofiler_systems_add_option(ROCPROFSYS_PAPI_AUTO_COMPONENTS - "Automatically enable components" OFF) + "Automatically enable components" OFF +) # -------------- PACKAGES ----------------------------------------------------- @@ -89,10 +96,13 @@ set(_ROCPROFSYS_VALID_PAPI_COMPONENTS sensors_ppc stealtime sysdetect - vmware) + vmware +) set(ROCPROFSYS_VALID_PAPI_COMPONENTS "${_ROCPROFSYS_VALID_PAPI_COMPONENTS}" - CACHE STRING "Valid PAPI components") + CACHE STRING + "Valid PAPI components" +) mark_as_advanced(ROCPROFSYS_VALID_PAPI_COMPONENTS) # default components which do not require 3rd-party headers or libraries @@ -106,12 +116,14 @@ set(_ROCPROFSYS_PAPI_COMPONENTS perf_event perf_event_uncore # rapl stealtime - ) +) if(ROCPROFSYS_PAPI_AUTO_COMPONENTS) # lmsensors - find_path(ROCPROFSYS_PAPI_LMSENSORS_ROOT_DIR NAMES include/sensors/sensors.h - include/sensors.h) + find_path( + ROCPROFSYS_PAPI_LMSENSORS_ROOT_DIR + NAMES include/sensors/sensors.h include/sensors.h + ) if(ROCPROFSYS_PAPI_LMSENSORS_ROOT_DIR) list(APPEND _ROCPROFSYS_PAPI_COMPONENTS lmsensors) @@ -119,10 +131,7 @@ if(ROCPROFSYS_PAPI_AUTO_COMPONENTS) # pcp find_path(ROCPROFSYS_PAPI_PCP_ROOT_DIR NAMES include/pcp/impl.h) - find_library( - ROCPROFSYS_PAPI_PCP_LIBRARY - NAMES pcp - PATH_SUFFIXES lib lib64) + find_library(ROCPROFSYS_PAPI_PCP_LIBRARY NAMES pcp PATH_SUFFIXES lib lib64) if(ROCPROFSYS_PAPI_PCP_ROOT_DIR AND ROCPROFSYS_PAPI_PCP_LIBRARY) list(APPEND _ROCPROFSYS_PAPI_COMPONENTS pcp) @@ -132,19 +141,26 @@ endif() # set the ROCPROFSYS_PAPI_COMPONENTS cache variable set(ROCPROFSYS_PAPI_COMPONENTS "${_ROCPROFSYS_PAPI_COMPONENTS}" - CACHE STRING "PAPI components") + CACHE STRING + "PAPI components" +) rocprofiler_systems_add_feature(ROCPROFSYS_PAPI_COMPONENTS "PAPI components") string(REPLACE ";" "\ " _ROCPROFSYS_PAPI_COMPONENTS "${ROCPROFSYS_PAPI_COMPONENTS}") set(ROCPROFSYS_PAPI_EXTRA_ENV) foreach(_COMP ${ROCPROFSYS_PAPI_COMPONENTS}) - string(REPLACE ";" ", " _ROCPROFSYS_VALID_PAPI_COMPONENTS_MSG - "${ROCPROFSYS_VALID_PAPI_COMPONENTS}") + string( + REPLACE + ";" + ", " + _ROCPROFSYS_VALID_PAPI_COMPONENTS_MSG + "${ROCPROFSYS_VALID_PAPI_COMPONENTS}" + ) if(NOT "${_COMP}" IN_LIST ROCPROFSYS_VALID_PAPI_COMPONENTS) rocprofiler_systems_message( AUTHOR_WARNING "ROCPROFSYS_PAPI_COMPONENTS contains an unknown component '${_COMP}'. Known components: ${_ROCPROFSYS_VALID_PAPI_COMPONENTS_MSG}" - ) + ) endif() unset(_ROCPROFSYS_VALID_PAPI_COMPONENTS_MSG) endforeach() @@ -155,32 +171,34 @@ if("rocm" IN_LIST ROCPROFSYS_PAPI_COMPONENTS) endif() if("lmsensors" IN_LIST ROCPROFSYS_PAPI_COMPONENTS AND ROCPROFSYS_PAPI_LMSENSORS_ROOT_DIR) - list(APPEND ROCPROFSYS_PAPI_EXTRA_ENV - PAPI_LMSENSORS_ROOT=${ROCPROFSYS_PAPI_LMSENSORS_ROOT_DIR}) + list( + APPEND + ROCPROFSYS_PAPI_EXTRA_ENV + PAPI_LMSENSORS_ROOT=${ROCPROFSYS_PAPI_LMSENSORS_ROOT_DIR} + ) endif() if("pcp" IN_LIST ROCPROFSYS_PAPI_COMPONENTS AND ROCPROFSYS_PAPI_PCP_ROOT_DIR) list(APPEND ROCPROFSYS_PAPI_EXTRA_ENV PAPI_PCP_ROOT=${ROCPROFSYS_PAPI_PCP_ROOT_DIR}) endif() -if("perf_event_uncore" IN_LIST ROCPROFSYS_PAPI_COMPONENTS AND NOT "perf_event" IN_LIST - ROCPROFSYS_PAPI_COMPONENTS) +if( + "perf_event_uncore" IN_LIST ROCPROFSYS_PAPI_COMPONENTS + AND NOT "perf_event" IN_LIST ROCPROFSYS_PAPI_COMPONENTS +) rocprofiler_systems_message( FATAL_ERROR "ROCPROFSYS_PAPI_COMPONENTS :: 'perf_event_uncore' requires 'perf_event' component" - ) + ) endif() -find_program( - MAKE_EXECUTABLE - NAMES make gmake - PATH_SUFFIXES bin) +find_program(MAKE_EXECUTABLE NAMES make gmake PATH_SUFFIXES bin) if(NOT MAKE_EXECUTABLE) rocprofiler_systems_message( FATAL_ERROR "make/gmake executable not found. Please re-run with -DMAKE_EXECUTABLE=/path/to/make" - ) + ) endif() set(_PAPI_C_COMPILER ${CMAKE_C_COMPILER}) @@ -190,12 +208,10 @@ if(CMAKE_C_COMPILER_IS_CLANG) set(_PAPI_C_COMPILER ${ROCPROFSYS_GNU_C_COMPILER}) endif() endif() -set(PAPI_C_COMPILER - ${_PAPI_C_COMPILER} - CACHE FILEPATH "C compiler used to compile PAPI") +set(PAPI_C_COMPILER ${_PAPI_C_COMPILER} CACHE FILEPATH "C compiler used to compile PAPI") include(ExternalProject) -externalproject_add( +ExternalProject_Add( rocprofiler-systems-papi-build PREFIX ${PROJECT_BINARY_DIR}/external/papi SOURCE_DIR ${ROCPROFSYS_PAPI_SOURCE_DIR}/src @@ -218,7 +234,8 @@ externalproject_add( CFLAGS=-fPIC\ -O3\ -Wno-stringop-truncation\ -Wno-use-after-free ${ROCPROFSYS_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} utils install-utils -s INSTALL_COMMAND "" - BUILD_BYPRODUCTS "${_ROCPROFSYS_PAPI_BUILD_BYPRODUCTS}") + BUILD_BYPRODUCTS "${_ROCPROFSYS_PAPI_BUILD_BYPRODUCTS}" +) # target for re-executing the installation add_custom_target( @@ -232,7 +249,8 @@ add_custom_target( CFLAGS=-fPIC\ -O3\ -Wno-stringop-truncation\ -Wno-use-after-free ${ROCPROFSYS_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} utils install-utils -s WORKING_DIRECTORY ${ROCPROFSYS_PAPI_SOURCE_DIR}/src - COMMENT "Installing PAPI...") + COMMENT "Installing PAPI..." +) add_custom_target( rocprofiler-systems-papi-clean @@ -244,42 +262,67 @@ add_custom_target( ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.a ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.so WORKING_DIRECTORY ${ROCPROFSYS_PAPI_SOURCE_DIR}/src - COMMENT "Cleaning PAPI...") + COMMENT "Cleaning PAPI..." +) set(PAPI_ROOT_DIR ${ROCPROFSYS_PAPI_INSTALL_DIR} - CACHE PATH "Root PAPI installation" FORCE) + CACHE PATH + "Root PAPI installation" + FORCE +) set(PAPI_INCLUDE_DIR ${ROCPROFSYS_PAPI_INSTALL_DIR}/include - CACHE PATH "PAPI include folder" FORCE) + CACHE PATH + "PAPI include folder" + FORCE +) set(PAPI_LIBRARY ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpapi.a - CACHE FILEPATH "PAPI library" FORCE) + CACHE FILEPATH + "PAPI library" + FORCE +) set(PAPI_pfm_LIBRARY ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.so - CACHE FILEPATH "PAPI library" FORCE) + CACHE FILEPATH + "PAPI library" + FORCE +) set(PAPI_STATIC_LIBRARY ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpapi.a - CACHE FILEPATH "PAPI library" FORCE) + CACHE FILEPATH + "PAPI library" + FORCE +) set(PAPI_pfm_STATIC_LIBRARY ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.a - CACHE FILEPATH "PAPI library" FORCE) + CACHE FILEPATH + "PAPI library" + FORCE +) -target_include_directories(rocprofiler-systems-papi SYSTEM - INTERFACE $) +target_include_directories( + rocprofiler-systems-papi + SYSTEM + INTERFACE $ +) target_link_libraries( - rocprofiler-systems-papi INTERFACE $ - $) + rocprofiler-systems-papi + INTERFACE $ $ +) rocprofiler_systems_target_compile_definitions( rocprofiler-systems-papi INTERFACE ROCPROFSYS_USE_PAPI - $) + $ +) install( DIRECTORY ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/ DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME} COMPONENT papi FILES_MATCHING - PATTERN "*.so*") + PATTERN "*.so*" +) foreach( _UTIL_EXE @@ -297,8 +340,8 @@ foreach( papi_multiplex_cost papi_native_avail papi_version - papi_xml_event_info) - + papi_xml_event_info +) string(REPLACE "_" "-" _UTIL_EXE_INSTALL_NAME "${BINARY_NAME_PREFIX}-${_UTIL_EXE}") # RPM installer on RedHat/RockyLinux throws error that #!/usr/bin/python should either @@ -307,12 +350,21 @@ foreach( file( READ "${PROJECT_BINARY_DIR}/external/papi/source/src/high-level/scripts/${_UTIL_EXE}" - _HL_OUTPUT_WRITER) - string(REPLACE "#!/usr/bin/python\n" "#!/usr/bin/python3\n" _HL_OUTPUT_WRITER - "${_HL_OUTPUT_WRITER}") + _HL_OUTPUT_WRITER + ) + string( + REPLACE + "#!/usr/bin/python\n" + "#!/usr/bin/python3\n" + _HL_OUTPUT_WRITER + "${_HL_OUTPUT_WRITER}" + ) file(MAKE_DIRECTORY "${ROCPROFSYS_PAPI_INSTALL_DIR}/bin") - file(WRITE "${ROCPROFSYS_PAPI_INSTALL_DIR}/bin/${_UTIL_EXE}3" - "${_HL_OUTPUT_WRITER}") + file( + WRITE + "${ROCPROFSYS_PAPI_INSTALL_DIR}/bin/${_UTIL_EXE}3" + "${_HL_OUTPUT_WRITER}" + ) set(_UTIL_EXE "${_UTIL_EXE}3") # python script file install to libexec @@ -321,7 +373,8 @@ foreach( DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/${PROJECT_NAME} RENAME ${_UTIL_EXE_INSTALL_NAME} COMPONENT papi - OPTIONAL) + OPTIONAL + ) else() # Binary files moved to bin install( @@ -329,6 +382,7 @@ foreach( DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME} RENAME ${_UTIL_EXE_INSTALL_NAME} COMPONENT papi - OPTIONAL) + OPTIONAL + ) endif() endforeach() diff --git a/projects/rocprofiler-systems/cmake/Packages.cmake b/projects/rocprofiler-systems/cmake/Packages.cmake index 936df562ee..f24c2c653a 100644 --- a/projects/rocprofiler-systems/cmake/Packages.cmake +++ b/projects/rocprofiler-systems/cmake/Packages.cmake @@ -9,43 +9,60 @@ include_guard(DIRECTORY) rocprofiler_systems_add_interface_library( rocprofiler-systems-headers - "Provides minimal set of include flags to compile with rocprofiler-systems") + "Provides minimal set of include flags to compile with rocprofiler-systems" +) rocprofiler_systems_add_interface_library(rocprofiler-systems-threading - "Enables multithreading support") + "Enables multithreading support" +) rocprofiler_systems_add_interface_library( rocprofiler-systems-dyninst - "Provides flags and libraries for Dyninst (dynamic instrumentation)") + "Provides flags and libraries for Dyninst (dynamic instrumentation)" +) rocprofiler_systems_add_interface_library(rocprofiler-systems-boost - "Boost interface library (for Dyninst)") + "Boost interface library (for Dyninst)" +) rocprofiler_systems_add_interface_library(rocprofiler-systems-elfutils - "ElfUtils interface library (for Dyninst)") + "ElfUtils interface library (for Dyninst)" +) rocprofiler_systems_add_interface_library(rocprofiler-systems-libiberty - "LibIberty interface library (for Dyninst)") + "LibIberty interface library (for Dyninst)" +) rocprofiler_systems_add_interface_library( - rocprofiler-systems-tbb "Threading Building Blocks interface library (for Dyninst)") + rocprofiler-systems-tbb "Threading Building Blocks interface library (for Dyninst)" +) rocprofiler_systems_add_interface_library(rocprofiler-systems-rocm - "Provides flags and libraries for ROCm") + "Provides flags and libraries for ROCm" +) rocprofiler_systems_add_interface_library(rocprofiler-systems-mpi - "Provides MPI or MPI headers") + "Provides MPI or MPI headers" +) rocprofiler_systems_add_interface_library(rocprofiler-systems-libva - "Provides VA-API headers") + "Provides VA-API headers" +) rocprofiler_systems_add_interface_library(rocprofiler-systems-bfd - "Provides Binary File Descriptor (BFD)") + "Provides Binary File Descriptor (BFD)" +) rocprofiler_systems_add_interface_library(rocprofiler-systems-ptl - "Enables PTL support (tasking)") + "Enables PTL support (tasking)" +) rocprofiler_systems_add_interface_library(rocprofiler-systems-papi "Enable PAPI support") rocprofiler_systems_add_interface_library(rocprofiler-systems-ompt "Enable OMPT support") rocprofiler_systems_add_interface_library(rocprofiler-systems-python - "Enables Python support") + "Enables Python support" +) rocprofiler_systems_add_interface_library(rocprofiler-systems-perfetto - "Enables Perfetto support") + "Enables Perfetto support" +) rocprofiler_systems_add_interface_library(rocprofiler-systems-timemory - "Provides timemory libraries") + "Provides timemory libraries" +) rocprofiler_systems_add_interface_library( rocprofiler-systems-timemory-config - "CMake interface library applied to all timemory targets") + "CMake interface library applied to all timemory targets" +) rocprofiler_systems_add_interface_library(rocprofiler-systems-compile-definitions - "Compile definitions") + "Compile definitions" +) # libraries with relevant compile definitions set(ROCPROFSYS_EXTENSION_LIBRARIES @@ -55,35 +72,44 @@ set(ROCPROFSYS_EXTENSION_LIBRARIES rocprofiler-systems::rocprofiler-systems-ptl rocprofiler-systems::rocprofiler-systems-ompt rocprofiler-systems::rocprofiler-systems-papi - rocprofiler-systems::rocprofiler-systems-perfetto) + rocprofiler-systems::rocprofiler-systems-perfetto +) target_include_directories( rocprofiler-systems-headers - INTERFACE $ - $ - $ - $ - $ - $) + INTERFACE + $ + $ + $ + $ + $ + $ +) # include threading because of rooflines -target_link_libraries(rocprofiler-systems-headers - INTERFACE rocprofiler-systems::rocprofiler-systems-threading) +target_link_libraries( + rocprofiler-systems-headers + INTERFACE rocprofiler-systems::rocprofiler-systems-threading +) # ensure the env overrides the appending /opt/rocm later string(REPLACE ":" ";" CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH};${CMAKE_PREFIX_PATH}") -set(ROCPROFSYS_DEFAULT_ROCM_PATH - /opt/rocm - CACHE PATH "Default search path for ROCM") +set(ROCPROFSYS_DEFAULT_ROCM_PATH /opt/rocm CACHE PATH "Default search path for ROCM") if(EXISTS ${ROCPROFSYS_DEFAULT_ROCM_PATH}) - get_filename_component(_ROCPROFSYS_DEFAULT_ROCM_PATH - "${ROCPROFSYS_DEFAULT_ROCM_PATH}" REALPATH) + get_filename_component( + _ROCPROFSYS_DEFAULT_ROCM_PATH + "${ROCPROFSYS_DEFAULT_ROCM_PATH}" + REALPATH + ) if(NOT "${_ROCPROFSYS_DEFAULT_ROCM_PATH}" STREQUAL "${ROCPROFSYS_DEFAULT_ROCM_PATH}") set(ROCPROFSYS_DEFAULT_ROCM_PATH "${_ROCPROFSYS_DEFAULT_ROCM_PATH}" - CACHE PATH "Default search path for ROCM" FORCE) + CACHE PATH + "Default search path for ROCM" + FORCE + ) endif() endif() @@ -105,8 +131,11 @@ find_package_handle_standard_args(pthread-library REQUIRED_VARS pthread_LIBRARY) if(pthread_LIBRARY) target_link_libraries(rocprofiler-systems-threading INTERFACE ${pthread_LIBRARY}) else() - find_package(Threads ${rocprofiler_systems_FIND_QUIETLY} - ${rocprofiler_systems_FIND_REQUIREMENT}) + find_package( + Threads + ${rocprofiler_systems_FIND_QUIETLY} + ${rocprofiler_systems_FIND_REQUIREMENT} + ) if(Threads_FOUND) target_link_libraries(rocprofiler-systems-threading INTERFACE Threads::Threads) endif() @@ -131,8 +160,12 @@ if(ROCPROFSYS_USE_ROCM) if(NOT ROCmVersion_FOUND) find_package( - hip ${rocprofiler_systems_FIND_QUIETLY} REQUIRED HINTS - ${ROCPROFSYS_DEFAULT_ROCM_PATH} PATHS ${ROCPROFSYS_DEFAULT_ROCM_PATH}) + hip + ${rocprofiler_systems_FIND_QUIETLY} + REQUIRED + HINTS ${ROCPROFSYS_DEFAULT_ROCM_PATH} + PATHS ${ROCPROFSYS_DEFAULT_ROCM_PATH} + ) if(SPACK_BUILD) find_package(ROCmVersion HINTS ${ROCM_PATH} PATHS ${ROCM_PATH}) else() @@ -148,7 +181,9 @@ if(ROCPROFSYS_USE_ROCM) set(_LOCAL_VAR _local_${_V}_VERSION) set(ROCmVersion_${_V}_VERSION "${${_LOCAL_VAR}}" - CACHE STRING "ROCm ${_V} version") + CACHE STRING + "ROCm ${_V} version" + ) rocm_version_watch_for_change(${_CACHE_VAR}) endforeach() else() @@ -162,7 +197,8 @@ if(ROCPROFSYS_USE_ROCM) set(ROCPROFSYS_ROCM_VERSION ${ROCmVersion_TRIPLE_VERSION}) rocprofiler_systems_add_feature(ROCPROFSYS_ROCM_VERSION - "ROCm version used by rocprofiler-systems") + "ROCm version used by rocprofiler-systems" + ) else() set(ROCPROFSYS_ROCM_VERSION "0.0.0") set(ROCPROFSYS_ROCM_VERSION_MAJOR 0) @@ -179,9 +215,12 @@ endif() if(ROCPROFSYS_USE_ROCM) find_package(rocprofiler-sdk ${rocprofiler_systems_FIND_QUIETLY} REQUIRED) rocprofiler_systems_target_compile_definitions(rocprofiler-systems-rocm - INTERFACE ROCPROFSYS_USE_ROCM) - target_link_libraries(rocprofiler-systems-rocm - INTERFACE rocprofiler-sdk::rocprofiler-sdk) + INTERFACE ROCPROFSYS_USE_ROCM + ) + target_link_libraries( + rocprofiler-systems-rocm + INTERFACE rocprofiler-sdk::rocprofiler-sdk + ) find_package(amd-smi ${rocprofiler_systems_FIND_QUIETLY} REQUIRED) target_link_libraries(rocprofiler-systems-rocm INTERFACE amd-smi::amd-smi) @@ -200,11 +239,13 @@ if(ROCPROFSYS_USE_MPI) find_package(MPI ${rocprofiler_systems_FIND_QUIETLY} REQUIRED) target_link_libraries(rocprofiler-systems-mpi INTERFACE MPI::MPI_C MPI::MPI_CXX) rocprofiler_systems_target_compile_definitions(rocprofiler-systems-mpi - INTERFACE ROCPROFSYS_USE_MPI) + INTERFACE ROCPROFSYS_USE_MPI + ) elseif(ROCPROFSYS_USE_MPI_HEADERS) find_package(MPI-Headers ${rocprofiler_systems_FIND_QUIETLY} REQUIRED) rocprofiler_systems_target_compile_definitions(rocprofiler-systems-mpi - INTERFACE ROCPROFSYS_USE_MPI_HEADERS) + INTERFACE ROCPROFSYS_USE_MPI_HEADERS + ) target_link_libraries(rocprofiler-systems-mpi INTERFACE MPI::MPI_HEADERS) endif() @@ -215,7 +256,8 @@ endif() # ----------------------------------------------------------------------------------------# rocprofiler_systems_target_compile_definitions( - rocprofiler-systems-ompt INTERFACE ROCPROFSYS_USE_OMPT=$) + rocprofiler-systems-ompt INTERFACE ROCPROFSYS_USE_OMPT=$ +) # ----------------------------------------------------------------------------------------# # @@ -228,26 +270,17 @@ if(ROCPROFSYS_BUILD_DYNINST) RELATIVE_PATH external/dyninst WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} REPO_URL https://github.com/ROCm/dyninst.git - REPO_BRANCH dyninst_13) + REPO_BRANCH dyninst_13 + ) set(DYNINST_OPTION_PREFIX ON) set(DYNINST_BUILD_DOCS OFF) set(DYNINST_BUILD_RTLIB OFF) - set(DYNINST_QUIET_CONFIG - ON - CACHE BOOL "Suppress dyninst cmake messages") - set(DYNINST_BUILD_PARSE_THAT - OFF - CACHE BOOL "Build dyninst parseThat executable") - set(DYNINST_BUILD_SHARED_LIBS - ON - CACHE BOOL "Build shared dyninst libraries") - set(DYNINST_BUILD_STATIC_LIBS - OFF - CACHE BOOL "Build static dyninst libraries") - set(DYNINST_ENABLE_LTO - OFF - CACHE BOOL "Enable LTO for dyninst libraries") + set(DYNINST_QUIET_CONFIG ON CACHE BOOL "Suppress dyninst cmake messages") + set(DYNINST_BUILD_PARSE_THAT OFF CACHE BOOL "Build dyninst parseThat executable") + set(DYNINST_BUILD_SHARED_LIBS ON CACHE BOOL "Build shared dyninst libraries") + set(DYNINST_BUILD_STATIC_LIBS OFF CACHE BOOL "Build static dyninst libraries") + set(DYNINST_ENABLE_LTO OFF CACHE BOOL "Enable LTO for dyninst libraries") if(NOT DEFINED CMAKE_INSTALL_RPATH) set(CMAKE_INSTALL_RPATH "") @@ -259,7 +292,8 @@ if(ROCPROFSYS_BUILD_DYNINST) rocprofiler_systems_save_variables( PIC VARIABLES CMAKE_POSITION_INDEPENDENT_CODE CMAKE_INSTALL_RPATH - CMAKE_BUILD_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH) + CMAKE_BUILD_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH + ) set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH OFF) @@ -267,18 +301,33 @@ if(ROCPROFSYS_BUILD_DYNINST) set(CMAKE_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/${PROJECT_NAME}") set(DYNINST_TPL_INSTALL_PREFIX "${PROJECT_NAME}" - CACHE PATH "Third-party library install-tree install prefix" FORCE) + CACHE PATH + "Third-party library install-tree install prefix" + FORCE + ) set(DYNINST_TPL_INSTALL_LIB_DIR "${PROJECT_NAME}" - CACHE PATH "Third-party library install-tree install library prefix" FORCE) + CACHE PATH + "Third-party library install-tree install library prefix" + FORCE + ) add_subdirectory(external/dyninst EXCLUDE_FROM_ALL) rocprofiler_systems_restore_variables( PIC VARIABLES CMAKE_POSITION_INDEPENDENT_CODE CMAKE_INSTALL_RPATH - CMAKE_BUILD_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH) + CMAKE_BUILD_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH + ) add_library(Dyninst::Dyninst INTERFACE IMPORTED) - foreach(_LIB common dyninstAPI parseAPI instructionAPI symtabAPI stackwalk) + foreach( + _LIB + common + dyninstAPI + parseAPI + instructionAPI + symtabAPI + stackwalk + ) target_link_libraries(Dyninst::Dyninst INTERFACE Dyninst::${_LIB}) endforeach() @@ -293,14 +342,16 @@ if(ROCPROFSYS_BUILD_DYNINST) patchAPI pcontrol stackwalk - symtabAPI) + symtabAPI + ) if(TARGET ${_LIB}) install( TARGETS ${_LIB} DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME} COMPONENT dyninst PUBLIC_HEADER - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/dyninst) + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/dyninst + ) endif() endforeach() @@ -315,7 +366,8 @@ if(ROCPROFSYS_BUILD_DYNINST) patchAPI pcontrol stackwalk - symtabAPI) + symtabAPI + ) if(TARGET ${_LIB}) add_dependencies(${_LIB} external-prebuild) if(NOT TARGET Dyninst::${_LIB}) @@ -325,18 +377,24 @@ if(ROCPROFSYS_BUILD_DYNINST) endforeach() target_link_libraries(rocprofiler-systems-dyninst INTERFACE Dyninst::Dyninst) - else() # Find Boost before finding Dyninst find_package(Boost) if(NOT TARGET Dyninst::Boost_headers) add_library(Dyninst::Boost_headers INTERFACE IMPORTED) - target_include_directories(Dyninst::Boost_headers SYSTEM - INTERFACE ${Boost_INCLUDE_DIRS}) + target_include_directories( + Dyninst::Boost_headers + SYSTEM + INTERFACE ${Boost_INCLUDE_DIRS} + ) endif() - find_package(Dyninst ${rocprofiler_systems_FIND_QUIETLY} REQUIRED - COMPONENTS dyninstAPI parseAPI instructionAPI symtabAPI) + find_package( + Dyninst + ${rocprofiler_systems_FIND_QUIETLY} + REQUIRED + COMPONENTS dyninstAPI parseAPI instructionAPI symtabAPI + ) if(TARGET Dyninst::Dyninst) # updated Dyninst CMake system was found target_link_libraries(rocprofiler-systems-dyninst INTERFACE Dyninst::Dyninst) @@ -344,22 +402,33 @@ else() set(_BOOST_COMPONENTS atomic system thread date_time) set(rocprofiler_systems_BOOST_COMPONENTS "${_BOOST_COMPONENTS}" - CACHE STRING "Boost components used by Dyninst in rocprofiler-systems") + CACHE STRING + "Boost components used by Dyninst in rocprofiler-systems" + ) set(Boost_NO_BOOST_CMAKE ON) - find_package(Boost QUIET REQUIRED - COMPONENTS ${rocprofiler_systems_BOOST_COMPONENTS}) + find_package( + Boost + QUIET + REQUIRED + COMPONENTS ${rocprofiler_systems_BOOST_COMPONENTS} + ) # some installs of dyninst don't set this properly if(EXISTS "${DYNINST_INCLUDE_DIR}" AND NOT DYNINST_HEADER_DIR) - get_filename_component(DYNINST_HEADER_DIR "${DYNINST_INCLUDE_DIR}" REALPATH - CACHE) + get_filename_component( + DYNINST_HEADER_DIR + "${DYNINST_INCLUDE_DIR}" + REALPATH + CACHE + ) else() find_path( DYNINST_HEADER_DIR NAMES BPatch.h dyninstAPI_RT.h HINTS ${Dyninst_ROOT_DIR} ${Dyninst_DIR} ${Dyninst_DIR}/../../.. PATHS ${Dyninst_ROOT_DIR} ${Dyninst_DIR} ${Dyninst_DIR}/../../.. - PATH_SUFFIXES include) + PATH_SUFFIXES include + ) endif() # try to find TBB @@ -372,14 +441,13 @@ else() endif() if(NOT TBB_FOUND) - find_path( - TBB_INCLUDE_DIR - NAMES tbb/tbb.h - PATH_SUFFIXES include) + find_path(TBB_INCLUDE_DIR NAMES tbb/tbb.h PATH_SUFFIXES include) endif() - target_link_libraries(rocprofiler-systems-dyninst INTERFACE ${DYNINST_LIBRARIES} - ${Boost_LIBRARIES}) + target_link_libraries( + rocprofiler-systems-dyninst + INTERFACE ${DYNINST_LIBRARIES} ${Boost_LIBRARIES} + ) foreach( _TARG dyninst @@ -392,22 +460,30 @@ else() system thread date_time - TBB) + TBB + ) if(TARGET Dyninst::${_TARG}) - target_link_libraries(rocprofiler-systems-dyninst - INTERFACE Dyninst::${_TARG}) + target_link_libraries( + rocprofiler-systems-dyninst + INTERFACE Dyninst::${_TARG} + ) elseif(TARGET Boost::${_TARG}) - target_link_libraries(rocprofiler-systems-dyninst - INTERFACE Boost::${_TARG}) + target_link_libraries( + rocprofiler-systems-dyninst + INTERFACE Boost::${_TARG} + ) elseif(TARGET ${_TARG}) target_link_libraries(rocprofiler-systems-dyninst INTERFACE ${_TARG}) endif() endforeach() target_include_directories( - rocprofiler-systems-dyninst SYSTEM - INTERFACE ${TBB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${DYNINST_HEADER_DIR}) + rocprofiler-systems-dyninst + SYSTEM + INTERFACE ${TBB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${DYNINST_HEADER_DIR} + ) rocprofiler_systems_target_compile_definitions(rocprofiler-systems-dyninst - INTERFACE ROCPROFSYS_USE_DYNINST) + INTERFACE ROCPROFSYS_USE_DYNINST + ) endif() endif() @@ -451,7 +527,8 @@ rocprofiler_systems_checkout_git_submodule( WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} REPO_URL https://github.com/google/perfetto.git REPO_BRANCH v46.0 - TEST_FILE sdk/perfetto.cc) + TEST_FILE sdk/perfetto.cc +) include(Perfetto) @@ -466,7 +543,8 @@ if(ROCPROFSYS_BUILD_DEVICETRACE) RELATIVE_PATH external/elfio WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} REPO_URL https://github.com/jrmadsen/ELFIO.git - REPO_BRANCH set-offset-support) + REPO_BRANCH set-offset-support + ) add_subdirectory(external/elfio) endif() @@ -489,123 +567,144 @@ endif() target_compile_definitions( rocprofiler-systems-timemory-config - INTERFACE TIMEMORY_PAPI_ARRAY_SIZE=12 TIMEMORY_USE_ROOFLINE=0 TIMEMORY_USE_ERT=0 - TIMEMORY_USE_CONTAINERS=0 TIMEMORY_USE_ERT_EXTERN=0 - TIMEMORY_USE_CONTAINERS_EXTERN=0) + INTERFACE + TIMEMORY_PAPI_ARRAY_SIZE=12 + TIMEMORY_USE_ROOFLINE=0 + TIMEMORY_USE_ERT=0 + TIMEMORY_USE_CONTAINERS=0 + TIMEMORY_USE_ERT_EXTERN=0 + TIMEMORY_USE_CONTAINERS_EXTERN=0 +) if(ROCPROFSYS_BUILD_STACK_PROTECTOR) add_target_flag_if_avail(rocprofiler-systems-timemory-config - "-fstack-protector-strong" "-Wstack-protector") + "-fstack-protector-strong" "-Wstack-protector" + ) endif() if(ROCPROFSYS_BUILD_DEBUG) add_target_flag_if_avail(rocprofiler-systems-timemory-config - "-fno-omit-frame-pointer" "-g3") + "-fno-omit-frame-pointer" "-g3" + ) endif() set(TIMEMORY_EXTERNAL_INTERFACE_LIBRARY rocprofiler-systems-timemory-config - CACHE STRING "timemory configuration interface library") -set(TIMEMORY_INSTALL_HEADERS - OFF - CACHE BOOL "Disable timemory header install") -set(TIMEMORY_INSTALL_CONFIG - OFF - CACHE BOOL "Disable timemory cmake configuration install") + CACHE STRING + "timemory configuration interface library" +) +set(TIMEMORY_INSTALL_HEADERS OFF CACHE BOOL "Disable timemory header install") +set(TIMEMORY_INSTALL_CONFIG OFF CACHE BOOL "Disable timemory cmake configuration install") set(TIMEMORY_INSTALL_LIBRARIES OFF - CACHE BOOL "Disable timemory installation of libraries not needed at runtime") -set(TIMEMORY_INSTALL_ALL - OFF - CACHE BOOL "Disable install target depending on all target") -set(TIMEMORY_BUILD_C - OFF - CACHE BOOL "Disable timemory C library") -set(TIMEMORY_BUILD_FORTRAN - OFF - CACHE BOOL "Disable timemory Fortran library") -set(TIMEMORY_BUILD_TOOLS - OFF - CACHE BOOL "Ensure timem executable is built") + CACHE BOOL + "Disable timemory installation of libraries not needed at runtime" +) +set(TIMEMORY_INSTALL_ALL OFF CACHE BOOL "Disable install target depending on all target") +set(TIMEMORY_BUILD_C OFF CACHE BOOL "Disable timemory C library") +set(TIMEMORY_BUILD_FORTRAN OFF CACHE BOOL "Disable timemory Fortran library") +set(TIMEMORY_BUILD_TOOLS OFF CACHE BOOL "Ensure timem executable is built") set(TIMEMORY_BUILD_EXCLUDE_FROM_ALL ON - CACHE BOOL "Set timemory to only build dependencies") + CACHE BOOL + "Set timemory to only build dependencies" +) set(TIMEMORY_BUILD_HIDDEN_VISIBILITY ON - CACHE BOOL "Build timemory with hidden visibility") -set(TIMEMORY_QUIET_CONFIG - ON - CACHE BOOL "Make timemory configuration quieter") + CACHE BOOL + "Build timemory with hidden visibility" +) +set(TIMEMORY_QUIET_CONFIG ON CACHE BOOL "Make timemory configuration quieter") # timemory feature settings -set(TIMEMORY_USE_GOTCHA - ON - CACHE BOOL "Enable GOTCHA support in timemory") -set(TIMEMORY_USE_PERFETTO - OFF - CACHE BOOL "Disable perfetto support in timemory") +set(TIMEMORY_USE_GOTCHA ON CACHE BOOL "Enable GOTCHA support in timemory") +set(TIMEMORY_USE_PERFETTO OFF CACHE BOOL "Disable perfetto support in timemory") set(TIMEMORY_USE_OMPT ${ROCPROFSYS_USE_OMPT} - CACHE BOOL "Enable OMPT support in timemory" FORCE) + CACHE BOOL + "Enable OMPT support in timemory" + FORCE +) set(TIMEMORY_USE_PAPI ${ROCPROFSYS_USE_PAPI} - CACHE BOOL "Enable PAPI support in timemory" FORCE) + CACHE BOOL + "Enable PAPI support in timemory" + FORCE +) set(TIMEMORY_USE_BFD ${ROCPROFSYS_USE_BFD} - CACHE BOOL "Enable BFD support in timemory" FORCE) -set(TIMEMORY_USE_LIBUNWIND - ON - CACHE BOOL "Enable libunwind support in timemory") -set(TIMEMORY_USE_VISIBILITY - OFF - CACHE BOOL "Enable/disable using visibility decorations") + CACHE BOOL + "Enable BFD support in timemory" + FORCE +) +set(TIMEMORY_USE_LIBUNWIND ON CACHE BOOL "Enable libunwind support in timemory") +set(TIMEMORY_USE_VISIBILITY OFF CACHE BOOL "Enable/disable using visibility decorations") set(TIMEMORY_USE_SANITIZER ${ROCPROFSYS_USE_SANITIZER} - CACHE BOOL "Build with -fsanitze=\${ROCPROFSYS_SANITIZER_TYPE}" FORCE) + CACHE BOOL + "Build with -fsanitze=\${ROCPROFSYS_SANITIZER_TYPE}" + FORCE +) set(TIMEMORY_SANITIZER_TYPE ${ROCPROFSYS_SANITIZER_TYPE} - CACHE STRING "Sanitizer type, e.g. leak, thread, address, memory, etc." FORCE) + CACHE STRING + "Sanitizer type, e.g. leak, thread, address, memory, etc." + FORCE +) if(DEFINED TIMEMORY_BUILD_GOTCHA AND NOT TIMEMORY_BUILD_GOTCHA) rocprofiler_systems_message( FATAL_ERROR "Using an external gotcha is not allowed due to known bug that has not been accepted upstream" - ) + ) endif() # timemory feature build settings set(TIMEMORY_BUILD_GOTCHA ON - CACHE BOOL "Enable building GOTCHA library from submodule" FORCE) + CACHE BOOL + "Enable building GOTCHA library from submodule" + FORCE +) set(TIMEMORY_BUILD_LIBUNWIND ${ROCPROFSYS_BUILD_LIBUNWIND} - CACHE BOOL "Enable building libunwind library from submodule" FORCE) + CACHE BOOL + "Enable building libunwind library from submodule" + FORCE +) set(TIMEMORY_BUILD_EXTRA_OPTIMIZATIONS ${ROCPROFSYS_BUILD_EXTRA_OPTIMIZATIONS} - CACHE BOOL "Enable building GOTCHA library from submodule" FORCE) -set(TIMEMORY_BUILD_ERT - OFF - CACHE BOOL "Disable building ERT support" FORCE) + CACHE BOOL + "Enable building GOTCHA library from submodule" + FORCE +) +set(TIMEMORY_BUILD_ERT OFF CACHE BOOL "Disable building ERT support" FORCE) set(TIMEMORY_BUILD_CONTAINERS OFF - CACHE BOOL "Disable building container extern templates (unused)" FORCE) + CACHE BOOL + "Disable building container extern templates (unused)" + FORCE +) # timemory build settings -set(TIMEMORY_TLS_MODEL - "global-dynamic" - CACHE STRING "Thread-local static model" FORCE) +set(TIMEMORY_TLS_MODEL "global-dynamic" CACHE STRING "Thread-local static model" FORCE) set(TIMEMORY_MAX_THREADS "${ROCPROFSYS_MAX_THREADS}" - CACHE STRING "Max statically-allocated threads" FORCE) + CACHE STRING + "Max statically-allocated threads" + FORCE +) set(TIMEMORY_SETTINGS_PREFIX "ROCPROFSYS_" - CACHE STRING "Prefix used for settings and environment variables") -set(TIMEMORY_PROJECT_NAME - "rocprofiler-systems" - CACHE STRING "Name for configuration") + CACHE STRING + "Prefix used for settings and environment variables" +) +set(TIMEMORY_PROJECT_NAME "rocprofiler-systems" CACHE STRING "Name for configuration") set(TIMEMORY_CXX_LIBRARY_EXCLUDE "kokkosp.cpp;pthread.cpp;timemory_c.cpp;trace.cpp;weak.cpp;library.cpp" - CACHE STRING "Timemory C++ library implementation files to exclude from compiling") + CACHE STRING + "Timemory C++ library implementation files to exclude from compiling" +) mark_as_advanced(TIMEMORY_SETTINGS_PREFIX) mark_as_advanced(TIMEMORY_PROJECT_NAME) @@ -614,11 +713,13 @@ rocprofiler_systems_checkout_git_submodule( RELATIVE_PATH external/timemory WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} REPO_URL https://github.com/ROCm/timemory.git - REPO_BRANCH omnitrace) + REPO_BRANCH omnitrace +) rocprofiler_systems_save_variables( BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS - CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH) + CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH +) # ensure timemory builds PIC static libs so that we don't have to install timemory shared # lib @@ -629,9 +730,7 @@ set(TIMEMORY_CTP_OPTIONS GLOBAL) if(CMAKE_BUILD_TYPE STREQUAL "Debug") # results in undefined symbols to component::base::load() - set(TIMEMORY_BUILD_HIDDEN_VISIBILITY - OFF - CACHE BOOL "" FORCE) + set(TIMEMORY_BUILD_HIDDEN_VISIBILITY OFF CACHE BOOL "" FORCE) endif() add_subdirectory(external/timemory EXCLUDE_FROM_ALL) @@ -639,23 +738,32 @@ add_subdirectory(external/timemory EXCLUDE_FROM_ALL) install( TARGETS gotcha DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME} - COMPONENT gotcha) + COMPONENT gotcha +) if(ROCPROFSYS_BUILD_LIBUNWIND) install( DIRECTORY ${PROJECT_BINARY_DIR}/external/timemory/external/libunwind/install/lib/ DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME} COMPONENT libunwind FILES_MATCHING - PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*") + PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*" + ) endif() rocprofiler_systems_restore_variables( BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS - CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH) + CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH +) if(TARGET rocprofiler-systems-papi-build) - foreach(_TARGET PAPI::papi timemory-core timemory-common timemory-papi-component - timemory-cxx) + foreach( + _TARGET + PAPI::papi + timemory-core + timemory-common + timemory-papi-component + timemory-cxx + ) if(TARGET "${_TARGET}") add_dependencies(${_TARGET} rocprofiler-systems-papi-build) endif() @@ -669,21 +777,28 @@ endif() target_link_libraries( rocprofiler-systems-timemory - INTERFACE $ - $ - $) + INTERFACE + $ + $ + $ +) -target_link_libraries(rocprofiler-systems-bfd - INTERFACE $) +target_link_libraries( + rocprofiler-systems-bfd + INTERFACE $ +) if(ROCPROFSYS_USE_BFD) rocprofiler_systems_target_compile_definitions(rocprofiler-systems-bfd - INTERFACE ROCPROFSYS_USE_BFD) + INTERFACE ROCPROFSYS_USE_BFD + ) endif() find_package(Libva-headers ${rocprofiler_systems_FIND_QUIETLY} REQUIRED) -target_include_directories(rocprofiler-systems-libva - INTERFACE ${LIBVA_HEADERS_INCLUDE_DIR}) +target_include_directories( + rocprofiler-systems-libva + INTERFACE ${LIBVA_HEADERS_INCLUDE_DIR} +) # ----------------------------------------------------------------------------------------# # @@ -697,7 +812,8 @@ if(NOT TARGET PTL::ptl-shared) RELATIVE_PATH external/PTL WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} REPO_URL https://github.com/jrmadsen/PTL.git - REPO_BRANCH omnitrace) + REPO_BRANCH omnitrace + ) set(PTL_BUILD_EXAMPLES OFF) set(PTL_USE_TBB OFF) @@ -711,7 +827,8 @@ if(NOT TARGET PTL::ptl-shared) BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS BUILD_OBJECT_LIBS CMAKE_POSITION_INDEPENDENT_CODE CMAKE_CXX_VISIBILITY_PRESET - CMAKE_VISIBILITY_INLINES_HIDDEN) + CMAKE_VISIBILITY_INLINES_HIDDEN + ) set(BUILD_SHARED_LIBS OFF) set(BUILD_STATIC_LIBS OFF) @@ -726,15 +843,20 @@ if(NOT TARGET PTL::ptl-shared) BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS BUILD_OBJECT_LIBS CMAKE_POSITION_INDEPENDENT_CODE CMAKE_CXX_VISIBILITY_PRESET - CMAKE_VISIBILITY_INLINES_HIDDEN) + CMAKE_VISIBILITY_INLINES_HIDDEN + ) endif() -target_sources(rocprofiler-systems-ptl - INTERFACE $>) +target_sources( + rocprofiler-systems-ptl + INTERFACE $> +) target_include_directories( rocprofiler-systems-ptl - INTERFACE $ - $) + INTERFACE + $ + $ +) # ----------------------------------------------------------------------------------------# # @@ -748,7 +870,8 @@ include(Compilers) if(ROCPROFSYS_BUILD_STATIC_LIBSTDCXX) if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") rocprofiler_systems_restore_variables(STATIC_LIBSTDCXX_CXX - VARIABLES CMAKE_CXX_FLAGS) + VARIABLES CMAKE_CXX_FLAGS + ) endif() endif() @@ -802,10 +925,13 @@ if(ROCPROFSYS_USE_PYTHON) FAIL PREFIX ${ROCPROFSYS_PYTHON_PREFIX} PATHS ${ROCPROFSYS_PYTHON_ENVS} - OUTPUT_VARIABLE _PYTHON_ROOT_DIRS) + OUTPUT_VARIABLE _PYTHON_ROOT_DIRS + ) set(ROCPROFSYS_PYTHON_ROOT_DIRS "${_PYTHON_ROOT_DIRS}" - CACHE INTERNAL "Root directories for python") + CACHE INTERNAL + "Root directories for python" + ) endif() if(NOT ROCPROFSYS_PYTHON_VERSIONS AND ROCPROFSYS_PYTHON_VERSION) @@ -813,9 +939,7 @@ if(ROCPROFSYS_USE_PYTHON) if(NOT ROCPROFSYS_PYTHON_ROOT_DIRS) rocprofiler_systems_find_python(_PY VERSION ${ROCPROFSYS_PYTHON_VERSION}) - set(ROCPROFSYS_PYTHON_ROOT_DIRS - "${_PY_ROOT_DIR}" - CACHE INTERNAL "" FORCE) + set(ROCPROFSYS_PYTHON_ROOT_DIRS "${_PY_ROOT_DIR}" CACHE INTERNAL "" FORCE) endif() unset(ROCPROFSYS_PYTHON_VERSION CACHE) @@ -823,7 +947,8 @@ if(ROCPROFSYS_USE_PYTHON) elseif( NOT ROCPROFSYS_PYTHON_VERSIONS AND NOT ROCPROFSYS_PYTHON_VERSION - AND ROCPROFSYS_PYTHON_ROOT_DIRS) + AND ROCPROFSYS_PYTHON_ROOT_DIRS + ) set(_PY_VERSIONS) foreach(_DIR ${ROCPROFSYS_PYTHON_ROOT_DIRS}) @@ -838,20 +963,15 @@ if(ROCPROFSYS_USE_PYTHON) endif() endforeach() - set(ROCPROFSYS_PYTHON_VERSIONS - "${_PY_VERSIONS}" - CACHE INTERNAL "" FORCE) + set(ROCPROFSYS_PYTHON_VERSIONS "${_PY_VERSIONS}" CACHE INTERNAL "" FORCE) elseif( NOT ROCPROFSYS_PYTHON_VERSIONS AND NOT ROCPROFSYS_PYTHON_VERSION - AND NOT ROCPROFSYS_PYTHON_ROOT_DIRS) + AND NOT ROCPROFSYS_PYTHON_ROOT_DIRS + ) rocprofiler_systems_find_python(_PY REQUIRED) - set(ROCPROFSYS_PYTHON_ROOT_DIRS - "${_PY_ROOT_DIR}" - CACHE INTERNAL "" FORCE) - set(ROCPROFSYS_PYTHON_VERSIONS - "${_PY_VERSION}" - CACHE INTERNAL "" FORCE) + set(ROCPROFSYS_PYTHON_ROOT_DIRS "${_PY_ROOT_DIR}" CACHE INTERNAL "" FORCE) + set(ROCPROFSYS_PYTHON_VERSIONS "${_PY_VERSION}" CACHE INTERNAL "" FORCE) endif() rocprofiler_systems_watch_for_change(ROCPROFSYS_PYTHON_ROOT_DIRS) @@ -864,16 +984,22 @@ if(ROCPROFSYS_USE_PYTHON) if(_NUM_PYTHON_VERSIONS GREATER 1) set(ROCPROFSYS_INSTALL_PYTHONDIR "${CMAKE_INSTALL_LIBDIR}/python/site-packages" - CACHE STRING "Installation prefix for python") + CACHE STRING + "Installation prefix for python" + ) else() set(ROCPROFSYS_INSTALL_PYTHONDIR "${CMAKE_INSTALL_LIBDIR}/python${ROCPROFSYS_PYTHON_VERSIONS}/site-packages" - CACHE STRING "Installation prefix for python") + CACHE STRING + "Installation prefix for python" + ) endif() else() set(ROCPROFSYS_INSTALL_PYTHONDIR "${CMAKE_INSTALL_LIBDIR}/python/site-packages" - CACHE STRING "Installation prefix for python") + CACHE STRING + "Installation prefix for python" + ) endif() rocprofiler_systems_watch_for_change(ROCPROFSYS_INSTALL_PYTHONDIR) @@ -889,16 +1015,20 @@ if("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND NOT ROCPROFSYS_BUILD_DEBUG) add_target_flag_if_avail(rocprofiler-systems-compile-options "-g1") endif() -target_compile_definitions(rocprofiler-systems-compile-definitions - INTERFACE ROCPROFSYS_MAX_THREADS=${ROCPROFSYS_MAX_THREADS}) +target_compile_definitions( + rocprofiler-systems-compile-definitions + INTERFACE ROCPROFSYS_MAX_THREADS=${ROCPROFSYS_MAX_THREADS} +) foreach(_LIB ${ROCPROFSYS_EXTENSION_LIBRARIES}) get_target_property(_COMPILE_DEFS ${_LIB} INTERFACE_COMPILE_DEFINITIONS) if(_COMPILE_DEFS) foreach(_DEF ${_COMPILE_DEFS}) if("${_DEF}" MATCHES "ROCPROFSYS_") - target_compile_definitions(rocprofiler-systems-compile-definitions - INTERFACE ${_DEF}) + target_compile_definitions( + rocprofiler-systems-compile-definitions + INTERFACE ${_DEF} + ) endif() endforeach() endif() diff --git a/projects/rocprofiler-systems/cmake/Perfetto.cmake b/projects/rocprofiler-systems/cmake/Perfetto.cmake index c2eb3c9758..bc73687425 100644 --- a/projects/rocprofiler-systems/cmake/Perfetto.cmake +++ b/projects/rocprofiler-systems/cmake/Perfetto.cmake @@ -16,15 +16,9 @@ include(ProcessorCount) # # ---------------------------------------------------------------------------------------# -find_program( - ROCPROFSYS_COPY_EXECUTABLE - NAMES cp - PATH_SUFFIXES bin) +find_program(ROCPROFSYS_COPY_EXECUTABLE NAMES cp PATH_SUFFIXES bin) -find_program( - ROCPROFSYS_NINJA_EXECUTABLE - NAMES ninja - PATH_SUFFIXES bin) +find_program(ROCPROFSYS_NINJA_EXECUTABLE NAMES ninja PATH_SUFFIXES bin) mark_as_advanced(ROCPROFSYS_COPY_EXECUTABLE) mark_as_advanced(ROCPROFSYS_NINJA_EXECUTABLE) @@ -35,7 +29,7 @@ mark_as_advanced(ROCPROFSYS_NINJA_EXECUTABLE) # # ---------------------------------------------------------------------------------------# -processorcount(NUM_PROCS_REAL) +ProcessorCount(NUM_PROCS_REAL) math(EXPR _NUM_THREADS "${NUM_PROCS_REAL} - (${NUM_PROCS_REAL} / 2)") if(_NUM_THREADS GREATER 8) set(_NUM_THREADS 8) @@ -46,32 +40,38 @@ endif() set(ROCPROFSYS_PERFETTO_SOURCE_DIR ${PROJECT_BINARY_DIR}/external/perfetto/source) set(ROCPROFSYS_PERFETTO_TOOLS_DIR ${PROJECT_BINARY_DIR}/external/perfetto/source/tools) set(ROCPROFSYS_PERFETTO_BINARY_DIR - ${PROJECT_BINARY_DIR}/external/perfetto/source/out/linux) + ${PROJECT_BINARY_DIR}/external/perfetto/source/out/linux +) set(ROCPROFSYS_PERFETTO_INSTALL_DIR - ${PROJECT_BINARY_DIR}/external/perfetto/source/out/linux/stripped) + ${PROJECT_BINARY_DIR}/external/perfetto/source/out/linux/stripped +) set(ROCPROFSYS_PERFETTO_LINK_FLAGS "-static-libgcc" - CACHE STRING "Link flags for perfetto") + CACHE STRING + "Link flags for perfetto" +) set(ROCPROFSYS_PERFETTO_BUILD_THREADS ${_NUM_THREADS} - CACHE STRING "Number of threads to use when building perfetto tools") + CACHE STRING + "Number of threads to use when building perfetto tools" +) if(CMAKE_CXX_COMPILER_IS_CLANG) set(PERFETTO_IS_CLANG true) - set(ROCPROFSYS_PERFETTO_C_FLAGS - "" - CACHE STRING "Perfetto C flags") - set(ROCPROFSYS_PERFETTO_CXX_FLAGS - "" - CACHE STRING "Perfetto C++ flags") + set(ROCPROFSYS_PERFETTO_C_FLAGS "" CACHE STRING "Perfetto C flags") + set(ROCPROFSYS_PERFETTO_CXX_FLAGS "" CACHE STRING "Perfetto C++ flags") else() set(PERFETTO_IS_CLANG false) set(ROCPROFSYS_PERFETTO_C_FLAGS "-static-libgcc -Wno-maybe-uninitialized -Wno-stringop-overflow" - CACHE STRING "Perfetto C flags") + CACHE STRING + "Perfetto C flags" + ) set(ROCPROFSYS_PERFETTO_CXX_FLAGS "-static-libgcc -Wno-maybe-uninitialized -Wno-stringop-overflow -Wno-mismatched-new-delete" - CACHE STRING "Perfetto C++ flags") + CACHE STRING + "Perfetto C++ flags" + ) endif() mark_as_advanced(ROCPROFSYS_PERFETTO_C_FLAGS) @@ -81,7 +81,10 @@ mark_as_advanced(ROCPROFSYS_PERFETTO_LINK_FLAGS) if(NOT ROCPROFSYS_NINJA_EXECUTABLE) set(ROCPROFSYS_NINJA_EXECUTABLE ${ROCPROFSYS_PERFETTO_TOOLS_DIR}/ninja - CACHE FILEPATH "Ninja" FORCE) + CACHE FILEPATH + "Ninja" + FORCE + ) endif() # ---------------------------------------------------------------------------------------# @@ -91,37 +94,61 @@ endif() # ---------------------------------------------------------------------------------------# if(NOT EXISTS "${ROCPROFSYS_PERFETTO_SOURCE_DIR}") - execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory - ${PROJECT_BINARY_DIR}/external/perfetto) + execute_process( + COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/external/perfetto + ) # cmake -E copy_directory fails for some reason execute_process( - COMMAND ${ROCPROFSYS_COPY_EXECUTABLE} -r ${PROJECT_SOURCE_DIR}/external/perfetto/ - ${ROCPROFSYS_PERFETTO_SOURCE_DIR}) + COMMAND + ${ROCPROFSYS_COPY_EXECUTABLE} -r ${PROJECT_SOURCE_DIR}/external/perfetto/ + ${ROCPROFSYS_PERFETTO_SOURCE_DIR} + ) endif() file(READ ${PROJECT_SOURCE_DIR}/external/perfetto/sdk/perfetto.h _PERFETTO_HEADER) string( - REGEX - REPLACE " perfetto::internal::ValidateEventNameType" - " ::perfetto::internal::ValidateEventNameType" _PERFETTO_HEADER - "${_PERFETTO_HEADER}") + REGEX REPLACE + " perfetto::internal::ValidateEventNameType" + " ::perfetto::internal::ValidateEventNameType" + _PERFETTO_HEADER + "${_PERFETTO_HEADER}" +) if(ROCPROFSYS_USE_SANITIZER AND ROCPROFSYS_SANITIZER_TYPE MATCHES "address") - string(REPLACE "__asan_poison_memory_region((a), (s))" "" _PERFETTO_HEADER - "${_PERFETTO_HEADER}") - string(REPLACE "__asan_unpoison_memory_region((a), (s))" "" _PERFETTO_HEADER - "${_PERFETTO_HEADER}") + string( + REPLACE + "__asan_poison_memory_region((a), (s))" + "" + _PERFETTO_HEADER + "${_PERFETTO_HEADER}" + ) + string( + REPLACE + "__asan_unpoison_memory_region((a), (s))" + "" + _PERFETTO_HEADER + "${_PERFETTO_HEADER}" + ) endif() file(WRITE ${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.h.tmp "${_PERFETTO_HEADER}") -configure_file(${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.h.tmp - ${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.h COPYONLY) -configure_file(${PROJECT_SOURCE_DIR}/external/perfetto/sdk/perfetto.cc - ${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.cc COPYONLY) -configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/args.gn.in - ${ROCPROFSYS_PERFETTO_BINARY_DIR}/args.gn @ONLY) +configure_file( + ${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.h.tmp + ${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.h + COPYONLY +) +configure_file( + ${PROJECT_SOURCE_DIR}/external/perfetto/sdk/perfetto.cc + ${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.cc + COPYONLY +) +configure_file( + ${PROJECT_SOURCE_DIR}/cmake/Templates/args.gn.in + ${ROCPROFSYS_PERFETTO_BINARY_DIR}/args.gn + @ONLY +) # ---------------------------------------------------------------------------------------# # @@ -130,30 +157,29 @@ configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/args.gn.in # ---------------------------------------------------------------------------------------# if(ROCPROFSYS_INSTALL_PERFETTO_TOOLS) - find_program( - ROCPROFSYS_CURL_EXECUTABLE - NAMES curl - PATH_SUFFIXES bin) + find_program(ROCPROFSYS_CURL_EXECUTABLE NAMES curl PATH_SUFFIXES bin) if(NOT ROCPROFSYS_CURL_EXECUTABLE) rocprofiler_systems_message( SEND_ERROR "curl executable cannot be found. install-build-deps script for perfetto will fail" - ) + ) endif() - externalproject_add( + ExternalProject_Add( rocprofiler-systems-perfetto-build PREFIX ${PROJECT_BINARY_DIR}/external/perfetto SOURCE_DIR ${ROCPROFSYS_PERFETTO_SOURCE_DIR} BUILD_IN_SOURCE 1 PATCH_COMMAND ${ROCPROFSYS_PERFETTO_TOOLS_DIR}/install-build-deps - CONFIGURE_COMMAND ${ROCPROFSYS_PERFETTO_TOOLS_DIR}/gn gen - ${ROCPROFSYS_PERFETTO_BINARY_DIR} - BUILD_COMMAND ${ROCPROFSYS_NINJA_EXECUTABLE} -C ${ROCPROFSYS_PERFETTO_BINARY_DIR} - -j ${ROCPROFSYS_PERFETTO_BUILD_THREADS} + CONFIGURE_COMMAND + ${ROCPROFSYS_PERFETTO_TOOLS_DIR}/gn gen ${ROCPROFSYS_PERFETTO_BINARY_DIR} + BUILD_COMMAND + ${ROCPROFSYS_NINJA_EXECUTABLE} -C ${ROCPROFSYS_PERFETTO_BINARY_DIR} -j + ${ROCPROFSYS_PERFETTO_BUILD_THREADS} INSTALL_COMMAND "" - BUILD_BYPRODUCTS ${ROCPROFSYS_PERFETTO_BINARY_DIR}/args.gn) + BUILD_BYPRODUCTS ${ROCPROFSYS_PERFETTO_BINARY_DIR}/args.gn + ) add_custom_target( rocprofiler-systems-perfetto-clean @@ -162,16 +188,26 @@ if(ROCPROFSYS_INSTALL_PERFETTO_TOOLS) ${CMAKE_COMMAND} -E rm -rf ${PROJECT_BINARY_DIR}/external/perfetto/src/rocprof-sys-perfetto-build-stamp WORKING_DIRECTORY ${ROCPROFSYS_PERFETTO_BINARY_DIR} - COMMENT "Cleaning Perfetto...") + COMMENT "Cleaning Perfetto..." + ) install( DIRECTORY ${ROCPROFSYS_PERFETTO_INSTALL_DIR}/ DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME} COMPONENT perfetto FILES_MATCHING - PATTERN "*libperfetto.so*") + PATTERN "*libperfetto.so*" + ) - foreach(_FILE perfetto traced tracebox traced_probes traced_perf trigger_perfetto) + foreach( + _FILE + perfetto + traced + tracebox + traced_probes + traced_perf + trigger_perfetto + ) if("${_FILE}" STREQUAL "perfetto") string(REPLACE "_" "-" _INSTALL_FILE "rocprof-sys-${_FILE}") else() @@ -182,7 +218,8 @@ if(ROCPROFSYS_INSTALL_PERFETTO_TOOLS) DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT perfetto RENAME ${_INSTALL_FILE} - OPTIONAL) + OPTIONAL + ) endforeach() endif() @@ -193,34 +230,51 @@ endif() # ---------------------------------------------------------------------------------------# add_library(rocprofiler-systems-perfetto-library STATIC) -add_library(rocprofiler-systems::rocprofiler-systems-perfetto-library ALIAS - rocprofiler-systems-perfetto-library) +add_library( + rocprofiler-systems::rocprofiler-systems-perfetto-library + ALIAS rocprofiler-systems-perfetto-library +) target_sources( rocprofiler-systems-perfetto-library - PRIVATE ${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.cc - ${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.h) + PRIVATE + ${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.cc + ${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.h +) target_link_libraries( rocprofiler-systems-perfetto-library - PRIVATE rocprofiler-systems::rocprofiler-systems-threading - rocprofiler-systems::rocprofiler-systems-static-libgcc - rocprofiler-systems::rocprofiler-systems-static-libstdcxx) + PRIVATE + rocprofiler-systems::rocprofiler-systems-threading + rocprofiler-systems::rocprofiler-systems-static-libgcc + rocprofiler-systems::rocprofiler-systems-static-libstdcxx +) set_target_properties( rocprofiler-systems-perfetto-library - PROPERTIES OUTPUT_NAME perfetto - ARCHIVE_OUTPUT_DIRECTORY ${ROCPROFSYS_PERFETTO_BINARY_DIR} - POSITION_INDEPENDENT_CODE ON - CXX_VISIBILITY_PRESET "internal") + PROPERTIES + OUTPUT_NAME perfetto + ARCHIVE_OUTPUT_DIRECTORY ${ROCPROFSYS_PERFETTO_BINARY_DIR} + POSITION_INDEPENDENT_CODE ON + CXX_VISIBILITY_PRESET "internal" +) set(perfetto_DIR ${ROCPROFSYS_PERFETTO_SOURCE_DIR}) set(PERFETTO_ROOT_DIR ${ROCPROFSYS_PERFETTO_SOURCE_DIR} - CACHE PATH "Root Perfetto installation" FORCE) + CACHE PATH + "Root Perfetto installation" + FORCE +) set(PERFETTO_INCLUDE_DIR ${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk - CACHE PATH "Perfetto include folder" FORCE) + CACHE PATH + "Perfetto include folder" + FORCE +) set(PERFETTO_LIBRARY ${ROCPROFSYS_PERFETTO_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}perfetto${CMAKE_STATIC_LIBRARY_SUFFIX} - CACHE FILEPATH "Perfetto library" FORCE) + CACHE FILEPATH + "Perfetto library" + FORCE +) mark_as_advanced(PERFETTO_ROOT_DIR) mark_as_advanced(PERFETTO_INCLUDE_DIR) @@ -233,10 +287,16 @@ mark_as_advanced(PERFETTO_LIBRARY) # ---------------------------------------------------------------------------------------# rocprofiler_systems_target_compile_definitions(rocprofiler-systems-perfetto - INTERFACE ROCPROFSYS_USE_PERFETTO) -target_include_directories(rocprofiler-systems-perfetto SYSTEM - INTERFACE $) + INTERFACE ROCPROFSYS_USE_PERFETTO +) +target_include_directories( + rocprofiler-systems-perfetto + SYSTEM + INTERFACE $ +) target_link_libraries( rocprofiler-systems-perfetto - INTERFACE $ - $) + INTERFACE + $ + $ +) diff --git a/projects/rocprofiler-systems/examples/CMakeLists.txt b/projects/rocprofiler-systems/examples/CMakeLists.txt index 388954f653..dbc5736c7e 100644 --- a/projects/rocprofiler-systems/examples/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/CMakeLists.txt @@ -3,9 +3,7 @@ cmake_minimum_required(VERSION 3.18.4 FATAL_ERROR) project(rocprofiler-systems-examples LANGUAGES C CXX) if("${CMAKE_BUILD_TYPE}" STREQUAL "") - set(CMAKE_BUILD_TYPE - "RelWithDebInfo" - CACHE STRING "Build type" FORCE) + set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Build type" FORCE) endif() string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE) @@ -28,7 +26,8 @@ if(CMAKE_PROJECT_NAME STREQUAL "rocprofiler-systems") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) rocprofiler_systems_add_option(ROCPROFSYS_INSTALL_EXAMPLES - "Install rocprofiler-systems examples" OFF) + "Install rocprofiler-systems examples" OFF + ) else() option(ROCPROFSYS_INSTALL_EXAMPLES "Install rocprofiler-systems examples" ON) endif() @@ -37,9 +36,7 @@ if(ROCPROFSYS_INSTALL_EXAMPLES) include(GNUInstallDirs) endif() -set(ROCPROFSYS_EXAMPLE_ROOT_DIR - ${CMAKE_CURRENT_LIST_DIR} - CACHE INTERNAL "") +set(ROCPROFSYS_EXAMPLE_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR} CACHE INTERNAL "") # defines function for creating causal profiling exes include(${CMAKE_CURRENT_LIST_DIR}/causal-helpers.cmake) diff --git a/projects/rocprofiler-systems/examples/causal-helpers.cmake b/projects/rocprofiler-systems/examples/causal-helpers.cmake index 31735d9554..7a472f4058 100644 --- a/projects/rocprofiler-systems/examples/causal-helpers.cmake +++ b/projects/rocprofiler-systems/examples/causal-helpers.cmake @@ -17,7 +17,12 @@ endif() function(rocprofiler_systems_causal_example_executable _NAME) cmake_parse_arguments( - CAUSAL "" "" "SOURCES;DEFINITIONS;INCLUDE_DIRECTORIES;LINK_LIBRARIES" ${ARGN}) + CAUSAL + "" + "" + "SOURCES;DEFINITIONS;INCLUDE_DIRECTORIES;LINK_LIBRARIES" + ${ARGN} + ) function(rocprofiler_systems_causal_example_interface _TARGET) if(NOT TARGET ${_TARGET}) @@ -30,74 +35,108 @@ function(rocprofiler_systems_causal_example_executable _NAME) rocprofiler_systems_causal_example_interface(rocprofsys-causal-example-lib-debug) rocprofiler_systems_causal_example_interface(rocprofsys-causal-example-lib-no-debug) - target_compile_options(rocprofsys-causal-example-lib-debug - INTERFACE -g3 -fno-omit-frame-pointer) + target_compile_options( + rocprofsys-causal-example-lib-debug + INTERFACE -g3 -fno-omit-frame-pointer + ) target_compile_options(rocprofsys-causal-example-lib-no-debug INTERFACE -g0) add_executable(${_NAME} ${CAUSAL_SOURCES}) - target_compile_definitions(${_NAME} PRIVATE USE_COZ=0 USE_OMNI=0 - ${CAUSAL_DEFINITIONS}) - target_include_directories(${_NAME} PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal - ${CAUSAL_INCLUDE_DIRECTORIES}) + target_compile_definitions( + ${_NAME} + PRIVATE USE_COZ=0 USE_OMNI=0 ${CAUSAL_DEFINITIONS} + ) + target_include_directories( + ${_NAME} + PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES} + ) target_link_libraries( ${_NAME} - PRIVATE ${CAUSAL_LINK_LIBRARIES} - rocprofiler-systems::rocprofiler-systems-user-library - rocprofsys-causal-example-lib-debug) + PRIVATE + ${CAUSAL_LINK_LIBRARIES} + rocprofiler-systems::rocprofiler-systems-user-library + rocprofsys-causal-example-lib-debug + ) add_executable(${_NAME}-rocprofsys ${CAUSAL_SOURCES}) - target_compile_definitions(${_NAME}-rocprofsys PRIVATE USE_COZ=0 USE_OMNI=1 - ${CAUSAL_DEFINITIONS}) + target_compile_definitions( + ${_NAME}-rocprofsys + PRIVATE USE_COZ=0 USE_OMNI=1 ${CAUSAL_DEFINITIONS} + ) target_include_directories( - ${_NAME}-rocprofsys PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal - ${CAUSAL_INCLUDE_DIRECTORIES}) + ${_NAME}-rocprofsys + PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES} + ) target_link_libraries( ${_NAME}-rocprofsys - PRIVATE ${CAUSAL_LINK_LIBRARIES} - rocprofiler-systems::rocprofiler-systems-user-library - rocprofsys-causal-example-lib-debug) + PRIVATE + ${CAUSAL_LINK_LIBRARIES} + rocprofiler-systems::rocprofiler-systems-user-library + rocprofsys-causal-example-lib-debug + ) add_executable(${_NAME}-ndebug ${CAUSAL_SOURCES}) - target_compile_definitions(${_NAME}-ndebug PRIVATE USE_COZ=0 USE_OMNI=0 - ${CAUSAL_DEFINITIONS}) + target_compile_definitions( + ${_NAME}-ndebug + PRIVATE USE_COZ=0 USE_OMNI=0 ${CAUSAL_DEFINITIONS} + ) target_include_directories( - ${_NAME}-ndebug PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal - ${CAUSAL_INCLUDE_DIRECTORIES}) + ${_NAME}-ndebug + PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES} + ) target_link_libraries( ${_NAME}-ndebug - PRIVATE ${CAUSAL_LINK_LIBRARIES} - rocprofiler-systems::rocprofiler-systems-user-library - rocprofsys-causal-example-lib-no-debug) + PRIVATE + ${CAUSAL_LINK_LIBRARIES} + rocprofiler-systems::rocprofiler-systems-user-library + rocprofsys-causal-example-lib-no-debug + ) add_executable(${_NAME}-rocprofsys-ndebug ${CAUSAL_SOURCES}) - target_compile_definitions(${_NAME}-rocprofsys-ndebug PRIVATE USE_COZ=0 USE_OMNI=1 - ${CAUSAL_DEFINITIONS}) + target_compile_definitions( + ${_NAME}-rocprofsys-ndebug + PRIVATE USE_COZ=0 USE_OMNI=1 ${CAUSAL_DEFINITIONS} + ) target_include_directories( - ${_NAME}-rocprofsys-ndebug PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal - ${CAUSAL_INCLUDE_DIRECTORIES}) + ${_NAME}-rocprofsys-ndebug + PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES} + ) target_link_libraries( ${_NAME}-rocprofsys-ndebug - PRIVATE ${CAUSAL_LINK_LIBRARIES} - rocprofiler-systems::rocprofiler-systems-user-library - rocprofsys-causal-example-lib-no-debug) + PRIVATE + ${CAUSAL_LINK_LIBRARIES} + rocprofiler-systems::rocprofiler-systems-user-library + rocprofsys-causal-example-lib-no-debug + ) - add_dependencies(rocprofsys-causal-examples ${_NAME} ${_NAME}-rocprofsys - ${_NAME}-ndebug ${_NAME}-rocprofsys-ndebug) + add_dependencies( + rocprofsys-causal-examples + ${_NAME} + ${_NAME}-rocprofsys + ${_NAME}-ndebug + ${_NAME}-rocprofsys-ndebug + ) if(coz-profiler_FOUND) rocprofiler_systems_causal_example_interface(rocprofsys-causal-example-lib-coz) - target_compile_options(rocprofsys-causal-example-lib-coz - INTERFACE -g3 -gdwarf-3 -fno-omit-frame-pointer) + target_compile_options( + rocprofsys-causal-example-lib-coz + INTERFACE -g3 -gdwarf-3 -fno-omit-frame-pointer + ) add_executable(${_NAME}-coz ${CAUSAL_SOURCES}) - target_compile_definitions(${_NAME}-coz PRIVATE USE_COZ=1 USE_OMNI=0 - ${CAUSAL_DEFINITIONS}) + target_compile_definitions( + ${_NAME}-coz + PRIVATE USE_COZ=1 USE_OMNI=0 ${CAUSAL_DEFINITIONS} + ) target_include_directories( - ${_NAME}-coz PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal - ${CAUSAL_INCLUDE_DIRECTORIES}) + ${_NAME}-coz + PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES} + ) target_link_libraries( - ${_NAME}-coz PRIVATE ${CAUSAL_LINK_LIBRARIES} - rocprofsys-causal-example-lib-coz coz::coz) + ${_NAME}-coz + PRIVATE ${CAUSAL_LINK_LIBRARIES} rocprofsys-causal-example-lib-coz coz::coz + ) add_dependencies(rocprofsys-causal-examples ${_NAME}-coz) endif() @@ -107,6 +146,7 @@ function(rocprofiler_systems_causal_example_executable _NAME) TARGETS ${_NAME} ${_NAME}-rocprofsys ${_NAME}-coz DESTINATION bin COMPONENT rocprofiler-systems-examples - OPTIONAL) + OPTIONAL + ) endif() endfunction() diff --git a/projects/rocprofiler-systems/examples/causal/CMakeLists.txt b/projects/rocprofiler-systems/examples/causal/CMakeLists.txt index 27daf6543e..31bf1eb567 100644 --- a/projects/rocprofiler-systems/examples/causal/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/causal/CMakeLists.txt @@ -5,8 +5,10 @@ project(rocprofiler-systems-causal-example LANGUAGES CXX) if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - ROCPROFSYS_DISABLE_EXAMPLES) + if( + ${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + ) return() endif() endif() @@ -18,25 +20,32 @@ if(NOT TARGET rocprofiler-systems::rocprofiler-systems-user-library) endif() add_library(causal-interface-library INTERFACE) -target_compile_options(causal-interface-library INTERFACE -g3 -gdwarf-3 - -fno-omit-frame-pointer) -target_link_libraries(causal-interface-library INTERFACE Threads::Threads - ${CMAKE_DL_LIBS}) +target_compile_options( + causal-interface-library + INTERFACE -g3 -gdwarf-3 -fno-omit-frame-pointer +) +target_link_libraries( + causal-interface-library + INTERFACE Threads::Threads ${CMAKE_DL_LIBS} +) rocprofiler_systems_causal_example_executable( "causal-both" SOURCES causal.cpp impl.cpp LINK_LIBRARIES causal-interface-library - DEFINITIONS USE_RNG=1 USE_CPU=1) + DEFINITIONS USE_RNG=1 USE_CPU=1 +) rocprofiler_systems_causal_example_executable( "causal-rng" SOURCES causal.cpp impl.cpp LINK_LIBRARIES causal-interface-library - DEFINITIONS USE_RNG=1 USE_CPU=0) + DEFINITIONS USE_RNG=1 USE_CPU=0 +) rocprofiler_systems_causal_example_executable( "causal-cpu" SOURCES causal.cpp impl.cpp LINK_LIBRARIES causal-interface-library - DEFINITIONS USE_RNG=0 USE_CPU=1) + DEFINITIONS USE_RNG=0 USE_CPU=1 +) diff --git a/projects/rocprofiler-systems/examples/code-coverage/CMakeLists.txt b/projects/rocprofiler-systems/examples/code-coverage/CMakeLists.txt index 06fdb9362e..07ecbd7873 100644 --- a/projects/rocprofiler-systems/examples/code-coverage/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/code-coverage/CMakeLists.txt @@ -5,8 +5,10 @@ project(rocprofiler-systems-code-coverage-example LANGUAGES CXX) if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - ROCPROFSYS_DISABLE_EXAMPLES) + if( + ${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + ) return() endif() endif() @@ -20,10 +22,7 @@ target_link_libraries(code-coverage PRIVATE Threads::Threads) target_compile_options(code-coverage PRIVATE ${_FLAGS}) if(ROCPROFSYS_INSTALL_EXAMPLES) - install( - TARGETS code-coverage - DESTINATION bin - COMPONENT rocprofiler-systems-examples) + install(TARGETS code-coverage DESTINATION bin COMPONENT rocprofiler-systems-examples) endif() set(PYTHON_FILES code-coverage.py) @@ -34,14 +33,18 @@ if(Python3_FOUND) set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}") foreach(_FILE ${PYTHON_FILES}) - configure_file(${PROJECT_SOURCE_DIR}/${_FILE} ${PROJECT_BINARY_DIR}/${_FILE} - @ONLY) + configure_file( + ${PROJECT_SOURCE_DIR}/${_FILE} + ${PROJECT_BINARY_DIR}/${_FILE} + @ONLY + ) if(ROCPROFSYS_INSTALL_EXAMPLES) install( PROGRAMS ${PROJECT_BINARY_DIR}/${_FILE} DESTINATION bin - COMPONENT rocprofiler-systems-examples) + COMPONENT rocprofiler-systems-examples + ) endif() endforeach() endif() diff --git a/projects/rocprofiler-systems/examples/fork/CMakeLists.txt b/projects/rocprofiler-systems/examples/fork/CMakeLists.txt index 4408265f83..3c8a989eb4 100644 --- a/projects/rocprofiler-systems/examples/fork/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/fork/CMakeLists.txt @@ -8,13 +8,12 @@ string(REPLACE " " ";" _FLAGS "${CMAKE_CXX_FLAGS_DEBUG}") find_package(Threads REQUIRED) find_package(rocprofiler-systems REQUIRED COMPONENTS user) add_executable(fork-example fork.cpp) -target_link_libraries(fork-example PRIVATE Threads::Threads - rocprofiler-systems::rocprofiler-systems) +target_link_libraries( + fork-example + PRIVATE Threads::Threads rocprofiler-systems::rocprofiler-systems +) target_compile_options(fork-example PRIVATE ${_FLAGS}) if(ROCPROFSYS_INSTALL_EXAMPLES) - install( - TARGETS fork-example - DESTINATION bin - COMPONENT rocprofiler-systems-examples) + install(TARGETS fork-example DESTINATION bin COMPONENT rocprofiler-systems-examples) endif() diff --git a/projects/rocprofiler-systems/examples/jpegdecode/CMakeLists.txt b/projects/rocprofiler-systems/examples/jpegdecode/CMakeLists.txt index 56bb7d9a7f..5381ae0987 100644 --- a/projects/rocprofiler-systems/examples/jpegdecode/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/jpegdecode/CMakeLists.txt @@ -52,8 +52,10 @@ string(REPLACE " " ";" _FLAGS "${CMAKE_CXX_FLAGS_DEBUG}") if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - ROCPROFSYS_DISABLE_EXAMPLES) + if( + ${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + ) return() endif() endif() @@ -76,24 +78,24 @@ function(copy_image_files_and_make_copies) foreach(file ${image_files}) get_filename_component(filename ${file} NAME) foreach(i RANGE 1 ${NUM_COPIES}) - file(COPY ${file} - DESTINATION ${CMAKE_BINARY_DIR}/images/${filename}_copy${i}.jpg) + file( + COPY ${file} + DESTINATION ${CMAKE_BINARY_DIR}/images/${filename}_copy${i}.jpg + ) endforeach() endforeach() else() message( AUTHOR_WARNING - "Source directory ${ROCmVersion_DIR}/share/rocjpeg/images does not exist") + "Source directory ${ROCmVersion_DIR}/share/rocjpeg/images does not exist" + ) endif() endfunction() # threads find_package(Threads REQUIRED) -if(HIP_FOUND - AND ROCJPEG_FOUND - AND Threads_FOUND - AND rocprofiler-register_FOUND) +if(HIP_FOUND AND ROCJPEG_FOUND AND Threads_FOUND AND rocprofiler-register_FOUND) # HIP set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} hip::host) # threads @@ -116,19 +118,17 @@ if(HIP_FOUND copy_image_files_and_make_copies() if(ROCPROFSYS_INSTALL_EXAMPLES) - install( - TARGETS jpegdecode - DESTINATION bin - COMPONENT rocprofiler-systems-examples) + install(TARGETS jpegdecode DESTINATION bin COMPONENT rocprofiler-systems-examples) install( FILES ${CMAKE_BINARY_DIR}/images DESTINATION share/rocprofiler-systems/tests/images - COMPONENT rocprofiler-systems-examples) + COMPONENT rocprofiler-systems-examples + ) endif() else() message( "-- ERROR!: ${PROJECT_NAME} excluded! please install all the dependencies and try again!" - ) + ) if(NOT HIP_FOUND) message(FATAL_ERROR "-- ERROR!: HIP Not Found! - please install ROCm and HIP!") endif() @@ -141,7 +141,7 @@ else() if(NOT rocprofiler-register_FOUND) message( FATAL_ERROR - "-- ERROR!: rocprofiler-register Not Found! - please install rocprofiler-register!" - ) + "-- ERROR!: rocprofiler-register Not Found! - please install rocprofiler-register!" + ) endif() endif() diff --git a/projects/rocprofiler-systems/examples/lulesh/CMakeLists.txt b/projects/rocprofiler-systems/examples/lulesh/CMakeLists.txt index 34ce262e6c..8402b3685d 100644 --- a/projects/rocprofiler-systems/examples/lulesh/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/lulesh/CMakeLists.txt @@ -5,15 +5,22 @@ project(rocprofiler-systems-lulesh-example LANGUAGES C CXX) if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - ROCPROFSYS_DISABLE_EXAMPLES) + if( + ${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + ) return() endif() endif() set(CMAKE_BUILD_TYPE "RelWithDebInfo") -string(REGEX REPLACE " -g(|[0-2]) " " -g3 " CMAKE_CXX_FLAGS_RELWITHDEBINFO - "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") +string( + REGEX REPLACE + " -g(|[0-2]) " + " -g3 " + CMAKE_CXX_FLAGS_RELWITHDEBINFO + "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" +) list(INSERT CMAKE_MODULE_PATH 0 ${PROJECT_SOURCE_DIR}/cmake/Modules) @@ -29,8 +36,13 @@ if(LULESH_BUILD_KOKKOS) find_program( HIPCC_EXECUTABLE NAMES hipcc - HINTS ${ROCmVersion_DIR} ${ROCM_PATH} ENV ROCM_PATH /opt/rocm - PATHS ${ROCmVersion_DIR} ${ROCM_PATH} ENV ROCM_PATH /opt/rocm) + HINTS ${ROCmVersion_DIR} ${ROCM_PATH} + ENV ROCM_PATH + /opt/rocm + PATHS ${ROCmVersion_DIR} ${ROCM_PATH} + ENV ROCM_PATH + /opt/rocm + ) mark_as_advanced(HIPCC_EXECUTABLE) endif() kokkos_compilation(PROJECT COMPILER ${HIPCC_EXECUTABLE}) @@ -43,9 +55,7 @@ endif() set(CMAKE_CXX_EXTENSIONS OFF) if("${CMAKE_BUILD_TYPE}" STREQUAL "") - set(CMAKE_BUILD_TYPE - "Release" - CACHE STRING "CMake build type" FORCE) + set(CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build type" FORCE) endif() option(LULESH_USE_MPI "Enable MPI" OFF) @@ -69,15 +79,19 @@ rocprofiler_systems_causal_example_executable( "lulesh" SOURCES ${sources} ${headers} LINK_LIBRARIES Kokkos::kokkos lulesh-mpi - INCLUDE_DIRECTORIES ${PROJECT_SOURCE_DIR}/includes) + INCLUDE_DIRECTORIES ${PROJECT_SOURCE_DIR}/includes +) if(ROCPROFSYS_INSTALL_EXAMPLES) if(LULESH_BUILD_KOKKOS) install( TARGETS kokkoscore kokkoscontainers DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT rocprofiler-systems-examples) - set_target_properties(lulesh PROPERTIES INSTALL_RPATH - "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}") + COMPONENT rocprofiler-systems-examples + ) + set_target_properties( + lulesh + PROPERTIES INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" + ) endif() endif() diff --git a/projects/rocprofiler-systems/examples/lulesh/cmake/Modules/Utilities.cmake b/projects/rocprofiler-systems/examples/lulesh/cmake/Modules/Utilities.cmake index a409967a02..c6f0df15c1 100644 --- a/projects/rocprofiler-systems/examples/lulesh/cmake/Modules/Utilities.cmake +++ b/projects/rocprofiler-systems/examples/lulesh/cmake/Modules/Utilities.cmake @@ -17,9 +17,7 @@ function(CAPITALIZE str var) string(TOUPPER "${_first}" _first) string(SUBSTRING "${str}" 1 -1 _remainder) string(CONCAT str "${_first}" "${_remainder}") - set(${var} - "${str}" - PARENT_SCOPE) + set(${var} "${str}" PARENT_SCOPE) endfunction() # ----------------------------------------------------------------------------------------# @@ -35,9 +33,12 @@ endfunction() function(CHECKOUT_GIT_SUBMODULE) # parse args cmake_parse_arguments( - CHECKOUT "RECURSIVE" + CHECKOUT + "RECURSIVE" "RELATIVE_PATH;WORKING_DIRECTORY;TEST_FILE;REPO_URL;REPO_BRANCH" - "ADDITIONAL_CMDS" ${ARGN}) + "ADDITIONAL_CMDS" + ${ARGN} + ) if(NOT CHECKOUT_WORKING_DIRECTORY) set(CHECKOUT_WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) @@ -97,15 +98,19 @@ function(CHECKOUT_GIT_SUBMODULE) if(NOT _TEST_FILE_EXISTS AND _SUBMODULE_EXISTS) # perform the checkout execute_process( - COMMAND ${GIT_EXECUTABLE} submodule update --init ${_RECURSE} - ${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH} + COMMAND + ${GIT_EXECUTABLE} submodule update --init ${_RECURSE} + ${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH} WORKING_DIRECTORY ${CHECKOUT_WORKING_DIRECTORY} - RESULT_VARIABLE RET) + RESULT_VARIABLE RET + ) # check the return code if(RET GREATER 0) - set(_CMD "${GIT_EXECUTABLE} submodule update --init ${_RECURSE} - ${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH}") + set(_CMD + "${GIT_EXECUTABLE} submodule update --init ${_RECURSE} + ${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH}" + ) message(STATUS "function(CHECKOUT_GIT_SUBMODULE) failed.") message(FATAL_ERROR "Command: \"${_CMD}\"") else() @@ -115,7 +120,9 @@ function(CHECKOUT_GIT_SUBMODULE) if(NOT _TEST_FILE_EXISTS AND _HAS_REPO_URL) message( - STATUS "Checking out '${CHECKOUT_REPO_URL}' @ '${CHECKOUT_REPO_BRANCH}'...") + STATUS + "Checking out '${CHECKOUT_REPO_URL}' @ '${CHECKOUT_REPO_BRANCH}'..." + ) # remove the existing directory if(EXISTS "${_DIR}") @@ -128,16 +135,16 @@ function(CHECKOUT_GIT_SUBMODULE) ${GIT_EXECUTABLE} clone -b ${CHECKOUT_REPO_BRANCH} ${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_REPO_URL} ${CHECKOUT_RELATIVE_PATH} WORKING_DIRECTORY ${CHECKOUT_WORKING_DIRECTORY} - RESULT_VARIABLE RET) + RESULT_VARIABLE RET + ) # perform the submodule update - if(CHECKOUT_RECURSIVE - AND EXISTS "${_DIR}" - AND IS_DIRECTORY "${_DIR}") + if(CHECKOUT_RECURSIVE AND EXISTS "${_DIR}" AND IS_DIRECTORY "${_DIR}") execute_process( COMMAND ${GIT_EXECUTABLE} submodule update --init ${_RECURSE} WORKING_DIRECTORY ${_DIR} - RESULT_VARIABLE RET) + RESULT_VARIABLE RET + ) endif() # check the return code @@ -145,7 +152,7 @@ function(CHECKOUT_GIT_SUBMODULE) set(_CMD "${GIT_EXECUTABLE} clone -b ${CHECKOUT_REPO_BRANCH} ${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_REPO_URL} ${CHECKOUT_RELATIVE_PATH}" - ) + ) message(STATUS "function(CHECKOUT_GIT_SUBMODULE) failed.") message(FATAL_ERROR "Command: \"${_CMD}\"") else() @@ -156,7 +163,7 @@ function(CHECKOUT_GIT_SUBMODULE) if(NOT EXISTS "${_TEST_FILE}" OR NOT _TEST_FILE_EXISTS) message( FATAL_ERROR - "Error checking out submodule: '${CHECKOUT_RELATIVE_PATH}' to '${_DIR}'") + "Error checking out submodule: '${CHECKOUT_RELATIVE_PATH}' to '${_DIR}'" + ) endif() - endfunction() diff --git a/projects/rocprofiler-systems/examples/mpi/CMakeLists.txt b/projects/rocprofiler-systems/examples/mpi/CMakeLists.txt index 109c7ed266..24b1bf0208 100644 --- a/projects/rocprofiler-systems/examples/mpi/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/mpi/CMakeLists.txt @@ -5,8 +5,10 @@ project(rocprofiler-systems-mpi-examples LANGUAGES C CXX) if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - ROCPROFSYS_DISABLE_EXAMPLES) + if( + ${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + ) return() endif() endif() @@ -18,8 +20,10 @@ if(NOT MPI_FOUND) else() set(_MSG_TYPE AUTHOR_WARNING) endif() - message(${_MSG_TYPE} - "MPI could not be found. Cannot build rocprofiler-systems-mpi target") + message( + ${_MSG_TYPE} + "MPI could not be found. Cannot build rocprofiler-systems-mpi target" + ) return() endif() @@ -31,8 +35,10 @@ add_library(mpi-c-interface-library INTERFACE) target_link_libraries( mpi-c-interface-library INTERFACE - Threads::Threads MPI::MPI_C - $) + Threads::Threads + MPI::MPI_C + $ +) target_compile_options(mpi-c-interface-library INTERFACE -Wno-double-promotion) add_executable(mpi-allgather allgather.c) @@ -62,16 +68,25 @@ add_library(mpi-cxx-interface-library INTERFACE) target_link_libraries( mpi-cxx-interface-library INTERFACE - Threads::Threads MPI::MPI_CXX - $) + Threads::Threads + MPI::MPI_CXX + $ +) add_executable(mpi-example mpi.cpp) target_link_libraries(mpi-example PRIVATE mpi-cxx-interface-library) if(ROCPROFSYS_INSTALL_EXAMPLES) install( - TARGETS mpi-example mpi-allgather mpi-bcast mpi-all2all mpi-reduce - mpi-scatter-gather mpi-send-recv + TARGETS + mpi-example + mpi-allgather + mpi-bcast + mpi-all2all + mpi-reduce + mpi-scatter-gather + mpi-send-recv DESTINATION bin - COMPONENT rocprofiler-systems-examples) + COMPONENT rocprofiler-systems-examples + ) endif() diff --git a/projects/rocprofiler-systems/examples/openmp/CMakeLists.txt b/projects/rocprofiler-systems/examples/openmp/CMakeLists.txt index 29de7fdc11..1354f832af 100644 --- a/projects/rocprofiler-systems/examples/openmp/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/openmp/CMakeLists.txt @@ -5,8 +5,10 @@ project(rocprofiler-systems-openmp LANGUAGES CXX) if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - ROCPROFSYS_DISABLE_EXAMPLES) + if( + ${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + ) return() endif() endif() @@ -15,10 +17,16 @@ file(GLOB common_source ${CMAKE_CURRENT_SOURCE_DIR}/common/*.cpp) add_library(openmp-common OBJECT ${common_source}) target_include_directories(openmp-common PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/common) -add_executable(openmp-cg ${CMAKE_CURRENT_SOURCE_DIR}/CG/cg.cpp - $) -add_executable(openmp-lu ${CMAKE_CURRENT_SOURCE_DIR}/LU/lu.cpp - $) +add_executable( + openmp-cg + ${CMAKE_CURRENT_SOURCE_DIR}/CG/cg.cpp + $ +) +add_executable( + openmp-lu + ${CMAKE_CURRENT_SOURCE_DIR}/LU/lu.cpp + $ +) option(USE_CLANG_OMP "Use the clang OpenMP if available" ON) if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") @@ -26,33 +34,48 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") target_link_libraries(openmp-common PUBLIC OpenMP::OpenMP_CXX) set(ROCPROFSYS_OPENMP_USING_LIBOMP_LIBRARY ON - CACHE INTERNAL "Used by rocprofiler-systems testing" FORCE) + CACHE INTERNAL + "Used by rocprofiler-systems testing" + FORCE + ) else() find_program(CLANGXX_EXECUTABLE NAMES clang++) find_library( LIBOMP_LIBRARY - NAMES omp omp5 ${CMAKE_SHARED_LIBRARY_PREFIX}omp${CMAKE_SHARED_LIBRARY_SUFFIX}.5) - if(CLANGXX_EXECUTABLE - AND LIBOMP_LIBRARY - AND COMMAND rocprofiler_systems_custom_compilation - AND USE_CLANG_OMP) + NAMES omp omp5 ${CMAKE_SHARED_LIBRARY_PREFIX}omp${CMAKE_SHARED_LIBRARY_SUFFIX}.5 + ) + if( + CLANGXX_EXECUTABLE + AND LIBOMP_LIBRARY + AND COMMAND rocprofiler_systems_custom_compilation + AND USE_CLANG_OMP + ) target_compile_options(openmp-common PUBLIC -W -Wall -fopenmp=libomp) target_link_libraries(openmp-common PUBLIC ${LIBOMP_LIBRARY}) rocprofiler_systems_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE} - TARGET openmp-common) + TARGET openmp-common + ) rocprofiler_systems_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE} - TARGET openmp-cg) + TARGET openmp-cg + ) rocprofiler_systems_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE} - TARGET openmp-lu) + TARGET openmp-lu + ) set(ROCPROFSYS_OPENMP_USING_LIBOMP_LIBRARY ON - CACHE INTERNAL "Used by rocprofiler-systems testing" FORCE) + CACHE INTERNAL + "Used by rocprofiler-systems testing" + FORCE + ) else() find_package(OpenMP REQUIRED) target_link_libraries(openmp-common PUBLIC OpenMP::OpenMP_CXX) set(ROCPROFSYS_OPENMP_USING_LIBOMP_LIBRARY OFF - CACHE INTERNAL "Used by rocprofiler-systems testing" FORCE) + CACHE INTERNAL + "Used by rocprofiler-systems testing" + FORCE + ) endif() endif() @@ -63,7 +86,8 @@ if(ROCPROFSYS_INSTALL_EXAMPLES) install( TARGETS openmp-cg openmp-lu DESTINATION bin - COMPONENT rocprofiler-systems-examples) + COMPONENT rocprofiler-systems-examples + ) endif() if(ROCPROFSYS_DISABLE_EXAMPLES) diff --git a/projects/rocprofiler-systems/examples/openmp/target/CMakeLists.txt b/projects/rocprofiler-systems/examples/openmp/target/CMakeLists.txt index 3bb695a0df..3dc92ffedf 100644 --- a/projects/rocprofiler-systems/examples/openmp/target/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/openmp/target/CMakeLists.txt @@ -4,15 +4,22 @@ if(NOT OMP_TARGET_COMPILER) find_program( amdclangpp_EXECUTABLE NAMES amdclang++ - HINTS ${ROCM_PATH} ENV ROCM_PATH /opt/rocm - PATHS ${ROCM_PATH} ENV ROCM_PATH /opt/rocm - PATH_SUFFIXES bin llvm/bin) + HINTS ${ROCM_PATH} + ENV ROCM_PATH + /opt/rocm + PATHS ${ROCM_PATH} + ENV ROCM_PATH + /opt/rocm + PATH_SUFFIXES bin llvm/bin + ) mark_as_advanced(amdclangpp_EXECUTABLE) if(amdclangpp_EXECUTABLE) set(OMP_TARGET_COMPILER "${amdclangpp_EXECUTABLE}" - CACHE FILEPATH "OpenMP target compiler") + CACHE FILEPATH + "OpenMP target compiler" + ) else() message(WARNING "OpenMP target compiler not found. Skipping this example.") return() @@ -36,11 +43,10 @@ set(DEFAULT_GPU_TARGETS "gfx1010" "gfx1100" "gfx1101" - "gfx1102") + "gfx1102" +) -set(GPU_TARGETS - "${DEFAULT_GPU_TARGETS}" - CACHE STRING "GPU targets to compile for") +set(GPU_TARGETS "${DEFAULT_GPU_TARGETS}" CACHE STRING "GPU targets to compile for") find_package(Threads REQUIRED) @@ -67,13 +73,15 @@ if(NOT EXISTS ${OMP_TARGET_COMPILER_DIR}/llvm/lib) endif() set_target_properties( openmp-target-lib - PROPERTIES BUILD_RPATH - "${OMP_TARGET_COMPILER_DIR}/llvm/lib:${OMP_TARGET_COMPILER_DIR}/lib" - OUTPUT_NAME "openmp-target" - POSITION_INDEPENDENT_CODE ON) + PROPERTIES + BUILD_RPATH "${OMP_TARGET_COMPILER_DIR}/llvm/lib:${OMP_TARGET_COMPILER_DIR}/lib" + OUTPUT_NAME "openmp-target" + POSITION_INDEPENDENT_CODE ON +) rocprofiler_systems_custom_compilation(TARGET openmp-target-lib - COMPILER ${OMP_TARGET_COMPILER}) + COMPILER ${OMP_TARGET_COMPILER} +) add_executable(openmp-target) target_sources(openmp-target PRIVATE main.cpp) @@ -82,9 +90,11 @@ target_compile_options(openmp-target PRIVATE -ggdb) set_target_properties( openmp-target - PROPERTIES BUILD_RPATH - "${OMP_TARGET_COMPILER_DIR}/llvm/lib:${OMP_TARGET_COMPILER_DIR}/lib" - POSITION_INDEPENDENT_CODE ON) + PROPERTIES + BUILD_RPATH "${OMP_TARGET_COMPILER_DIR}/llvm/lib:${OMP_TARGET_COMPILER_DIR}/lib" + POSITION_INDEPENDENT_CODE ON +) rocprofiler_systems_custom_compilation(TARGET openmp-target - COMPILER ${OMP_TARGET_COMPILER}) + COMPILER ${OMP_TARGET_COMPILER} +) diff --git a/projects/rocprofiler-systems/examples/parallel-overhead/CMakeLists.txt b/projects/rocprofiler-systems/examples/parallel-overhead/CMakeLists.txt index 5733a18dce..c28b326c93 100644 --- a/projects/rocprofiler-systems/examples/parallel-overhead/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/parallel-overhead/CMakeLists.txt @@ -5,8 +5,10 @@ project(rocprofiler-systems-parallel-overhead-example LANGUAGES CXX) if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - ROCPROFSYS_DISABLE_EXAMPLES) + if( + ${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + ) return() endif() endif() @@ -18,17 +20,22 @@ add_library(parallel-overhead-compile-options INTERFACE) target_compile_options(parallel-overhead-compile-options INTERFACE -g) add_executable(parallel-overhead parallel-overhead.cpp) -target_link_libraries(parallel-overhead PRIVATE Threads::Threads - parallel-overhead-compile-options) +target_link_libraries( + parallel-overhead + PRIVATE Threads::Threads parallel-overhead-compile-options +) add_executable(parallel-overhead-locks parallel-overhead.cpp) -target_link_libraries(parallel-overhead-locks PRIVATE Threads::Threads - parallel-overhead-compile-options) +target_link_libraries( + parallel-overhead-locks + PRIVATE Threads::Threads parallel-overhead-compile-options +) target_compile_definitions(parallel-overhead-locks PRIVATE USE_LOCKS=1) if(ROCPROFSYS_INSTALL_EXAMPLES) install( TARGETS parallel-overhead parallel-overhead-locks DESTINATION bin - COMPONENT rocprofiler-systems-examples) + COMPONENT rocprofiler-systems-examples + ) endif() diff --git a/projects/rocprofiler-systems/examples/python/CMakeLists.txt b/projects/rocprofiler-systems/examples/python/CMakeLists.txt index c57e4625dc..d88c0b597b 100644 --- a/projects/rocprofiler-systems/examples/python/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/python/CMakeLists.txt @@ -5,13 +5,21 @@ project(rocprofiler-systems-python) if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - ROCPROFSYS_DISABLE_EXAMPLES) + if( + ${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + ) return() endif() endif() -set(PYTHON_FILES builtin.py external.py source.py noprofile.py fill.py) +set(PYTHON_FILES + builtin.py + external.py + source.py + noprofile.py + fill.py +) find_package(Python3 COMPONENTS Interpreter) @@ -19,14 +27,18 @@ if(Python3_FOUND) set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}") foreach(_FILE ${PYTHON_FILES}) - configure_file(${PROJECT_SOURCE_DIR}/${_FILE} ${PROJECT_BINARY_DIR}/${_FILE} - @ONLY) + configure_file( + ${PROJECT_SOURCE_DIR}/${_FILE} + ${PROJECT_BINARY_DIR}/${_FILE} + @ONLY + ) if(ROCPROFSYS_INSTALL_EXAMPLES) install( PROGRAMS ${PROJECT_BINARY_DIR}/${_FILE} DESTINATION bin - COMPONENT rocprofiler-systems-examples) + COMPONENT rocprofiler-systems-examples + ) endif() endforeach() endif() diff --git a/projects/rocprofiler-systems/examples/rccl/CMakeLists.txt b/projects/rocprofiler-systems/examples/rccl/CMakeLists.txt index 799bf6d547..bdfc878bda 100644 --- a/projects/rocprofiler-systems/examples/rccl/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/rccl/CMakeLists.txt @@ -5,16 +5,20 @@ project(rocprofiler-systems-rccl-example LANGUAGES CXX) if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - ROCPROFSYS_DISABLE_EXAMPLES) + if( + ${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + ) return() endif() endif() function(rccl_message _MSG_TYPE) - if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems" - AND "$ENV{ROCPROFSYS_CI}" - AND "${_MSG_TYPE}" MATCHES "WARNING") + if( + "${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems" + AND "$ENV{ROCPROFSYS_CI}" + AND "${_MSG_TYPE}" MATCHES "WARNING" + ) set(_MSG_TYPE STATUS) # don't generate warnings during CI endif() if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems") @@ -31,10 +35,10 @@ if(NOT hip_FOUND) return() endif() -if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems" - AND ("$ENV{ROCPROFSYS_CI}" - OR ROCPROFSYS_CI - OR ROCPROFSYS_BUILD_CI)) +if( + "${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems" + AND ("$ENV{ROCPROFSYS_CI}" OR ROCPROFSYS_CI OR ROCPROFSYS_BUILD_CI) +) find_package(rccl QUIET) # avoid generating warning in CI else() find_package(rccl) @@ -47,11 +51,11 @@ endif() if(hip_FOUND AND rccl_FOUND) include(FetchContent) - fetchcontent_declare(rccl-tests GIT_REPOSITORY https://github.com/ROCm/rccl-tests.git) + FetchContent_Declare(rccl-tests GIT_REPOSITORY https://github.com/ROCm/rccl-tests.git) # After the following call, the CMake targets defined by googletest and Catch2 will be # available to the rest of the build - fetchcontent_populate(rccl-tests) + FetchContent_Populate(rccl-tests) get_filename_component(rccl_ROOT_DIR "${rccl_INCLUDE_DIR}" DIRECTORY) @@ -62,29 +66,35 @@ if(hip_FOUND AND rccl_FOUND) RESULT_VARIABLE _RCCL_BUILD_RET ERROR_VARIABLE _RCCL_BUILD_ERR OUTPUT_VARIABLE _RCCL_BUILD_OUT - OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE) + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE + ) if(NOT _RCCL_BUILD_RET EQUAL 0) rccl_message(${_RCCL_BUILD_OUT}) rccl_message(AUTHOR_WARNING "Failed to build rccl-tests: ${_RCCL_BUILD_ERR}") else() - file(GLOB RCCL_TEST_EXECUTABLES - ${CMAKE_BINARY_DIR}/_deps/rccl-tests-src/build/*_perf) + file( + GLOB RCCL_TEST_EXECUTABLES + ${CMAKE_BINARY_DIR}/_deps/rccl-tests-src/build/*_perf + ) set(_RCCL_TEST_TARGETS) foreach(_EXE ${RCCL_TEST_EXECUTABLES}) get_filename_component(_EXE_NAME "${_EXE}" NAME) - execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${_EXE} - ${CMAKE_CURRENT_BINARY_DIR}/${_EXE_NAME}) + execute_process( + COMMAND + ${CMAKE_COMMAND} -E copy ${_EXE} + ${CMAKE_CURRENT_BINARY_DIR}/${_EXE_NAME} + ) add_executable(rccl-tests::${_EXE_NAME} IMPORTED GLOBAL) set_property( TARGET rccl-tests::${_EXE_NAME} - PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/${_EXE_NAME}) + PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/${_EXE_NAME} + ) list(APPEND _RCCL_TEST_TARGETS "rccl-tests::${_EXE_NAME}") endforeach() - set(RCCL_TEST_TARGETS - "${_RCCL_TEST_TARGETS}" - CACHE INTERNAL "rccl-test targets") + set(RCCL_TEST_TARGETS "${_RCCL_TEST_TARGETS}" CACHE INTERNAL "rccl-test targets") endif() endif() diff --git a/projects/rocprofiler-systems/examples/rewrite-caller/CMakeLists.txt b/projects/rocprofiler-systems/examples/rewrite-caller/CMakeLists.txt index 47f3a645b4..658fecb812 100644 --- a/projects/rocprofiler-systems/examples/rewrite-caller/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/rewrite-caller/CMakeLists.txt @@ -5,8 +5,10 @@ project(rocprofiler-systems-rewrite-caller-example LANGUAGES CXX) if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - ROCPROFSYS_DISABLE_EXAMPLES) + if( + ${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + ) return() endif() endif() @@ -17,8 +19,5 @@ add_executable(rewrite-caller rewrite-caller.cpp) target_compile_options(rewrite-caller PRIVATE ${_FLAGS}) if(ROCPROFSYS_INSTALL_EXAMPLES) - install( - TARGETS rewrite-caller - DESTINATION bin - COMPONENT rocprofiler-systems-examples) + install(TARGETS rewrite-caller DESTINATION bin COMPONENT rocprofiler-systems-examples) endif() diff --git a/projects/rocprofiler-systems/examples/trace-time-window/CMakeLists.txt b/projects/rocprofiler-systems/examples/trace-time-window/CMakeLists.txt index 3b3716d5db..17552a759f 100644 --- a/projects/rocprofiler-systems/examples/trace-time-window/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/trace-time-window/CMakeLists.txt @@ -5,8 +5,10 @@ project(rocprofiler-systems-trace-time-window-example LANGUAGES CXX) if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - ROCPROFSYS_DISABLE_EXAMPLES) + if( + ${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + ) return() endif() endif() @@ -20,5 +22,6 @@ if(ROCPROFSYS_INSTALL_EXAMPLES) install( TARGETS trace-time-window DESTINATION bin - COMPONENT rocprofiler-systems-examples) + COMPONENT rocprofiler-systems-examples + ) endif() diff --git a/projects/rocprofiler-systems/examples/transpose/CMakeLists.txt b/projects/rocprofiler-systems/examples/transpose/CMakeLists.txt index bc7c721fc7..d2e430131b 100644 --- a/projects/rocprofiler-systems/examples/transpose/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/transpose/CMakeLists.txt @@ -5,8 +5,10 @@ project(rocprofiler-systems-transpose-example LANGUAGES CXX) if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - ROCPROFSYS_DISABLE_EXAMPLES) + if( + ${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + ) return() endif() endif() @@ -16,8 +18,14 @@ find_package(hip QUIET HINTS ${ROCmVersion_DIR} PATHS ${ROCmVersion_DIR}) find_program( HIPCC_EXECUTABLE NAMES hipcc - HINTS ${ROCmVersion_DIR} ${ROCM_PATH} ENV ROCM_PATH /opt/rocm - PATHS ${ROCmVersion_DIR} ${ROCM_PATH} ENV ROCM_PATH /opt/rocm NO_CACHE) + HINTS ${ROCmVersion_DIR} ${ROCM_PATH} + ENV ROCM_PATH + /opt/rocm + PATHS ${ROCmVersion_DIR} ${ROCM_PATH} + ENV ROCM_PATH + /opt/rocm + NO_CACHE +) mark_as_advanced(HIPCC_EXECUTABLE) if(NOT HIPCC_EXECUTABLE) @@ -26,17 +34,21 @@ if(NOT HIPCC_EXECUTABLE) endif() if(NOT CMAKE_CXX_COMPILER_IS_HIPCC AND HIPCC_EXECUTABLE) - if(CMAKE_CXX_COMPILER STREQUAL HIPCC_EXECUTABLE OR "${CMAKE_CXX_COMPILER}" MATCHES - "hipcc") - set(CMAKE_CXX_COMPILER_IS_HIPCC - 1 - CACHE BOOL "HIP compiler") + if( + CMAKE_CXX_COMPILER STREQUAL HIPCC_EXECUTABLE + OR "${CMAKE_CXX_COMPILER}" MATCHES "hipcc" + ) + set(CMAKE_CXX_COMPILER_IS_HIPCC 1 CACHE BOOL "HIP compiler") endif() endif() -if((NOT CMAKE_CXX_COMPILER_IS_HIPCC OR (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang" - AND NOT hip_FOUND)) - AND (NOT COMMAND rocprofiler_systems_custom_compilation AND NOT HIPCC_EXECUTABLE)) +if( + ( + NOT CMAKE_CXX_COMPILER_IS_HIPCC + OR (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT hip_FOUND) + ) + AND (NOT COMMAND rocprofiler_systems_custom_compilation AND NOT HIPCC_EXECUTABLE) +) message(AUTHOR_WARNING "transpose target could not be built") return() endif() @@ -51,15 +63,18 @@ endif() add_executable(transpose transpose.cpp) target_link_libraries(transpose PRIVATE Threads::Threads) -if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" - AND NOT CMAKE_CXX_COMPILER_IS_HIPCC - AND NOT HIPCC_EXECUTABLE) +if( + CMAKE_CXX_COMPILER_ID MATCHES "Clang" + AND NOT CMAKE_CXX_COMPILER_IS_HIPCC + AND NOT HIPCC_EXECUTABLE +) target_link_libraries( transpose PRIVATE $ $ - $) + $ + ) else() target_compile_options(transpose PRIVATE -W -Wall) endif() @@ -79,8 +94,5 @@ if(NOT CMAKE_CXX_COMPILER_IS_HIPCC AND HIPCC_EXECUTABLE) endif() if(ROCPROFSYS_INSTALL_EXAMPLES) - install( - TARGETS transpose - DESTINATION bin - COMPONENT rocprofiler-systems-examples) + install(TARGETS transpose DESTINATION bin COMPONENT rocprofiler-systems-examples) endif() diff --git a/projects/rocprofiler-systems/examples/user-api/CMakeLists.txt b/projects/rocprofiler-systems/examples/user-api/CMakeLists.txt index f002f662d6..772a2700b5 100644 --- a/projects/rocprofiler-systems/examples/user-api/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/user-api/CMakeLists.txt @@ -5,8 +5,10 @@ project(rocprofiler-systems-user-api-example LANGUAGES CXX) if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - ROCPROFSYS_DISABLE_EXAMPLES) + if( + ${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + ) return() endif() endif() @@ -18,12 +20,10 @@ if(NOT TARGET rocprofiler-systems::rocprofiler-systems-user-library) endif() add_executable(user-api user-api.cpp) target_link_libraries( - user-api PRIVATE Threads::Threads - rocprofiler-systems::rocprofiler-systems-user-library) + user-api + PRIVATE Threads::Threads rocprofiler-systems::rocprofiler-systems-user-library +) if(ROCPROFSYS_INSTALL_EXAMPLES) - install( - TARGETS user-api - DESTINATION bin - COMPONENT rocprofiler-systems-examples) + install(TARGETS user-api DESTINATION bin COMPONENT rocprofiler-systems-examples) endif() diff --git a/projects/rocprofiler-systems/examples/videodecode/CMakeLists.txt b/projects/rocprofiler-systems/examples/videodecode/CMakeLists.txt index 9e85555507..ce1a50a0df 100644 --- a/projects/rocprofiler-systems/examples/videodecode/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/videodecode/CMakeLists.txt @@ -30,16 +30,20 @@ string(REPLACE " " ";" _FLAGS "${CMAKE_CXX_FLAGS_DEBUG}") if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - ROCPROFSYS_DISABLE_EXAMPLES) + if( + ${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES + ) return() endif() endif() function(videodecode_message _MSG_TYPE) - if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems" - AND "$ENV{ROCPROFSYS_CI}" - AND "${_MSG_TYPE}" MATCHES "WARNING") + if( + "${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems" + AND "$ENV{ROCPROFSYS_CI}" + AND "${_MSG_TYPE}" MATCHES "WARNING" + ) set(_MSG_TYPE STATUS) # don't generate warnings during CI endif() if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems") @@ -67,7 +71,8 @@ if(EXISTS "${ROCmVersion_DIR}/share/rocdecode/video") else() videodecode_message( AUTHOR_WARNING - "Source directory ${ROCmVersion_DIR}/share/rocdecode/video does not exist") + "Source directory ${ROCmVersion_DIR}/share/rocdecode/video does not exist" + ) endif() # Find FFMPEG @@ -86,19 +91,11 @@ find_path( FFMPEG_INCLUDE_DIR NAMES libavcodec/avcodec.h libavformat/avformat.h libavutil/avutil.h PATHS ${FFMPEG_INCLUDE_DIRS} - PATH_SUFFIXES ffmpeg libav) -find_library( - AVCODEC_LIBRARY - NAMES avcodec - PATHS ${FFMPEG_LIBRARY_DIRS}) -find_library( - AVFORMAT_LIBRARY - NAMES avformat - PATHS ${FFMPEG_LIBRARY_DIRS}) -find_library( - AVUTIL_LIBRARY - NAMES avutil - PATHS ${FFMPEG_LIBRARY_DIRS}) + PATH_SUFFIXES ffmpeg libav +) +find_library(AVCODEC_LIBRARY NAMES avcodec PATHS ${FFMPEG_LIBRARY_DIRS}) +find_library(AVFORMAT_LIBRARY NAMES avformat PATHS ${FFMPEG_LIBRARY_DIRS}) +find_library(AVUTIL_LIBRARY NAMES avutil PATHS ${FFMPEG_LIBRARY_DIRS}) set(FFMPEG_LIBRARIES ${AVCODEC_LIBRARY} ${AVFORMAT_LIBRARY} ${AVUTIL_LIBRARY}) set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIR}) @@ -143,16 +140,18 @@ if(FFMPEG_FOUND AND ROCDECODE_FOUND) install( TARGETS videodecode DESTINATION bin - COMPONENT rocprofiler-systems-examples) + COMPONENT rocprofiler-systems-examples + ) install( FILES ${CMAKE_BINARY_DIR}/videos DESTINATION share/rocprofiler-systems/tests/videos - COMPONENT rocprofiler-systems-examples) + COMPONENT rocprofiler-systems-examples + ) endif() else() message( "-- ERROR!: videodecode excluded! please install all the dependencies and try again!" - ) + ) if(NOT FFMPEG_FOUND) message(WARNING "-- ERROR!: FFMPEG Not Found! - please install FFMPEG!") endif() diff --git a/projects/rocprofiler-systems/scripts/check-cmake-format.sh b/projects/rocprofiler-systems/scripts/check-cmake-format.sh index 700db677e5..adada3f8e3 100755 --- a/projects/rocprofiler-systems/scripts/check-cmake-format.sh +++ b/projects/rocprofiler-systems/scripts/check-cmake-format.sh @@ -22,14 +22,14 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -if ! command -v cmake-format &> /dev/null; then - echo "cmake-format could not be found. Please install it with 'pip install cmake-format' or 'apt install cmake-format'." +if ! command -v gersemi &> /dev/null; then + echo "gersemi could not be found. Please install it with 'pip install gersemi' or 'apt install gersemi'." exit 1 fi for file in "$@"; do - # Run cmake-format in-place - cmake-format -i "$file" + # Run gersemi in-place + gersemi -i "$file" # Check if the file has changes using git diff if ! git diff --quiet -- "$file"; then echo "Formatted: $file" diff --git a/projects/rocprofiler-systems/scripts/write-rocprof-sys-install.cmake b/projects/rocprofiler-systems/scripts/write-rocprof-sys-install.cmake index 1b2f1467eb..b01c729aae 100644 --- a/projects/rocprofiler-systems/scripts/write-rocprof-sys-install.cmake +++ b/projects/rocprofiler-systems/scripts/write-rocprof-sys-install.cmake @@ -25,8 +25,13 @@ cmake_minimum_required(VERSION 3.18.4) if(NOT DEFINED ROCPROFSYS_VERSION) file(READ "${CMAKE_CURRENT_LIST_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" - ROCPROFSYS_VERSION "${FULL_VERSION_STRING}") + string( + REGEX REPLACE + "([0-9]+)\.([0-9]+)\.([0-9]+)(.*)" + "\\1.\\2.\\3" + ROCPROFSYS_VERSION + "${FULL_VERSION_STRING}" + ) endif() find_package(Git) @@ -37,20 +42,22 @@ if(Git_FOUND AND EXISTS ".git") OUTPUT_VARIABLE ROCPROFSYS_GIT_TAG OUTPUT_STRIP_TRAILING_WHITESPACE RESULT_VARIABLE _GIT_DESCRIBE_RESULT - ERROR_QUIET) + ERROR_QUIET + ) if(NOT _GIT_DESCRIBE_RESULT EQUAL 0) execute_process( COMMAND ${GIT_EXECUTABLE} describe OUTPUT_VARIABLE ROCPROFSYS_GIT_TAG OUTPUT_STRIP_TRAILING_WHITESPACE RESULT_VARIABLE _GIT_DESCRIBE_RESULT - ERROR_QUIET) + ERROR_QUIET + ) endif() else() message( STATUS - "Git not found or .git directory not found; using version ${ROCPROFSYS_VERSION}" - ) + "Git not found or .git directory not found; using version ${ROCPROFSYS_VERSION}" + ) set(GIT_DESCRIBE "v${ROCPROFSYS_VERSION}") endif() @@ -62,5 +69,8 @@ message(STATUS "Writing ${OUTPUT_DIR}/rocprofiler-systems-install.py.") message(STATUS "rocprofiler-systems version: ${ROCPROFSYS_VERSION}.") message(STATUS "rocprofiler-systems git describe: ${ROCPROFSYS_GIT_TAG}") -configure_file(${CMAKE_CURRENT_LIST_DIR}/../cmake/Templates/rocprof-sys-install.py.in - ${OUTPUT_DIR}/rocprofiler-systems-install.py @ONLY) +configure_file( + ${CMAKE_CURRENT_LIST_DIR}/../cmake/Templates/rocprof-sys-install.py.in + ${OUTPUT_DIR}/rocprofiler-systems-install.py + @ONLY +) diff --git a/projects/rocprofiler-systems/source/CMakeLists.txt b/projects/rocprofiler-systems/source/CMakeLists.txt index a6cc921714..5348fde5d4 100644 --- a/projects/rocprofiler-systems/source/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/CMakeLists.txt @@ -19,8 +19,13 @@ endif() if(ROCPROFSYS_BUILD_DEVELOPER) add_custom_target(rocprofiler-systems-precommit) - foreach(_TARGET format-rocprofiler-systems-source format-rocprofiler-systems-cmake - format-timemory-source format-timemory-cmake) + foreach( + _TARGET + format-rocprofiler-systems-source + format-rocprofiler-systems-cmake + format-timemory-source + format-timemory-cmake + ) if(TARGET ${_TARGET}) add_dependencies(rocprofiler-systems-precommit ${_TARGET}) endif() diff --git a/projects/rocprofiler-systems/source/bin/CMakeLists.txt b/projects/rocprofiler-systems/source/bin/CMakeLists.txt index 3ac0cd0786..a17d9fbbc2 100644 --- a/projects/rocprofiler-systems/source/bin/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/bin/CMakeLists.txt @@ -2,7 +2,7 @@ set(ROCPROFSYS_EXE_INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}" - ) +) # executables add_subdirectory(rocprof-sys-avail) diff --git a/projects/rocprofiler-systems/source/bin/rocprof-sys-avail/CMakeLists.txt b/projects/rocprofiler-systems/source/bin/rocprof-sys-avail/CMakeLists.txt index 427d34df14..b49664185e 100644 --- a/projects/rocprofiler-systems/source/bin/rocprof-sys-avail/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/bin/rocprof-sys-avail/CMakeLists.txt @@ -8,37 +8,42 @@ add_executable(rocprofiler-systems-avail) target_sources( rocprofiler-systems-avail - PRIVATE ${CMAKE_CURRENT_LIST_DIR}/avail.cpp - ${CMAKE_CURRENT_LIST_DIR}/avail.hpp - ${CMAKE_CURRENT_LIST_DIR}/common.cpp - ${CMAKE_CURRENT_LIST_DIR}/common.hpp - ${CMAKE_CURRENT_LIST_DIR}/component_categories.hpp - ${CMAKE_CURRENT_LIST_DIR}/defines.hpp - ${CMAKE_CURRENT_LIST_DIR}/enumerated_list.hpp - ${CMAKE_CURRENT_LIST_DIR}/generate_config.cpp - ${CMAKE_CURRENT_LIST_DIR}/generate_config.hpp - ${CMAKE_CURRENT_LIST_DIR}/get_availability.hpp - ${CMAKE_CURRENT_LIST_DIR}/get_categories.hpp - ${CMAKE_CURRENT_LIST_DIR}/info_type.cpp - ${CMAKE_CURRENT_LIST_DIR}/info_type.hpp) + PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/avail.cpp + ${CMAKE_CURRENT_LIST_DIR}/avail.hpp + ${CMAKE_CURRENT_LIST_DIR}/common.cpp + ${CMAKE_CURRENT_LIST_DIR}/common.hpp + ${CMAKE_CURRENT_LIST_DIR}/component_categories.hpp + ${CMAKE_CURRENT_LIST_DIR}/defines.hpp + ${CMAKE_CURRENT_LIST_DIR}/enumerated_list.hpp + ${CMAKE_CURRENT_LIST_DIR}/generate_config.cpp + ${CMAKE_CURRENT_LIST_DIR}/generate_config.hpp + ${CMAKE_CURRENT_LIST_DIR}/get_availability.hpp + ${CMAKE_CURRENT_LIST_DIR}/get_categories.hpp + ${CMAKE_CURRENT_LIST_DIR}/info_type.cpp + ${CMAKE_CURRENT_LIST_DIR}/info_type.hpp +) target_include_directories(rocprofiler-systems-avail PRIVATE ${CMAKE_CURRENT_LIST_DIR}) -target_compile_definitions(rocprofiler-systems-avail - PRIVATE ROCPROFSYS_EXTERN_COMPONENTS=0) +target_compile_definitions( + rocprofiler-systems-avail + PRIVATE ROCPROFSYS_EXTERN_COMPONENTS=0 +) target_link_libraries( rocprofiler-systems-avail - PRIVATE rocprofiler-systems::rocprofiler-systems-compile-definitions - rocprofiler-systems::rocprofiler-systems-interface-library - rocprofiler-systems::librocprofiler-systems-static) + PRIVATE + rocprofiler-systems::rocprofiler-systems-compile-definitions + rocprofiler-systems::rocprofiler-systems-interface-library + rocprofiler-systems::librocprofiler-systems-static +) set_target_properties( rocprofiler-systems-avail - PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" - INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}" - OUTPUT_NAME ${BINARY_NAME_PREFIX}-avail) + PROPERTIES + BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" + INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}" + OUTPUT_NAME ${BINARY_NAME_PREFIX}-avail +) rocprofiler_systems_strip_target(rocprofiler-systems-avail) -install( - TARGETS rocprofiler-systems-avail - DESTINATION ${CMAKE_INSTALL_BINDIR} - OPTIONAL) +install(TARGETS rocprofiler-systems-avail DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) diff --git a/projects/rocprofiler-systems/source/bin/rocprof-sys-causal/CMakeLists.txt b/projects/rocprofiler-systems/source/bin/rocprof-sys-causal/CMakeLists.txt index 8103a24c27..921b076211 100644 --- a/projects/rocprofiler-systems/source/bin/rocprof-sys-causal/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/bin/rocprof-sys-causal/CMakeLists.txt @@ -7,25 +7,28 @@ add_executable( rocprofiler-systems-causal ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-causal.cpp - ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-causal.hpp ${CMAKE_CURRENT_LIST_DIR}/impl.cpp) + ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-causal.hpp + ${CMAKE_CURRENT_LIST_DIR}/impl.cpp +) target_compile_definitions(rocprofiler-systems-causal PRIVATE TIMEMORY_CMAKE=1) target_include_directories(rocprofiler-systems-causal PRIVATE ${CMAKE_CURRENT_LIST_DIR}) target_link_libraries( rocprofiler-systems-causal - PRIVATE rocprofiler-systems::rocprofiler-systems-compile-definitions - rocprofiler-systems::rocprofiler-systems-headers - rocprofiler-systems::rocprofiler-systems-common-library - rocprofiler-systems::rocprofiler-systems-core) + PRIVATE + rocprofiler-systems::rocprofiler-systems-compile-definitions + rocprofiler-systems::rocprofiler-systems-headers + rocprofiler-systems::rocprofiler-systems-common-library + rocprofiler-systems::rocprofiler-systems-core +) set_target_properties( rocprofiler-systems-causal - PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" - INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}" - OUTPUT_NAME ${BINARY_NAME_PREFIX}-causal) + PROPERTIES + BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" + INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}" + OUTPUT_NAME ${BINARY_NAME_PREFIX}-causal +) rocprofiler_systems_strip_target(rocprofiler-systems-causal) -install( - TARGETS rocprofiler-systems-causal - DESTINATION ${CMAKE_INSTALL_BINDIR} - OPTIONAL) +install(TARGETS rocprofiler-systems-causal DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) diff --git a/projects/rocprofiler-systems/source/bin/rocprof-sys-exe/CMakeLists.txt b/projects/rocprofiler-systems/source/bin/rocprof-sys-exe/CMakeLists.txt index 329e839750..d95d9066f8 100644 --- a/projects/rocprofiler-systems/source/bin/rocprof-sys-exe/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/bin/rocprof-sys-exe/CMakeLists.txt @@ -7,19 +7,20 @@ add_executable(rocprofiler-systems-exe ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys.cpp) -target_link_libraries(rocprofiler-systems-exe - PRIVATE rocprofiler-systems::rocprofiler-systems-threading) +target_link_libraries( + rocprofiler-systems-exe + PRIVATE rocprofiler-systems::rocprofiler-systems-threading +) set_target_properties( rocprofiler-systems-exe - PROPERTIES OUTPUT_NAME rocprof-sys - BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" - INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}" - INSTALL_RPATH_USE_LINK_PATH ON) + PROPERTIES + OUTPUT_NAME rocprof-sys + BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" + INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}" + INSTALL_RPATH_USE_LINK_PATH ON +) rocprofiler_systems_strip_target(rocprofiler-systems-exe) -install( - TARGETS rocprofiler-systems-exe - DESTINATION ${CMAKE_INSTALL_BINDIR} - OPTIONAL) +install(TARGETS rocprofiler-systems-exe DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) diff --git a/projects/rocprofiler-systems/source/bin/rocprof-sys-instrument/CMakeLists.txt b/projects/rocprofiler-systems/source/bin/rocprof-sys-instrument/CMakeLists.txt index 3e32a39363..b0efa92642 100644 --- a/projects/rocprofiler-systems/source/bin/rocprof-sys-instrument/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/bin/rocprof-sys-instrument/CMakeLists.txt @@ -10,43 +10,51 @@ add_executable(rocprofiler-systems-instrument) target_sources( rocprofiler-systems-instrument - PRIVATE ${CMAKE_CURRENT_LIST_DIR}/details.cpp - ${CMAKE_CURRENT_LIST_DIR}/function_signature.cpp - ${CMAKE_CURRENT_LIST_DIR}/function_signature.hpp - ${CMAKE_CURRENT_LIST_DIR}/fwd.hpp - ${CMAKE_CURRENT_LIST_DIR}/info.hpp - ${CMAKE_CURRENT_LIST_DIR}/internal_libs.cpp - ${CMAKE_CURRENT_LIST_DIR}/internal_libs.hpp - ${CMAKE_CURRENT_LIST_DIR}/log.cpp - ${CMAKE_CURRENT_LIST_DIR}/log.hpp - ${CMAKE_CURRENT_LIST_DIR}/module_function.cpp - ${CMAKE_CURRENT_LIST_DIR}/module_function.hpp - ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-instrument.cpp - ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-instrument.hpp) + PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/details.cpp + ${CMAKE_CURRENT_LIST_DIR}/function_signature.cpp + ${CMAKE_CURRENT_LIST_DIR}/function_signature.hpp + ${CMAKE_CURRENT_LIST_DIR}/fwd.hpp + ${CMAKE_CURRENT_LIST_DIR}/info.hpp + ${CMAKE_CURRENT_LIST_DIR}/internal_libs.cpp + ${CMAKE_CURRENT_LIST_DIR}/internal_libs.hpp + ${CMAKE_CURRENT_LIST_DIR}/log.cpp + ${CMAKE_CURRENT_LIST_DIR}/log.hpp + ${CMAKE_CURRENT_LIST_DIR}/module_function.cpp + ${CMAKE_CURRENT_LIST_DIR}/module_function.hpp + ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-instrument.cpp + ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-instrument.hpp +) target_link_libraries( rocprofiler-systems-instrument - PRIVATE rocprofiler-systems::rocprofiler-systems-headers - rocprofiler-systems::rocprofiler-systems-dyninst - rocprofiler-systems::rocprofiler-systems-compile-options - rocprofiler-systems::rocprofiler-systems-compile-definitions - rocprofiler-systems::rocprofiler-systems-sanitizer - timemory::timemory-headers - timemory::timemory-extensions - timemory::timemory-core) + PRIVATE + rocprofiler-systems::rocprofiler-systems-headers + rocprofiler-systems::rocprofiler-systems-dyninst + rocprofiler-systems::rocprofiler-systems-compile-options + rocprofiler-systems::rocprofiler-systems-compile-definitions + rocprofiler-systems::rocprofiler-systems-sanitizer + timemory::timemory-headers + timemory::timemory-extensions + timemory::timemory-core +) add_target_flag_if_avail(rocprofiler-systems-instrument "-Wno-deprecated-declarations") set_target_properties( rocprofiler-systems-instrument - PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" - INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}" - INSTALL_RPATH_USE_LINK_PATH ON - OUTPUT_NAME ${BINARY_NAME_PREFIX}-instrument) + PROPERTIES + BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" + INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}" + INSTALL_RPATH_USE_LINK_PATH ON + OUTPUT_NAME ${BINARY_NAME_PREFIX}-instrument +) if(ROCPROFSYS_BUILD_DYNINST) - target_compile_definitions(rocprofiler-systems-instrument - PRIVATE ROCPROFSYS_BUILD_DYNINST=1) + target_compile_definitions( + rocprofiler-systems-instrument + PRIVATE ROCPROFSYS_BUILD_DYNINST=1 + ) endif() add_target_flag_if_avail(rocprofiler-systems-instrument "-Wno-deprecated-declarations") @@ -61,4 +69,5 @@ endif() install( TARGETS rocprofiler-systems-instrument DESTINATION ${CMAKE_INSTALL_BINDIR} - OPTIONAL) + OPTIONAL +) diff --git a/projects/rocprofiler-systems/source/bin/rocprof-sys-run/CMakeLists.txt b/projects/rocprofiler-systems/source/bin/rocprof-sys-run/CMakeLists.txt index 0a01945050..491a4036ee 100644 --- a/projects/rocprofiler-systems/source/bin/rocprof-sys-run/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/bin/rocprof-sys-run/CMakeLists.txt @@ -7,26 +7,29 @@ add_executable( rocprofiler-systems-run ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-run.cpp - ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-run.hpp ${CMAKE_CURRENT_LIST_DIR}/impl.cpp) + ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-run.hpp + ${CMAKE_CURRENT_LIST_DIR}/impl.cpp +) target_compile_definitions(rocprofiler-systems-run PRIVATE TIMEMORY_CMAKE=1) target_include_directories(rocprofiler-systems-run PRIVATE ${CMAKE_CURRENT_LIST_DIR}) target_link_libraries( rocprofiler-systems-run - PRIVATE rocprofiler-systems::rocprofiler-systems-compile-definitions - rocprofiler-systems::rocprofiler-systems-headers - rocprofiler-systems::rocprofiler-systems-common-library - rocprofiler-systems::rocprofiler-systems-core - rocprofiler-systems::rocprofiler-systems-sanitizer) + PRIVATE + rocprofiler-systems::rocprofiler-systems-compile-definitions + rocprofiler-systems::rocprofiler-systems-headers + rocprofiler-systems::rocprofiler-systems-common-library + rocprofiler-systems::rocprofiler-systems-core + rocprofiler-systems::rocprofiler-systems-sanitizer +) set_target_properties( rocprofiler-systems-run - PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" - INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}" - OUTPUT_NAME ${BINARY_NAME_PREFIX}-run) + PROPERTIES + BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" + INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}" + OUTPUT_NAME ${BINARY_NAME_PREFIX}-run +) rocprofiler_systems_strip_target(rocprofiler-systems-run) -install( - TARGETS rocprofiler-systems-run - DESTINATION ${CMAKE_INSTALL_BINDIR} - OPTIONAL) +install(TARGETS rocprofiler-systems-run DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) diff --git a/projects/rocprofiler-systems/source/bin/rocprof-sys-sample/CMakeLists.txt b/projects/rocprofiler-systems/source/bin/rocprof-sys-sample/CMakeLists.txt index 7780a2cff6..22d59bf5db 100644 --- a/projects/rocprofiler-systems/source/bin/rocprof-sys-sample/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/bin/rocprof-sys-sample/CMakeLists.txt @@ -4,25 +4,29 @@ # # ------------------------------------------------------------------------------# -add_executable(rocprofiler-systems-sample ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-sample.cpp - ${CMAKE_CURRENT_LIST_DIR}/impl.cpp) +add_executable( + rocprofiler-systems-sample + ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-sample.cpp + ${CMAKE_CURRENT_LIST_DIR}/impl.cpp +) target_compile_definitions(rocprofiler-systems-sample PRIVATE TIMEMORY_CMAKE=1) target_include_directories(rocprofiler-systems-sample PRIVATE ${CMAKE_CURRENT_LIST_DIR}) target_link_libraries( rocprofiler-systems-sample - PRIVATE rocprofiler-systems::rocprofiler-systems-compile-definitions - rocprofiler-systems::rocprofiler-systems-headers - rocprofiler-systems::rocprofiler-systems-common-library) + PRIVATE + rocprofiler-systems::rocprofiler-systems-compile-definitions + rocprofiler-systems::rocprofiler-systems-headers + rocprofiler-systems::rocprofiler-systems-common-library +) set_target_properties( rocprofiler-systems-sample - PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" - INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}" - OUTPUT_NAME ${BINARY_NAME_PREFIX}-sample) + PROPERTIES + BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" + INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}" + OUTPUT_NAME ${BINARY_NAME_PREFIX}-sample +) rocprofiler_systems_strip_target(rocprofiler-systems-sample) -install( - TARGETS rocprofiler-systems-sample - DESTINATION ${CMAKE_INSTALL_BINDIR} - OPTIONAL) +install(TARGETS rocprofiler-systems-sample DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) diff --git a/projects/rocprofiler-systems/source/bin/tests/CMakeLists.txt b/projects/rocprofiler-systems/source/bin/tests/CMakeLists.txt index 36d2782377..89bc97f98a 100644 --- a/projects/rocprofiler-systems/source/bin/tests/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/bin/tests/CMakeLists.txt @@ -1,7 +1,9 @@ set(ROCPROFSYS_ABORT_FAIL_REGEX "### ERROR ###|unknown-hash=|address of faulting memory reference|exiting with non-zero exit code|terminate called after throwing an instance|calling abort.. in |Exit code: [1-9]" - CACHE INTERNAL "Regex to catch abnormal exits when a PASS_REGULAR_EXPRESSION is set" - FORCE) + CACHE INTERNAL + "Regex to catch abnormal exits when a PASS_REGULAR_EXPRESSION is set" + FORCE +) # adds a ctest for executable function(ROCPROFILER_SYSTEMS_ADD_BIN_TEST) @@ -11,7 +13,8 @@ function(ROCPROFILER_SYSTEMS_ADD_BIN_TEST) "NAME;TARGET;TIMEOUT;WORKING_DIRECTORY" # single value args "ARGS;ENVIRONMENT;LABELS;PROPERTIES;PASS_REGEX;FAIL_REGEX;SKIP_REGEX;DEPENDS;COMMAND" # multiple # value args - ${ARGN}) + ${ARGN} + ) if(NOT TEST_WORKING_DIRECTORY) set(TEST_WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) @@ -24,7 +27,7 @@ function(ROCPROFILER_SYSTEMS_ADD_BIN_TEST) "ROCPROFSYS_USE_SAMPLING=ON" "ROCPROFSYS_TIME_OUTPUT=OFF" "LD_LIBRARY_PATH=${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}:$ENV{LD_LIBRARY_PATH}" - ) + ) endif() # common @@ -35,7 +38,8 @@ function(ROCPROFILER_SYSTEMS_ADD_BIN_TEST) "ROCPROFSYS_CI_TIMEOUT=${TEST_TIMEOUT}" "ROCPROFSYS_CONFIG_FILE=" "ROCPROFSYS_OUTPUT_PATH=${PROJECT_BINARY_DIR}/rocprof-sys-tests-output" - "TWD=${TEST_WORKING_DIRECTORY}") + "TWD=${TEST_WORKING_DIRECTORY}" + ) # copy for inverse set(TEST_ENVIRONMENT_INV "${TEST_ENVIRONMENT}") @@ -43,68 +47,67 @@ function(ROCPROFILER_SYSTEMS_ADD_BIN_TEST) list(APPEND TEST_ENVIRONMENT "ROCPROFSYS_OUTPUT_PREFIX=${TEST_NAME}/") list(APPEND TEST_ENVIRONMENT_INV "ROCPROFSYS_OUTPUT_PREFIX=${TEST_NAME}-inverse/") - if(NOT "${TEST_PASS_REGEX}" STREQUAL "" - AND NOT "${TEST_FAIL_REGEX}" STREQUAL "" - AND NOT "${TEST_FAIL_REGEX}" MATCHES "\\|ROCPROFSYS_ABORT_FAIL_REGEX") + if( + NOT "${TEST_PASS_REGEX}" STREQUAL "" + AND NOT "${TEST_FAIL_REGEX}" STREQUAL "" + AND NOT "${TEST_FAIL_REGEX}" MATCHES "\\|ROCPROFSYS_ABORT_FAIL_REGEX" + ) rocprofiler_systems_message( FATAL_ERROR "${TEST_NAME} has set pass and fail regexes but fail regex does not include '|ROCPROFSYS_ABORT_FAIL_REGEX'" - ) + ) endif() if("${TEST_FAIL_REGEX}" STREQUAL "") set(TEST_FAIL_REGEX "(${ROCPROFSYS_ABORT_FAIL_REGEX})") else() - string(REPLACE "|ROCPROFSYS_ABORT_FAIL_REGEX" "|${ROCPROFSYS_ABORT_FAIL_REGEX}" - TEST_FAIL_REGEX "${TEST_FAIL_REGEX}") + string( + REPLACE + "|ROCPROFSYS_ABORT_FAIL_REGEX" + "|${ROCPROFSYS_ABORT_FAIL_REGEX}" + TEST_FAIL_REGEX + "${TEST_FAIL_REGEX}" + ) endif() if(TEST_COMMAND) add_test( NAME ${TEST_NAME} COMMAND ${TEST_COMMAND} ${TEST_ARGS} - WORKING_DIRECTORY ${TEST_WORKING_DIRECTORY}) + WORKING_DIRECTORY ${TEST_WORKING_DIRECTORY} + ) set_tests_properties( ${TEST_NAME} - PROPERTIES ENVIRONMENT - "${TEST_ENVIRONMENT}" - TIMEOUT - ${TEST_TIMEOUT} - DEPENDS - "${TEST_DEPENDS}" - LABELS - "rocprofiler-systems-bin;${TEST_LABELS}" - PASS_REGULAR_EXPRESSION - "${TEST_PASS_REGEX}" - FAIL_REGULAR_EXPRESSION - "${TEST_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${TEST_SKIP_REGEX}" - ${TEST_PROPERTIES}) + PROPERTIES + ENVIRONMENT "${TEST_ENVIRONMENT}" + TIMEOUT ${TEST_TIMEOUT} + DEPENDS "${TEST_DEPENDS}" + LABELS "rocprofiler-systems-bin;${TEST_LABELS}" + PASS_REGULAR_EXPRESSION "${TEST_PASS_REGEX}" + FAIL_REGULAR_EXPRESSION "${TEST_FAIL_REGEX}" + SKIP_REGULAR_EXPRESSION "${TEST_SKIP_REGEX}" + ${TEST_PROPERTIES} + ) elseif(TARGET ${TEST_TARGET}) add_test( NAME ${TEST_NAME} COMMAND $ ${TEST_ARGS} - WORKING_DIRECTORY ${TEST_WORKING_DIRECTORY}) + WORKING_DIRECTORY ${TEST_WORKING_DIRECTORY} + ) set_tests_properties( ${TEST_NAME} - PROPERTIES ENVIRONMENT - "${TEST_ENVIRONMENT}" - TIMEOUT - ${TEST_TIMEOUT} - DEPENDS - "${TEST_DEPENDS}" - LABELS - "rocprofiler-systems-bin;${TEST_LABELS}" - PASS_REGULAR_EXPRESSION - "${TEST_PASS_REGEX}" - FAIL_REGULAR_EXPRESSION - "${TEST_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${TEST_SKIP_REGEX}" - ${TEST_PROPERTIES}) + PROPERTIES + ENVIRONMENT "${TEST_ENVIRONMENT}" + TIMEOUT ${TEST_TIMEOUT} + DEPENDS "${TEST_DEPENDS}" + LABELS "rocprofiler-systems-bin;${TEST_LABELS}" + PASS_REGULAR_EXPRESSION "${TEST_PASS_REGEX}" + FAIL_REGULAR_EXPRESSION "${TEST_FAIL_REGEX}" + SKIP_REGULAR_EXPRESSION "${TEST_SKIP_REGEX}" + ${TEST_PROPERTIES} + ) elseif(ROCPROFSYS_BUILD_TESTING) message(FATAL_ERROR "Error! ${TEST_TARGET} does not exist") endif() @@ -118,7 +121,7 @@ rocprofiler_systems_add_bin_test( TIMEOUT 45 PASS_REGEX ".*\\\[rocprof-sys-instrument\\\] Usage:.*\\\[DEBUG OPTIONS\\\].*\\\[MODE OPTIONS\\\].*\\\[LIBRARY OPTIONS\\\].*\\\[SYMBOL SELECTION OPTIONS\\\].*\\\[RUNTIME OPTIONS\\\].*\\\[GRANULARITY OPTIONS\\\].*\\\[DYNINST OPTIONS\\\].*" - ) +) # on RedHat, /usr/bin/ls is a script for `coreutils --coreutils-prog=ls` if(EXISTS /usr/bin/coreutils) @@ -144,7 +147,8 @@ rocprofiler_systems_add_bin_test( ${LS_NAME} ${LS_ARGS} LABELS "simulate" - TIMEOUT 240) + TIMEOUT 240 +) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-instrument-simulate-ls-check @@ -155,7 +159,8 @@ rocprofiler_systems_add_bin_test( TIMEOUT 60 PASS_REGEX ".*available.json.*available.txt.*available.xml.*excluded.json.*excluded.txt.*excluded.xml.*instrumented.json.*instrumented.txt.*instrumented.xml.*overlapping.json.*overlapping.txt.*overlapping.xml.*" - FAIL_REGEX "No such file or directory|not found|ROCPROFSYS_ABORT_FAIL_REGEX") + FAIL_REGEX "No such file or directory|not found|ROCPROFSYS_ABORT_FAIL_REGEX" +) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-instrument-simulate-lib @@ -166,7 +171,7 @@ rocprofiler_systems_add_bin_test( TIMEOUT 120 PASS_REGEX "\\\[rocprof-sys\\\]\\\[exe\\\] Runtime instrumentation is not possible!(.*)\n(.*)\\\[rocprof-sys\\\]\\\[exe\\\] Switching to binary rewrite mode and assuming '--simulate --all-functions'" - ) +) file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/tmp) @@ -183,7 +188,8 @@ rocprofiler_systems_add_bin_test( ${CMAKE_SHARED_LIBRARY_PREFIX}$${CMAKE_SHARED_LIBRARY_SUFFIX} LABELS "simulate" TIMEOUT 120 - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/tmp) + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/tmp +) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-instrument-write-log @@ -199,7 +205,8 @@ rocprofiler_systems_add_bin_test( ${LS_ARGS} LABELS "log" TIMEOUT 120 - PASS_REGEX "Opening .*/instrumentation/user.log") + PASS_REGEX "Opening .*/instrumentation/user.log" +) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-instrument-write-log-check @@ -210,7 +217,8 @@ rocprofiler_systems_add_bin_test( LABELS "log" TIMEOUT 60 PASS_REGEX "user.log" - FAIL_REGEX "No such file or directory|not found|ROCPROFSYS_ABORT_FAIL_REGEX") + FAIL_REGEX "No such file or directory|not found|ROCPROFSYS_ABORT_FAIL_REGEX" +) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-avail-help @@ -220,14 +228,15 @@ rocprofiler_systems_add_bin_test( TIMEOUT 45 PASS_REGEX ".*\\\[rocprof-sys-avail\\\] Usage:.*\\\[DEBUG OPTIONS\\\].*\\\[INFO OPTIONS\\\].*\\\[FILTER OPTIONS\\\].*\\\[COLUMN OPTIONS\\\].*\\\[DISPLAY OPTIONS\\\].*\\\[OUTPUT OPTIONS\\\].*" - ) +) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-avail-all TARGET rocprofiler-systems-avail ARGS --all LABELS "rocprofiler-systems-avail" - TIMEOUT 45) + TIMEOUT 45 +) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-avail-all-expand-keys @@ -235,7 +244,8 @@ rocprofiler_systems_add_bin_test( ARGS --all --expand-keys LABELS "rocprofiler-systems-avail" TIMEOUT 45 - FAIL_REGEX "%[a-zA-Z_]%|ROCPROFSYS_ABORT_FAIL_REGEX") + FAIL_REGEX "%[a-zA-Z_]%|ROCPROFSYS_ABORT_FAIL_REGEX" +) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-avail-all-only-available-alphabetical @@ -246,7 +256,8 @@ rocprofiler_systems_add_bin_test( TIMEOUT 45 PROPERTIES ATTACHED_FILES - ${CMAKE_CURRENT_BINARY_DIR}/rocprof-sys-avail-all-only-available-alphabetical.log) + ${CMAKE_CURRENT_BINARY_DIR}/rocprof-sys-avail-all-only-available-alphabetical.log +) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-avail-all-csv @@ -256,7 +267,7 @@ rocprofiler_systems_add_bin_test( TIMEOUT 45 PASS_REGEX "COMPONENT#AVAILABLE#VALUE_TYPE#STRING_IDS#FILENAME#DESCRIPTION#CATEGORY#.*ENVIRONMENT VARIABLE#VALUE#DATA TYPE#DESCRIPTION#CATEGORIES#.*HARDWARE COUNTER#DEVICE#AVAILABLE#DESCRIPTION#" - ) +) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-avail-filter-wall-clock-available @@ -266,7 +277,7 @@ rocprofiler_systems_add_bin_test( TIMEOUT 45 PASS_REGEX "\\\|[-]+\\\|\n\\\|[ ]+COMPONENT[ ]+\\\|\n\\\|[-]+\\\|\n\\\| (wall_clock)[ ]+\\\|\n\\\|[-]+\\\|" - ) +) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-avail-category-filter-rocprofiler-systems @@ -277,7 +288,7 @@ rocprofiler_systems_add_bin_test( PASS_REGEX "ROCPROFSYS_(SETTINGS_DESC|OUTPUT_FILE|OUTPUT_PREFIX)" FAIL_REGEX "ROCPROFSYS_(ADD_SECONDARY|SCIENTIFIC|PRECISION|MEMORY_PRECISION|TIMING_PRECISION)|ROCPROFSYS_ABORT_FAIL_REGEX" - ) +) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-avail-category-filter-timemory @@ -287,7 +298,8 @@ rocprofiler_systems_add_bin_test( TIMEOUT 45 PASS_REGEX "ROCPROFSYS_(ADD_SECONDARY|SCIENTIFIC|PRECISION|MEMORY_PRECISION|TIMING_PRECISION)" - FAIL_REGEX "ROCPROFSYS_(SETTINGS_DESC|OUTPUT_FILE)|ROCPROFSYS_ABORT_FAIL_REGEX") + FAIL_REGEX "ROCPROFSYS_(SETTINGS_DESC|OUTPUT_FILE)|ROCPROFSYS_ABORT_FAIL_REGEX" +) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-avail-regex-negation @@ -307,12 +319,16 @@ rocprofiler_systems_add_bin_test( TIMEOUT 45 PASS_REGEX "ENVIRONMENT VARIABLE,[ \n]+ROCPROFSYS_THREAD_POOL_SIZE,[ \n]+ROCPROFSYS_USE_PID,[ \n]+" - FAIL_REGEX "ROCPROFSYS_TRACE|ROCPROFSYS_ABORT_FAIL_REGEX") + FAIL_REGEX "ROCPROFSYS_TRACE|ROCPROFSYS_ABORT_FAIL_REGEX" +) string( REPLACE - "+" "\\\+" _AVAIL_CFG_PATH - "${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/rocprof-sys-avail/rocprof-sys-") + "+" + "\\\+" + _AVAIL_CFG_PATH + "${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/rocprof-sys-avail/rocprof-sys-" +) # use of TWD == Test Working Directory (added by function) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-avail-write-config @@ -331,7 +347,7 @@ rocprofiler_systems_add_bin_test( LABELS "rocprofiler-systems-avail" PASS_REGEX "Outputting JSON configuration file '${_AVAIL_CFG_PATH}test\\\.json'(.*)Outputting XML configuration file '${_AVAIL_CFG_PATH}test\\\.xml'(.*)Outputting text configuration file '${_AVAIL_CFG_PATH}test\\\.cfg'(.*)" - ) +) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-avail-write-config-tweak @@ -343,7 +359,7 @@ rocprofiler_systems_add_bin_test( ENVIRONMENT "ROCPROFSYS_TRACE=OFF;ROCPROFSYS_PROFILE=ON" PASS_REGEX "Outputting JSON configuration file '${_AVAIL_CFG_PATH}tweak\\\.json'(.*)Outputting XML configuration file '${_AVAIL_CFG_PATH}tweak\\\.xml'(.*)Outputting text configuration file '${_AVAIL_CFG_PATH}tweak\\\.cfg'(.*)" - ) +) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-avail-list-keys @@ -351,7 +367,8 @@ rocprofiler_systems_add_bin_test( ARGS --list-keys --expand-keys TIMEOUT 45 LABELS "rocprofiler-systems-avail" - PASS_REGEX "Output Keys:\n(.*)%argv%(.*)%argv_hash%") + PASS_REGEX "Output Keys:\n(.*)%argv%(.*)%argv_hash%" +) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-avail-list-keys-markdown @@ -359,7 +376,8 @@ rocprofiler_systems_add_bin_test( ARGS --list-keys --expand-keys --markdown TIMEOUT 45 LABELS "rocprofiler-systems-avail;markdown" - PASS_REGEX "(.*)`%argv%`(.*)`%argv_hash%`") + PASS_REGEX "(.*)`%argv%`(.*)`%argv_hash%`" +) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-avail-list-categories @@ -367,7 +385,8 @@ rocprofiler_systems_add_bin_test( ARGS --list-categories TIMEOUT 45 LABELS "rocprofiler-systems-avail" - PASS_REGEX " component::(.*) hw_counters::(.*) settings::") + PASS_REGEX " component::(.*) hw_counters::(.*) settings::" +) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-avail-core-categories @@ -377,28 +396,34 @@ rocprofiler_systems_add_bin_test( LABELS "rocprofiler-systems-avail" PASS_REGEX "ROCPROFSYS_CONFIG_FILE(.*)ROCPROFSYS_ENABLED(.*)ROCPROFSYS_SUPPRESS_CONFIG(.*)ROCPROFSYS_SUPPRESS_PARSING(.*)ROCPROFSYS_VERBOSE" - ) +) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-run-help TARGET rocprofiler-systems-run ARGS --help TIMEOUT 45 - LABELS "rocprofiler-systems-run") + LABELS "rocprofiler-systems-run" +) file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/rocprof-sys-tests-config") file( - WRITE "${PROJECT_BINARY_DIR}/rocprof-sys-tests-config/empty.cfg" + WRITE + "${PROJECT_BINARY_DIR}/rocprof-sys-tests-config/empty.cfg" " # # empty config file # -") +" +) add_executable(sleeper ${CMAKE_CURRENT_SOURCE_DIR}/sleeper.cpp) set_target_properties( - sleeper PROPERTIES BUILD_TYPE RelWithDebInfo RUNTIME_OUTPUT_DIRECTORY - ${PROJECT_BINARY_DIR}/bin/testing) + sleeper + PROPERTIES + BUILD_TYPE RelWithDebInfo + RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/testing +) rocprofiler_systems_add_bin_test( NAME rocprofiler-systems-run-args @@ -494,4 +519,5 @@ rocprofiler_systems_add_bin_test( $ 5 TIMEOUT 45 - LABELS "rocprofiler-systems-run") + LABELS "rocprofiler-systems-run" +) diff --git a/projects/rocprofiler-systems/source/lib/CMakeLists.txt b/projects/rocprofiler-systems/source/lib/CMakeLists.txt index 0a2b8ea51d..14e81112e7 100644 --- a/projects/rocprofiler-systems/source/lib/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/lib/CMakeLists.txt @@ -21,12 +21,15 @@ set(ROCPROFSYS_LIB_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/${PROJECT_NAME}") # ------------------------------------------------------------------------------# add_library(rocprofiler-systems-interface-library INTERFACE) -add_library(rocprofiler-systems::rocprofiler-systems-interface-library ALIAS - rocprofiler-systems-interface-library) +add_library( + rocprofiler-systems::rocprofiler-systems-interface-library + ALIAS rocprofiler-systems-interface-library +) target_include_directories( rocprofiler-systems-interface-library - INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/rocprof-sys) + INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/rocprof-sys +) target_link_libraries( rocprofiler-systems-interface-library @@ -48,7 +51,7 @@ target_link_libraries( $ $ $,rocprofiler-systems::rocprofiler-systems-lto,>> - ) +) # ------------------------------------------------------------------------------# # diff --git a/projects/rocprofiler-systems/source/lib/binary/CMakeLists.txt b/projects/rocprofiler-systems/source/lib/binary/CMakeLists.txt index ede4912ed0..3567123eaf 100644 --- a/projects/rocprofiler-systems/source/lib/binary/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/lib/binary/CMakeLists.txt @@ -5,7 +5,8 @@ set(binary_sources ${CMAKE_CURRENT_LIST_DIR}/dwarf_entry.cpp ${CMAKE_CURRENT_LIST_DIR}/link_map.cpp ${CMAKE_CURRENT_LIST_DIR}/scope_filter.cpp - ${CMAKE_CURRENT_LIST_DIR}/symbol.cpp) + ${CMAKE_CURRENT_LIST_DIR}/symbol.cpp +) set(binary_headers ${CMAKE_CURRENT_LIST_DIR}/address_multirange.hpp @@ -14,19 +15,28 @@ set(binary_headers ${CMAKE_CURRENT_LIST_DIR}/binary_info.hpp ${CMAKE_CURRENT_LIST_DIR}/link_map.hpp ${CMAKE_CURRENT_LIST_DIR}/scope_filter.hpp - ${CMAKE_CURRENT_LIST_DIR}/symbol.hpp) + ${CMAKE_CURRENT_LIST_DIR}/symbol.hpp +) add_library(rocprofiler-systems-binary-library STATIC) -add_library(rocprofiler-systems::rocprofiler-systems-binary ALIAS - rocprofiler-systems-binary-library) +add_library( + rocprofiler-systems::rocprofiler-systems-binary + ALIAS rocprofiler-systems-binary-library +) -target_sources(rocprofiler-systems-binary-library PRIVATE ${binary_sources} - ${binary_headers}) +target_sources( + rocprofiler-systems-binary-library + PRIVATE ${binary_sources} ${binary_headers} +) target_link_libraries( rocprofiler-systems-binary-library - PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library - rocprofiler-systems::rocprofiler-systems-core) + PRIVATE + rocprofiler-systems::rocprofiler-systems-interface-library + rocprofiler-systems::rocprofiler-systems-core +) -set_target_properties(rocprofiler-systems-binary-library - PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-binary) +set_target_properties( + rocprofiler-systems-binary-library + PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-binary +) diff --git a/projects/rocprofiler-systems/source/lib/common/CMakeLists.txt b/projects/rocprofiler-systems/source/lib/common/CMakeLists.txt index b4237c9d48..d096ebf933 100644 --- a/projects/rocprofiler-systems/source/lib/common/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/lib/common/CMakeLists.txt @@ -6,32 +6,43 @@ add_library(rocprofiler-systems-common-library INTERFACE) add_library(rocprofiler-systems::common-library ALIAS rocprofiler-systems-common-library) -add_library(rocprofiler-systems::rocprofiler-systems-common-library ALIAS - rocprofiler-systems-common-library) +add_library( + rocprofiler-systems::rocprofiler-systems-common-library + ALIAS rocprofiler-systems-common-library +) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/defines.h.in - ${CMAKE_CURRENT_BINARY_DIR}/defines.h @ONLY) +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/defines.h.in + ${CMAKE_CURRENT_BINARY_DIR}/defines.h + @ONLY +) target_sources( rocprofiler-systems-common-library - INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/defines.h - ${CMAKE_CURRENT_SOURCE_DIR}/delimit.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/environment.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/invoke.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/join.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/setup.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/static_object.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/synchronized.hpp) + INTERFACE + ${CMAKE_CURRENT_BINARY_DIR}/defines.h + ${CMAKE_CURRENT_SOURCE_DIR}/delimit.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/environment.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/invoke.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/join.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/setup.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/static_object.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/synchronized.hpp +) get_filename_component(COMMON_SOURCE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" DIRECTORY) get_filename_component(COMMON_BINARY_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}" DIRECTORY) target_include_directories( rocprofiler-systems-common-library - INTERFACE $ - $ - $ - $) + INTERFACE + $ + $ + $ + $ +) -target_compile_definitions(rocprofiler-systems-common-library - INTERFACE $) +target_compile_definitions( + rocprofiler-systems-common-library + INTERFACE $ +) diff --git a/projects/rocprofiler-systems/source/lib/core/CMakeLists.txt b/projects/rocprofiler-systems/source/lib/core/CMakeLists.txt index 5c0cbad990..b7462c490d 100644 --- a/projects/rocprofiler-systems/source/lib/core/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/lib/core/CMakeLists.txt @@ -1,6 +1,9 @@ # -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/defines.hpp.in - ${CMAKE_CURRENT_BINARY_DIR}/defines.hpp @ONLY) +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/defines.hpp.in + ${CMAKE_CURRENT_BINARY_DIR}/defines.hpp + @ONLY +) set(core_sources ${CMAKE_CURRENT_LIST_DIR}/argparse.cpp @@ -18,7 +21,8 @@ set(core_sources ${CMAKE_CURRENT_LIST_DIR}/amd_smi.cpp ${CMAKE_CURRENT_LIST_DIR}/state.cpp ${CMAKE_CURRENT_LIST_DIR}/timemory.cpp - ${CMAKE_CURRENT_LIST_DIR}/utility.cpp) + ${CMAKE_CURRENT_LIST_DIR}/utility.cpp +) set(core_headers ${CMAKE_CURRENT_LIST_DIR}/argparse.hpp @@ -41,28 +45,38 @@ set(core_headers ${CMAKE_CURRENT_LIST_DIR}/amd_smi.hpp ${CMAKE_CURRENT_LIST_DIR}/state.hpp ${CMAKE_CURRENT_LIST_DIR}/timemory.hpp - ${CMAKE_CURRENT_LIST_DIR}/utility.hpp) + ${CMAKE_CURRENT_LIST_DIR}/utility.hpp +) add_library(rocprofiler-systems-core-library STATIC) -add_library(rocprofiler-systems::rocprofiler-systems-core ALIAS - rocprofiler-systems-core-library) +add_library( + rocprofiler-systems::rocprofiler-systems-core + ALIAS rocprofiler-systems-core-library +) target_sources( - rocprofiler-systems-core-library PRIVATE ${core_sources} ${core_headers} - ${CMAKE_CURRENT_BINARY_DIR}/defines.hpp) + rocprofiler-systems-core-library + PRIVATE ${core_sources} ${core_headers} ${CMAKE_CURRENT_BINARY_DIR}/defines.hpp +) add_subdirectory(binary) add_subdirectory(components) add_subdirectory(containers) -target_include_directories(rocprofiler-systems-core-library BEFORE - PRIVATE ${CMAKE_CURRENT_LIST_DIR}) +target_include_directories( + rocprofiler-systems-core-library + BEFORE + PRIVATE ${CMAKE_CURRENT_LIST_DIR} +) target_include_directories( rocprofiler-systems-core-library - PRIVATE ${PROJECT_SOURCE_DIR}/external/timemory/source/timemory/tpls/cereal) + PRIVATE ${PROJECT_SOURCE_DIR}/external/timemory/source/timemory/tpls/cereal +) -target_link_libraries(rocprofiler-systems-core-library - PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library) +target_link_libraries( + rocprofiler-systems-core-library + PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library +) target_link_libraries( rocprofiler-systems-core-library PRIVATE @@ -79,7 +93,9 @@ target_link_libraries( $ $ $,rocprofiler-systems::rocprofiler-systems-lto,>> - ) +) -set_target_properties(rocprofiler-systems-core-library - PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-core) +set_target_properties( + rocprofiler-systems-core-library + PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-core +) diff --git a/projects/rocprofiler-systems/source/lib/core/binary/CMakeLists.txt b/projects/rocprofiler-systems/source/lib/core/binary/CMakeLists.txt index a5fade49c8..c63f946b7d 100644 --- a/projects/rocprofiler-systems/source/lib/core/binary/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/lib/core/binary/CMakeLists.txt @@ -1,8 +1,12 @@ # set(binary_sources ${CMAKE_CURRENT_LIST_DIR}/address_range.cpp) -set(binary_headers ${CMAKE_CURRENT_LIST_DIR}/address_range.hpp - ${CMAKE_CURRENT_LIST_DIR}/fwd.hpp) +set(binary_headers + ${CMAKE_CURRENT_LIST_DIR}/address_range.hpp + ${CMAKE_CURRENT_LIST_DIR}/fwd.hpp +) -target_sources(rocprofiler-systems-core-library PRIVATE ${binary_sources} - ${binary_headers}) +target_sources( + rocprofiler-systems-core-library + PRIVATE ${binary_sources} ${binary_headers} +) diff --git a/projects/rocprofiler-systems/source/lib/core/components/CMakeLists.txt b/projects/rocprofiler-systems/source/lib/core/components/CMakeLists.txt index 2580b9cd8a..7e088e2c0f 100644 --- a/projects/rocprofiler-systems/source/lib/core/components/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/lib/core/components/CMakeLists.txt @@ -3,5 +3,7 @@ set(component_sources) set(component_headers ${CMAKE_CURRENT_LIST_DIR}/fwd.hpp) -target_sources(rocprofiler-systems-core-library PRIVATE ${component_sources} - ${component_headers}) +target_sources( + rocprofiler-systems-core-library + PRIVATE ${component_sources} ${component_headers} +) diff --git a/projects/rocprofiler-systems/source/lib/core/containers/CMakeLists.txt b/projects/rocprofiler-systems/source/lib/core/containers/CMakeLists.txt index 4461bf208b..2226f34879 100644 --- a/projects/rocprofiler-systems/source/lib/core/containers/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/lib/core/containers/CMakeLists.txt @@ -6,7 +6,10 @@ set(containers_headers ${CMAKE_CURRENT_LIST_DIR}/c_array.hpp ${CMAKE_CURRENT_LIST_DIR}/operators.hpp ${CMAKE_CURRENT_LIST_DIR}/stable_vector.hpp - ${CMAKE_CURRENT_LIST_DIR}/static_vector.hpp) + ${CMAKE_CURRENT_LIST_DIR}/static_vector.hpp +) -target_sources(rocprofiler-systems-core-library PRIVATE ${containers_sources} - ${containers_headers}) +target_sources( + rocprofiler-systems-core-library + PRIVATE ${containers_sources} ${containers_headers} +) diff --git a/projects/rocprofiler-systems/source/lib/rocprof-sys-dl/CMakeLists.txt b/projects/rocprofiler-systems/source/lib/rocprof-sys-dl/CMakeLists.txt index cecd099731..fce0747875 100644 --- a/projects/rocprofiler-systems/source/lib/rocprof-sys-dl/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/lib/rocprof-sys-dl/CMakeLists.txt @@ -13,41 +13,54 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) find_package(Threads REQUIRED) add_library(rocprofiler-systems-dl-library SHARED) -add_library(rocprofiler-systems::rocprofiler-systems-dl-library ALIAS - rocprofiler-systems-dl-library) +add_library( + rocprofiler-systems::rocprofiler-systems-dl-library + ALIAS rocprofiler-systems-dl-library +) target_sources( rocprofiler-systems-dl-library - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/dl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/main.c - ${CMAKE_CURRENT_SOURCE_DIR}/dl/dl.hpp) + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/dl.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/main.c + ${CMAKE_CURRENT_SOURCE_DIR}/dl/dl.hpp +) target_include_directories( rocprofiler-systems-dl-library - PUBLIC $ - $ - $ - $ - PRIVATE ${rocprofiler-sdk_INCLUDE_DIR}) + PUBLIC + $ + $ + $ + $ + PRIVATE ${rocprofiler-sdk_INCLUDE_DIR} +) target_link_libraries( rocprofiler-systems-dl-library - PUBLIC $ - $ - $ - $) + PUBLIC + $ + $ + $ + $ +) add_target_cxx_flag_if_avail(rocprofiler-systems-dl-library "-ftls-model=global-dynamic") add_target_cxx_flag_if_avail(rocprofiler-systems-dl-library "-g3") set_target_properties( rocprofiler-systems-dl-library - PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-dl - VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_VERSION_MAJOR} - BUILD_RPATH "\$ORIGIN" - INSTALL_RPATH "\$ORIGIN") + PROPERTIES + OUTPUT_NAME ${BINARY_NAME_PREFIX}-dl + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR} + BUILD_RPATH "\$ORIGIN" + INSTALL_RPATH "\$ORIGIN" +) rocprofiler_systems_strip_target(rocprofiler-systems-dl-library) -install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dl/dl.hpp - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/dl) +install( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/dl/dl.hpp + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/dl +) install(TARGETS rocprofiler-systems-dl-library DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/projects/rocprofiler-systems/source/lib/rocprof-sys-rt/CMakeLists.txt b/projects/rocprofiler-systems/source/lib/rocprof-sys-rt/CMakeLists.txt index b85b3ca36c..8e5bae0bf6 100644 --- a/projects/rocprofiler-systems/source/lib/rocprof-sys-rt/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/lib/rocprof-sys-rt/CMakeLists.txt @@ -23,7 +23,8 @@ if(PLATFORM MATCHES freebsd) src/RTheap-freebsd.c src/RTthread.c src/RTspace.S - src/RTsignal.c) + src/RTsignal.c + ) elseif(PLATFORM MATCHES linux) list( APPEND @@ -34,12 +35,24 @@ elseif(PLATFORM MATCHES linux) src/RTheap-linux.c src/RTthread.c src/RTspace.S - src/RTsignal.c) - list(APPEND RT_STATIC_ONLY_SRC_LIST src/RTstatic_ctors_dtors_begin.c - src/RTstatic_ctors_dtors_end.c) + src/RTsignal.c + ) + list( + APPEND + RT_STATIC_ONLY_SRC_LIST + src/RTstatic_ctors_dtors_begin.c + src/RTstatic_ctors_dtors_end.c + ) elseif(PLATFORM MATCHES nt OR PLATFORM MATCHES windows) - list(APPEND SRC_LIST src/RTheap.c src/RTheap-win.c src/RTwinnt.c src/RTthread.c - src/RTthread-x86.c) + list( + APPEND + SRC_LIST + src/RTheap.c + src/RTheap-win.c + src/RTwinnt.c + src/RTthread.c + src/RTthread-x86.c + ) endif() set(SRC_LIST_i386 src/RTthread-x86.c src/RTtlsgetaddr-x86.S) @@ -50,9 +63,10 @@ set(SRC_LIST_ppc32 src/RTthread-powerpc.c src/RTthread-powerpc-asm.S) set(RT_STATIC_ONLY_SRC_LIST_ppc32 src/RTstatic_ctors_dtors-ppc32.c) set(SRC_LIST_ppc64 src/RTthread-powerpc.c src/RTthread-powerpc-asm.S) set(RT_STATIC_ONLY_SRC_LIST_ppc64 src/RTstatic_ctors_dtors-ppc64.c) -set(SRC_LIST_aarch64 src/RTthread-aarch64.c - # src/RTthread-aarch64-asm.S - ) +set(SRC_LIST_aarch64 + src/RTthread-aarch64.c + # src/RTthread-aarch64-asm.S +) set(RT_STATIC_ONLY_SRC_LIST_aarch64 src/RTstatic_ctors_dtors-aarch64.c) # We use gcc to compile the various assembly files, but cmake doesn't default to knowing @@ -69,14 +83,18 @@ endif() if(UNIX) if(PLATFORM MATCHES amd64 OR PLATFORM MATCHES x86_64) set(SRC_LIST_mabi ${SRC_LIST} ${SRC_LIST_i386}) - set(RT_STATIC_ONLY_SRC_LIST_mabi ${RT_STATIC_ONLY_SRC_LIST} - ${RT_STATIC_ONLY_SRC_LIST_i386}) + set(RT_STATIC_ONLY_SRC_LIST_mabi + ${RT_STATIC_ONLY_SRC_LIST} + ${RT_STATIC_ONLY_SRC_LIST_i386} + ) list(APPEND SRC_LIST ${SRC_LIST_x86_64}) list(APPEND RT_STATIC_ONLY_SRC_LIST ${RT_STATIC_ONLY_SRC_LIST_x86_64}) elseif(PLATFORM MATCHES ppc64) set(SRC_LIST_mabi ${SRC_LIST} ${SRC_LIST_ppc32}) - set(RT_STATIC_ONLY_SRC_LIST_mabi ${RT_STATIC_ONLY_SRC_LIST} - ${RT_STATIC_ONLY_SRC_LIST_ppc32}) + set(RT_STATIC_ONLY_SRC_LIST_mabi + ${RT_STATIC_ONLY_SRC_LIST} + ${RT_STATIC_ONLY_SRC_LIST_ppc32} + ) list(APPEND SRC_LIST ${SRC_LIST_ppc64}) list(APPEND RT_STATIC_ONLY_SRC_LIST ${RT_STATIC_ONLY_SRC_LIST_ppc64}) elseif(PLATFORM MATCHES i386) @@ -92,29 +110,36 @@ if(UNIX) endif() add_library(rocprofiler-systems-rt-library SHARED) -add_library(rocprofiler-systems::rocprofiler-systems-rt-library ALIAS - rocprofiler-systems-rt-library) +add_library( + rocprofiler-systems::rocprofiler-systems-rt-library + ALIAS rocprofiler-systems-rt-library +) target_sources(rocprofiler-systems-rt-library PRIVATE ${SRC_LIST}) target_include_directories( rocprofiler-systems-rt-library - PRIVATE $ - $) + PRIVATE + $ + $ +) target_compile_definitions(rocprofiler-systems-rt-library PRIVATE ${UNIFIED_DEFINES}) target_link_libraries( rocprofiler-systems-rt-library PUBLIC $ - PRIVATE rocprofiler-systems::rocprofiler-systems-threading) + PRIVATE rocprofiler-systems::rocprofiler-systems-threading +) add_target_cxx_flag_if_avail(rocprofiler-systems-rt-library "-g3") set_target_properties( rocprofiler-systems-rt-library - PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-rt - VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_VERSION_MAJOR} - BUILD_RPATH "\$ORIGIN" - INSTALL_RPATH "\$ORIGIN") + PROPERTIES + OUTPUT_NAME ${BINARY_NAME_PREFIX}-rt + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR} + BUILD_RPATH "\$ORIGIN" + INSTALL_RPATH "\$ORIGIN" +) rocprofiler_systems_strip_target(rocprofiler-systems-rt-library) @@ -125,7 +150,8 @@ if(NOT EXISTS ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}) endif() add_custom_target( - rocprofiler-systems-rt-library-dyninstAPI_RT-symlink ALL + rocprofiler-systems-rt-library-dyninstAPI_RT-symlink + ALL ${CMAKE_COMMAND} -E create_symlink ../$ ${CMAKE_SHARED_LIBRARY_PREFIX}dyninstAPI_RT${CMAKE_SHARED_LIBRARY_SUFFIX} @@ -133,9 +159,10 @@ add_custom_target( DEPENDS rocprofiler-systems-rt-library COMMENT "Creating ${CMAKE_SHARED_LIBRARY_PREFIX}dyninstAPI_RT${CMAKE_SHARED_LIBRARY_SUFFIX} to rocprof-sys-rt..." - ) +) install( FILES ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/${CMAKE_SHARED_LIBRARY_PREFIX}dyninstAPI_RT${CMAKE_SHARED_LIBRARY_SUFFIX} - DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}) + DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME} +) diff --git a/projects/rocprofiler-systems/source/lib/rocprof-sys-rt/cmake/platform.cmake b/projects/rocprofiler-systems/source/lib/rocprof-sys-rt/cmake/platform.cmake index 4d282b0cea..d027346913 100644 --- a/projects/rocprofiler-systems/source/lib/rocprof-sys-rt/cmake/platform.cmake +++ b/projects/rocprofiler-systems/source/lib/rocprof-sys-rt/cmake/platform.cmake @@ -4,8 +4,14 @@ set(PLATFORM $ENV{PLATFORM}) set(VALID_PLATFORMS - amd64-unknown-freebsd7.2 i386-unknown-freebsd7.2 i386-unknown-linux2.4 ppc32_linux - ppc64_linux x86_64-unknown-linux2.4 aarch64-unknown-linux) + amd64-unknown-freebsd7.2 + i386-unknown-freebsd7.2 + i386-unknown-linux2.4 + ppc32_linux + ppc64_linux + x86_64-unknown-linux2.4 + aarch64-unknown-linux +) if(NOT PLATFORM) set(INVALID_PLATFORM true) @@ -19,7 +25,8 @@ endif() execute_process( COMMAND ${CMAKE_CURRENT_LIST_DIR}/sysname OUTPUT_VARIABLE SYSNAME_OUT - OUTPUT_STRIP_TRAILING_WHITESPACE) + OUTPUT_STRIP_TRAILING_WHITESPACE +) string(REPLACE "\n" "" SYSPLATFORM ${SYSNAME_OUT}) if(INVALID_PLATFORM) @@ -27,10 +34,12 @@ if(INVALID_PLATFORM) execute_process( COMMAND ${CMAKE_CURRENT_LIST_DIR}/dynsysname ${SYSNAME_OUT} OUTPUT_VARIABLE DYNSYSNAME_OUT - OUTPUT_STRIP_TRAILING_WHITESPACE) + OUTPUT_STRIP_TRAILING_WHITESPACE + ) string(REPLACE "\n" "" PLATFORM ${DYNSYSNAME_OUT}) rocprofiler_systems_message( - STATUS "-- Attempting to automatically identify platform: ${PLATFORM}") + STATUS "-- Attempting to automatically identify platform: ${PLATFORM}" + ) endif() list(FIND VALID_PLATFORMS ${PLATFORM} PLATFORM_FOUND) @@ -39,13 +48,21 @@ if(PLATFORM_FOUND EQUAL -1) rocprofiler_systems_message( FATAL_ERROR "Error: unknown platform ${PLATFORM}; please set the PLATFORM environment variable to one of the following options: ${VALID_PLATFORMS}" - ) + ) endif() if(PLATFORM MATCHES i386) set(ARCH_DEFINES arch_x86) - list(APPEND CAP_DEFINES cap_fixpoint_gen cap_noaddr_gen cap_stripped_binaries - cap_tramp_liveness cap_virtual_registers cap_stack_mods) + list( + APPEND + CAP_DEFINES + cap_fixpoint_gen + cap_noaddr_gen + cap_stripped_binaries + cap_tramp_liveness + cap_virtual_registers + cap_stack_mods + ) elseif(PLATFORM MATCHES x86_64 OR PLATFORM MATCHES amd64) set(ARCH_DEFINES arch_x86_64 arch_64bit) list( @@ -57,7 +74,8 @@ elseif(PLATFORM MATCHES x86_64 OR PLATFORM MATCHES amd64) cap_registers cap_stripped_binaries cap_tramp_liveness - cap_stack_mods) + cap_stack_mods + ) elseif(PLATFORM MATCHES ppc32) set(ARCH_DEFINES arch_power) list(APPEND CAP_DEFINES cap_registers) @@ -78,20 +96,38 @@ endif() if(PLATFORM MATCHES linux) set(OS_DEFINES os_linux) - list(APPEND CAP_DEFINES cap_async_events cap_binary_rewriter cap_dwarf - cap_mutatee_traps cap_ptrace) + list( + APPEND + CAP_DEFINES + cap_async_events + cap_binary_rewriter + cap_dwarf + cap_mutatee_traps + cap_ptrace + ) set(BUG_DEFINES bug_syscall_changepc_rewind bug_force_terminate_failure) elseif(PLATFORM MATCHES cnl) set(OS_DEFINES os_linux os_cnl) - list(APPEND CAP_DEFINES cap_async_events cap_binary_rewriter cap_dwarf - cap_mutatee_traps cap_ptrace) + list( + APPEND + CAP_DEFINES + cap_async_events + cap_binary_rewriter + cap_dwarf + cap_mutatee_traps + cap_ptrace + ) set(BUG_DEFINES bug_syscall_changepc_rewind) elseif(PLATFORM MATCHES freebsd) set(OS_DEFINES os_freebsd) list(APPEND CAP_DEFINES cap_binary_rewriter cap_dwarf cap_mutatee_traps) set(BUG_DEFINES - bug_freebsd_missing_sigstop bug_freebsd_mt_suspend bug_freebsd_change_pc - bug_phdrs_first_page bug_syscall_changepc_rewind) + bug_freebsd_missing_sigstop + bug_freebsd_mt_suspend + bug_freebsd_change_pc + bug_phdrs_first_page + bug_syscall_changepc_rewind + ) elseif(PLATFORM STREQUAL i386-unknown-nt4.0) set(OS_DEFINES os_windows) list(APPEND CAP_DEFINES cap_mem_emulation cap_mutatee_traps) @@ -126,7 +162,12 @@ if(Thread_DB_FOUND) list(APPEND CAP_DEFINES cap_thread_db) endif() -set(UNIFIED_DEFINES ${CAP_DEFINES} ${BUG_DEFINES} ${ARCH_DEFINES} ${OS_DEFINES} - ${OLD_DEFINES}) +set(UNIFIED_DEFINES + ${CAP_DEFINES} + ${BUG_DEFINES} + ${ARCH_DEFINES} + ${OS_DEFINES} + ${OLD_DEFINES} +) list(REMOVE_DUPLICATES UNIFIED_DEFINES) diff --git a/projects/rocprofiler-systems/source/lib/rocprof-sys-user/CMakeLists.txt b/projects/rocprofiler-systems/source/lib/rocprof-sys-user/CMakeLists.txt index b6f6038353..8f561a4947 100644 --- a/projects/rocprofiler-systems/source/lib/rocprof-sys-user/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/lib/rocprof-sys-user/CMakeLists.txt @@ -11,43 +11,61 @@ set(CMAKE_CXX_VISIBILITY_PRESET "hidden") set(CMAKE_VISIBILITY_INLINES_HIDDEN ON) add_library(rocprofiler-systems-user-library SHARED) -add_library(rocprofiler-systems::rocprofiler-systems-user-library ALIAS - rocprofiler-systems-user-library) +add_library( + rocprofiler-systems::rocprofiler-systems-user-library + ALIAS rocprofiler-systems-user-library +) set(_user_headers ${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/user.h ${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/types.h ${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/causal.h - ${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/categories.h) + ${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/categories.h +) set(_user_sources ${CMAKE_CURRENT_SOURCE_DIR}/user.cpp) target_sources(rocprofiler-systems-user-library PRIVATE ${_user_sources} ${_user_headers}) target_include_directories( rocprofiler-systems-user-library - PUBLIC $ - $) + PUBLIC + $ + $ +) target_link_libraries( rocprofiler-systems-user-library PRIVATE - $) + $ +) set_target_properties( rocprofiler-systems-user-library - PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-user - VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_VERSION_MAJOR} - POSITION_INDEPENDENT_CODE ON - BUILD_RPATH "\$ORIGIN" - INSTALL_RPATH "\$ORIGIN") + PROPERTIES + OUTPUT_NAME ${BINARY_NAME_PREFIX}-user + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR} + POSITION_INDEPENDENT_CODE ON + BUILD_RPATH "\$ORIGIN" + INSTALL_RPATH "\$ORIGIN" +) rocprofiler_systems_strip_target(rocprofiler-systems-user-library) foreach(_HEADER ${_user_headers}) - string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/" - "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/" _DEST ${_HEADER}) - string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" - "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" _DEST "${_DEST}") + string( + REPLACE + "${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/" + "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/" + _DEST + ${_HEADER} + ) + string( + REPLACE + "${CMAKE_CURRENT_SOURCE_DIR}/" + "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" + _DEST + "${_DEST}" + ) configure_file(${_HEADER} ${_DEST} COPYONLY) endforeach() @@ -57,4 +75,5 @@ install(FILES ${_user_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT install( TARGETS rocprofiler-systems-user-library EXPORT rocprofiler-systems-library-targets - DESTINATION ${CMAKE_INSTALL_LIBDIR}) + DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/projects/rocprofiler-systems/source/lib/rocprof-sys/CMakeLists.txt b/projects/rocprofiler-systems/source/lib/rocprof-sys/CMakeLists.txt index 3d2773fcb3..248ba10055 100644 --- a/projects/rocprofiler-systems/source/lib/rocprof-sys/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/lib/rocprof-sys/CMakeLists.txt @@ -5,19 +5,28 @@ # ------------------------------------------------------------------------------# add_library(rocprofiler-systems-object-library OBJECT) -add_library(rocprofiler-systems::rocprofiler-systems-object-library ALIAS - rocprofiler-systems-object-library) +add_library( + rocprofiler-systems::rocprofiler-systems-object-library + ALIAS rocprofiler-systems-object-library +) target_sources( rocprofiler-systems-object-library - PRIVATE ${CMAKE_CURRENT_LIST_DIR}/library.cpp ${CMAKE_CURRENT_LIST_DIR}/regions.cpp - ${CMAKE_CURRENT_LIST_DIR}/progress.cpp ${CMAKE_CURRENT_LIST_DIR}/api.cpp - ${CMAKE_CURRENT_LIST_DIR}/timeout.cpp ${CMAKE_CURRENT_LIST_DIR}/api.hpp) + PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/library.cpp + ${CMAKE_CURRENT_LIST_DIR}/regions.cpp + ${CMAKE_CURRENT_LIST_DIR}/progress.cpp + ${CMAKE_CURRENT_LIST_DIR}/api.cpp + ${CMAKE_CURRENT_LIST_DIR}/timeout.cpp + ${CMAKE_CURRENT_LIST_DIR}/api.hpp +) add_subdirectory(library) -target_link_libraries(rocprofiler-systems-object-library - PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library) +target_link_libraries( + rocprofiler-systems-object-library + PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library +) # ------------------------------------------------------------------------------# # @@ -25,19 +34,28 @@ target_link_libraries(rocprofiler-systems-object-library # # ------------------------------------------------------------------------------# -add_library(rocprofiler-systems-static-library STATIC - $) -add_library(rocprofiler-systems::librocprofiler-systems-static ALIAS - rocprofiler-systems-static-library) +add_library( + rocprofiler-systems-static-library + STATIC + $ +) +add_library( + rocprofiler-systems::librocprofiler-systems-static + ALIAS rocprofiler-systems-static-library +) target_link_libraries( rocprofiler-systems-static-library - PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library - rocprofiler-systems::rocprofiler-systems-core - rocprofiler-systems::rocprofiler-systems-binary) + PRIVATE + rocprofiler-systems::rocprofiler-systems-interface-library + rocprofiler-systems::rocprofiler-systems-core + rocprofiler-systems::rocprofiler-systems-binary +) -set_target_properties(rocprofiler-systems-static-library PROPERTIES OUTPUT_NAME - ${BINARY_NAME_PREFIX}) +set_target_properties( + rocprofiler-systems-static-library + PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX} +) # ------------------------------------------------------------------------------# # @@ -45,29 +63,41 @@ set_target_properties(rocprofiler-systems-static-library PROPERTIES OUTPUT_NAME # # ------------------------------------------------------------------------------# -add_library(rocprofiler-systems-shared-library SHARED - $) -add_library(rocprofiler-systems::librocprofiler-systems-shared ALIAS - rocprofiler-systems-shared-library) -add_library(rocprofiler-systems::rocprofiler-systems-library ALIAS - rocprofiler-systems-shared-library) +add_library( + rocprofiler-systems-shared-library + SHARED + $ +) +add_library( + rocprofiler-systems::librocprofiler-systems-shared + ALIAS rocprofiler-systems-shared-library +) +add_library( + rocprofiler-systems::rocprofiler-systems-library + ALIAS rocprofiler-systems-shared-library +) target_link_libraries( rocprofiler-systems-shared-library - PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library - rocprofiler-systems::rocprofiler-systems-core - rocprofiler-systems::rocprofiler-systems-binary) + PRIVATE + rocprofiler-systems::rocprofiler-systems-interface-library + rocprofiler-systems::rocprofiler-systems-core + rocprofiler-systems::rocprofiler-systems-binary +) set_target_properties( rocprofiler-systems-shared-library - PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX} - VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_VERSION_MAJOR} - INSTALL_RPATH "${ROCPROFSYS_LIB_INSTALL_RPATH}") + PROPERTIES + OUTPUT_NAME ${BINARY_NAME_PREFIX} + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR} + INSTALL_RPATH "${ROCPROFSYS_LIB_INSTALL_RPATH}" +) rocprofiler_systems_strip_target(rocprofiler-systems-shared-library) install( TARGETS rocprofiler-systems-shared-library DESTINATION ${CMAKE_INSTALL_LIBDIR} - OPTIONAL) + OPTIONAL +) diff --git a/projects/rocprofiler-systems/source/lib/rocprof-sys/library/CMakeLists.txt b/projects/rocprofiler-systems/source/lib/rocprof-sys/library/CMakeLists.txt index 17b06c63d7..4bc4b29082 100644 --- a/projects/rocprofiler-systems/source/lib/rocprof-sys/library/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/lib/rocprof-sys/library/CMakeLists.txt @@ -11,7 +11,8 @@ set(library_sources ${CMAKE_CURRENT_LIST_DIR}/sampling.cpp ${CMAKE_CURRENT_LIST_DIR}/thread_deleter.cpp ${CMAKE_CURRENT_LIST_DIR}/thread_info.cpp - ${CMAKE_CURRENT_LIST_DIR}/tracing.cpp) + ${CMAKE_CURRENT_LIST_DIR}/tracing.cpp +) set(library_headers ${CMAKE_CURRENT_LIST_DIR}/coverage.hpp @@ -28,17 +29,22 @@ set(library_headers ${CMAKE_CURRENT_LIST_DIR}/thread_data.hpp ${CMAKE_CURRENT_LIST_DIR}/thread_deleter.hpp ${CMAKE_CURRENT_LIST_DIR}/thread_info.hpp - ${CMAKE_CURRENT_LIST_DIR}/tracing.hpp) + ${CMAKE_CURRENT_LIST_DIR}/tracing.hpp +) -target_sources(rocprofiler-systems-object-library PRIVATE ${library_sources} - ${library_headers}) +target_sources( + rocprofiler-systems-object-library + PRIVATE ${library_sources} ${library_headers} +) if(ROCPROFSYS_USE_ROCM) target_sources( rocprofiler-systems-object-library - PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rocm.cpp - ${CMAKE_CURRENT_LIST_DIR}/rocprofiler-sdk.cpp - ${CMAKE_CURRENT_LIST_DIR}/amd_smi.cpp) + PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/rocm.cpp + ${CMAKE_CURRENT_LIST_DIR}/rocprofiler-sdk.cpp + ${CMAKE_CURRENT_LIST_DIR}/amd_smi.cpp + ) add_subdirectory(rocprofiler-sdk) endif() @@ -52,8 +58,11 @@ set(ndebug_sources ${CMAKE_CURRENT_LIST_DIR}/components/backtrace_metrics.cpp ${CMAKE_CURRENT_LIST_DIR}/kokkosp.cpp ${CMAKE_CURRENT_LIST_DIR}/amd_smi.cpp - ${CMAKE_CURRENT_LIST_DIR}/ompt.cpp) + ${CMAKE_CURRENT_LIST_DIR}/ompt.cpp +) set_source_files_properties( - ${ndebug_sources} DIRECTORY ${PROJECT_SOURCE_DIR}/source/lib/rocprof-sys - PROPERTIES COMPILE_DEFINITIONS NDEBUG COMPILE_OPTIONS "-g0;-O3") + ${ndebug_sources} + DIRECTORY ${PROJECT_SOURCE_DIR}/source/lib/rocprof-sys + PROPERTIES COMPILE_DEFINITIONS NDEBUG COMPILE_OPTIONS "-g0;-O3" +) diff --git a/projects/rocprofiler-systems/source/lib/rocprof-sys/library/causal/CMakeLists.txt b/projects/rocprofiler-systems/source/lib/rocprof-sys/library/causal/CMakeLists.txt index 1ff3a01a62..be6bffbb6d 100644 --- a/projects/rocprofiler-systems/source/lib/rocprof-sys/library/causal/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/lib/rocprof-sys/library/causal/CMakeLists.txt @@ -1,15 +1,25 @@ # set(causal_sources - ${CMAKE_CURRENT_LIST_DIR}/data.cpp ${CMAKE_CURRENT_LIST_DIR}/delay.cpp - ${CMAKE_CURRENT_LIST_DIR}/experiment.cpp ${CMAKE_CURRENT_LIST_DIR}/sample_data.cpp - ${CMAKE_CURRENT_LIST_DIR}/sampling.cpp ${CMAKE_CURRENT_LIST_DIR}/selected_entry.cpp) + ${CMAKE_CURRENT_LIST_DIR}/data.cpp + ${CMAKE_CURRENT_LIST_DIR}/delay.cpp + ${CMAKE_CURRENT_LIST_DIR}/experiment.cpp + ${CMAKE_CURRENT_LIST_DIR}/sample_data.cpp + ${CMAKE_CURRENT_LIST_DIR}/sampling.cpp + ${CMAKE_CURRENT_LIST_DIR}/selected_entry.cpp +) set(causal_headers - ${CMAKE_CURRENT_LIST_DIR}/data.hpp ${CMAKE_CURRENT_LIST_DIR}/delay.hpp - ${CMAKE_CURRENT_LIST_DIR}/experiment.hpp ${CMAKE_CURRENT_LIST_DIR}/sample_data.hpp - ${CMAKE_CURRENT_LIST_DIR}/sampling.hpp ${CMAKE_CURRENT_LIST_DIR}/selected_entry.hpp) + ${CMAKE_CURRENT_LIST_DIR}/data.hpp + ${CMAKE_CURRENT_LIST_DIR}/delay.hpp + ${CMAKE_CURRENT_LIST_DIR}/experiment.hpp + ${CMAKE_CURRENT_LIST_DIR}/sample_data.hpp + ${CMAKE_CURRENT_LIST_DIR}/sampling.hpp + ${CMAKE_CURRENT_LIST_DIR}/selected_entry.hpp +) -target_sources(rocprofiler-systems-object-library PRIVATE ${causal_sources} - ${causal_headers}) +target_sources( + rocprofiler-systems-object-library + PRIVATE ${causal_sources} ${causal_headers} +) add_subdirectory(components) diff --git a/projects/rocprofiler-systems/source/lib/rocprof-sys/library/causal/components/CMakeLists.txt b/projects/rocprofiler-systems/source/lib/rocprof-sys/library/causal/components/CMakeLists.txt index a362ecfbdf..7a0978dca7 100644 --- a/projects/rocprofiler-systems/source/lib/rocprof-sys/library/causal/components/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/lib/rocprof-sys/library/causal/components/CMakeLists.txt @@ -4,14 +4,18 @@ set(component_sources ${CMAKE_CURRENT_LIST_DIR}/blocking_gotcha.cpp ${CMAKE_CURRENT_LIST_DIR}/causal_gotcha.cpp ${CMAKE_CURRENT_LIST_DIR}/progress_point.cpp - ${CMAKE_CURRENT_LIST_DIR}/unblocking_gotcha.cpp) + ${CMAKE_CURRENT_LIST_DIR}/unblocking_gotcha.cpp +) set(component_headers ${CMAKE_CURRENT_LIST_DIR}/backtrace.hpp ${CMAKE_CURRENT_LIST_DIR}/blocking_gotcha.hpp ${CMAKE_CURRENT_LIST_DIR}/causal_gotcha.hpp ${CMAKE_CURRENT_LIST_DIR}/progress_point.hpp - ${CMAKE_CURRENT_LIST_DIR}/unblocking_gotcha.hpp) + ${CMAKE_CURRENT_LIST_DIR}/unblocking_gotcha.hpp +) -target_sources(rocprofiler-systems-object-library PRIVATE ${component_sources} - ${component_headers}) +target_sources( + rocprofiler-systems-object-library + PRIVATE ${component_sources} ${component_headers} +) diff --git a/projects/rocprofiler-systems/source/lib/rocprof-sys/library/components/CMakeLists.txt b/projects/rocprofiler-systems/source/lib/rocprof-sys/library/components/CMakeLists.txt index 15940da05d..fb758625fd 100644 --- a/projects/rocprofiler-systems/source/lib/rocprof-sys/library/components/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/lib/rocprof-sys/library/components/CMakeLists.txt @@ -13,7 +13,8 @@ set(component_sources ${CMAKE_CURRENT_LIST_DIR}/vaapi_gotcha.cpp ${CMAKE_CURRENT_LIST_DIR}/pthread_gotcha.cpp ${CMAKE_CURRENT_LIST_DIR}/pthread_create_gotcha.cpp - ${CMAKE_CURRENT_LIST_DIR}/pthread_mutex_gotcha.cpp) + ${CMAKE_CURRENT_LIST_DIR}/pthread_mutex_gotcha.cpp +) set(component_headers ${CMAKE_CURRENT_LIST_DIR}/backtrace.hpp @@ -32,7 +33,10 @@ set(component_headers ${CMAKE_CURRENT_LIST_DIR}/vaapi_gotcha.hpp ${CMAKE_CURRENT_LIST_DIR}/pthread_gotcha.hpp ${CMAKE_CURRENT_LIST_DIR}/pthread_create_gotcha.hpp - ${CMAKE_CURRENT_LIST_DIR}/pthread_mutex_gotcha.hpp) + ${CMAKE_CURRENT_LIST_DIR}/pthread_mutex_gotcha.hpp +) -target_sources(rocprofiler-systems-object-library PRIVATE ${component_sources} - ${component_headers}) +target_sources( + rocprofiler-systems-object-library + PRIVATE ${component_sources} ${component_headers} +) diff --git a/projects/rocprofiler-systems/source/lib/rocprof-sys/library/coverage/CMakeLists.txt b/projects/rocprofiler-systems/source/lib/rocprof-sys/library/coverage/CMakeLists.txt index bfd775fb3c..e3e319ecb7 100644 --- a/projects/rocprofiler-systems/source/lib/rocprof-sys/library/coverage/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/lib/rocprof-sys/library/coverage/CMakeLists.txt @@ -2,5 +2,7 @@ set(coverage_sources) set(coverage_headers ${CMAKE_CURRENT_LIST_DIR}/impl.hpp) -target_sources(rocprofiler-systems-object-library PRIVATE ${coverage_sources} - ${coverage_headers}) +target_sources( + rocprofiler-systems-object-library + PRIVATE ${coverage_sources} ${coverage_headers} +) diff --git a/projects/rocprofiler-systems/source/lib/rocprof-sys/library/rocprofiler-sdk/CMakeLists.txt b/projects/rocprofiler-systems/source/lib/rocprof-sys/library/rocprofiler-sdk/CMakeLists.txt index 407037a67f..bd916c82f7 100644 --- a/projects/rocprofiler-systems/source/lib/rocprof-sys/library/rocprofiler-sdk/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/lib/rocprof-sys/library/rocprofiler-sdk/CMakeLists.txt @@ -1,11 +1,17 @@ # set(rocprofiler_sdk_sources - ${CMAKE_CURRENT_LIST_DIR}/counters.cpp ${CMAKE_CURRENT_LIST_DIR}/fwd.cpp - ${CMAKE_CURRENT_LIST_DIR}/rccl.cpp) + ${CMAKE_CURRENT_LIST_DIR}/counters.cpp + ${CMAKE_CURRENT_LIST_DIR}/fwd.cpp + ${CMAKE_CURRENT_LIST_DIR}/rccl.cpp +) set(rocprofiler_sdk_headers - ${CMAKE_CURRENT_LIST_DIR}/counters.hpp ${CMAKE_CURRENT_LIST_DIR}/fwd.hpp - ${CMAKE_CURRENT_LIST_DIR}/rccl.hpp) + ${CMAKE_CURRENT_LIST_DIR}/counters.hpp + ${CMAKE_CURRENT_LIST_DIR}/fwd.hpp + ${CMAKE_CURRENT_LIST_DIR}/rccl.hpp +) -target_sources(rocprofiler-systems-object-library PRIVATE ${rocprofiler_sdk_sources} - ${rocprofiler_sdk_headers}) +target_sources( + rocprofiler-systems-object-library + PRIVATE ${rocprofiler_sdk_sources} ${rocprofiler_sdk_headers} +) diff --git a/projects/rocprofiler-systems/source/lib/rocprof-sys/library/tracing/CMakeLists.txt b/projects/rocprofiler-systems/source/lib/rocprof-sys/library/tracing/CMakeLists.txt index 660857db97..09192eb08f 100644 --- a/projects/rocprofiler-systems/source/lib/rocprof-sys/library/tracing/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/lib/rocprof-sys/library/tracing/CMakeLists.txt @@ -2,5 +2,7 @@ set(tracing_sources ${CMAKE_CURRENT_LIST_DIR}/annotation.cpp) set(tracing_headers ${CMAKE_CURRENT_LIST_DIR}/annotation.hpp) -target_sources(rocprofiler-systems-object-library PRIVATE ${tracing_sources} - ${tracing_headers}) +target_sources( + rocprofiler-systems-object-library + PRIVATE ${tracing_sources} ${tracing_headers} +) diff --git a/projects/rocprofiler-systems/source/python/CMakeLists.txt b/projects/rocprofiler-systems/source/python/CMakeLists.txt index f160caa8cc..43a7128ba3 100644 --- a/projects/rocprofiler-systems/source/python/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/python/CMakeLists.txt @@ -18,24 +18,25 @@ set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME python) # ######################################################################################## function(ROCPROFILER_SYSTEMS_CONFIGURE_PYTARGET _TARGET _VERSION) - add_library(rocprofiler-systems::${_TARGET} ALIAS ${_TARGET}) target_link_libraries(${_TARGET} PRIVATE libpyrocprofiler-systems-interface) add_dependencies(libpyrocprofsys ${_TARGET}) set_target_properties( ${_TARGET} - PROPERTIES PREFIX "" - OUTPUT_NAME libpyrocprofsys - LIBRARY_OUTPUT_DIRECTORY - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys - ARCHIVE_OUTPUT_DIRECTORY - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys - RUNTIME_OUTPUT_DIRECTORY - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys - PDB_OUTPUT_DIRECTORY - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys - ${EXTRA_PROPERTIES}) + PROPERTIES + PREFIX "" + OUTPUT_NAME libpyrocprofsys + LIBRARY_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys + ARCHIVE_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys + RUNTIME_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys + PDB_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys + ${EXTRA_PROPERTIES} + ) set(_PYLIB ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys) if(NOT IS_ABSOLUTE "${_PYLIB}") @@ -45,28 +46,34 @@ function(ROCPROFILER_SYSTEMS_CONFIGURE_PYTARGET _TARGET _VERSION) if(SKBUILD) set(LIB_RELPATH ../../..) else() - file(RELATIVE_PATH LIB_RELPATH "${_PYLIB}" - "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + file( + RELATIVE_PATH + LIB_RELPATH + "${_PYLIB}" + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" + ) endif() - set_target_properties(${_TARGET} PROPERTIES INSTALL_RPATH - "\$ORIGIN:\$ORIGIN/${LIB_RELPATH}") + set_target_properties( + ${_TARGET} + PROPERTIES INSTALL_RPATH "\$ORIGIN:\$ORIGIN/${LIB_RELPATH}" + ) - install( - TARGETS ${_TARGET} - DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys - OPTIONAL) + install(TARGETS ${_TARGET} DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys OPTIONAL) endfunction() # ######################################################################################## add_library(rocprofiler-systems-python-compile-options INTERFACE) -add_library(rocprofiler-systems::rocprofiler-systems-python-compile-options ALIAS - rocprofiler-systems-python-compile-options) +add_library( + rocprofiler-systems::rocprofiler-systems-python-compile-options + ALIAS rocprofiler-systems-python-compile-options +) add_target_cxx_flag_if_avail( rocprofiler-systems-python-compile-options "-Wno-unused-value" "-Wno-range-loop-analysis" "-Wno-deprecated-declarations" - "-Wno-unused-but-set-parameter" "-ftls-model=global-dynamic") + "-Wno-unused-but-set-parameter" "-ftls-model=global-dynamic" +) file(GLOB pyheaders ${CMAKE_CURRENT_LIST_DIR}/libpyrocprofsys*.hpp) set(pysources ${CMAKE_CURRENT_LIST_DIR}/libpyrocprofsys.cpp) @@ -76,32 +83,36 @@ set(pybind_libs pybind11::module) add_library(libpyrocprofiler-systems-interface INTERFACE) target_link_libraries( libpyrocprofiler-systems-interface - INTERFACE pybind11::module - timemory::timemory-headers - rocprofiler-systems::rocprofiler-systems-headers - rocprofiler-systems::rocprofiler-systems-compile-options - rocprofiler-systems::rocprofiler-systems-static-libgcc-optional - rocprofiler-systems::rocprofiler-systems-lto - rocprofiler-systems::rocprofiler-systems-dl-library - rocprofiler-systems::rocprofiler-systems-user-library - rocprofiler-systems::rocprofiler-systems-python - rocprofiler-systems::rocprofiler-systems-python-compile-options) + INTERFACE + pybind11::module + timemory::timemory-headers + rocprofiler-systems::rocprofiler-systems-headers + rocprofiler-systems::rocprofiler-systems-compile-options + rocprofiler-systems::rocprofiler-systems-static-libgcc-optional + rocprofiler-systems::rocprofiler-systems-lto + rocprofiler-systems::rocprofiler-systems-dl-library + rocprofiler-systems::rocprofiler-systems-user-library + rocprofiler-systems::rocprofiler-systems-python + rocprofiler-systems::rocprofiler-systems-python-compile-options +) rocprofiler_systems_target_compile_definitions(libpyrocprofiler-systems-interface - INTERFACE ROCPROFSYS_PYBIND11_SOURCE) + INTERFACE ROCPROFSYS_PYBIND11_SOURCE +) add_custom_target(libpyrocprofsys) file(GLOB_RECURSE PYTHON_FILES ${CMAKE_CURRENT_SOURCE_DIR}/rocprofsys/*.py) foreach(_IN ${PYTHON_FILES}) - string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/rocprofsys" - "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys" _OUT - "${_IN}") + string( + REPLACE + "${CMAKE_CURRENT_SOURCE_DIR}/rocprofsys" + "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys" + _OUT + "${_IN}" + ) configure_file(${_IN} ${_OUT} @ONLY) - install( - FILES ${_OUT} - DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys - OPTIONAL) + install(FILES ${_OUT} DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys OPTIONAL) endforeach() rocprofiler_systems_python_console_script("${BINARY_NAME_PREFIX}-python" "rocprofsys") @@ -113,22 +124,34 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) rocprofiler_systems_pybind11_add_module( libpyrocprofiler-systems-${_VERSION} MODULE PYTHON_VERSION ${_VERSION} - VISIBILITY "hidden" ${pysources} ${pyheaders}) + VISIBILITY "hidden" ${pysources} ${pyheaders} + ) rocprofiler_systems_configure_pytarget(libpyrocprofiler-systems-${_VERSION} - ${_VERSION}) + ${_VERSION} + ) if(ROCPROFSYS_USE_PYTHON) rocprofiler_systems_python_console_script( "${BINARY_NAME_PREFIX}-python" "rocprofsys" VERSION ${_VERSION} - ROOT_DIR "${Python3_ROOT_DIR}") + ROOT_DIR "${Python3_ROOT_DIR}" + ) endif() math(EXPR _INDEX "${_INDEX} + 1") endforeach() -configure_file(${CMAKE_CURRENT_LIST_DIR}/setup.py.in - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/setup.py @ONLY) -configure_file(${CMAKE_CURRENT_LIST_DIR}/setup.cfg.in - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/setup.cfg @ONLY) -configure_file(${CMAKE_CURRENT_LIST_DIR}/pyproject.toml - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/pyproject.toml COPYONLY) +configure_file( + ${CMAKE_CURRENT_LIST_DIR}/setup.py.in + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/setup.py + @ONLY +) +configure_file( + ${CMAKE_CURRENT_LIST_DIR}/setup.cfg.in + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/setup.cfg + @ONLY +) +configure_file( + ${CMAKE_CURRENT_LIST_DIR}/pyproject.toml + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/pyproject.toml + COPYONLY +) diff --git a/projects/rocprofiler-systems/source/python/cmake/ConfigPython.cmake b/projects/rocprofiler-systems/source/python/cmake/ConfigPython.cmake index b2676e4b62..86cbfb0657 100644 --- a/projects/rocprofiler-systems/source/python/cmake/ConfigPython.cmake +++ b/projects/rocprofiler-systems/source/python/cmake/ConfigPython.cmake @@ -8,29 +8,37 @@ include_guard(DIRECTORY) set(Python3_FIND_STRATEGY "LOCATION" CACHE STRING - "Stops lookup as soon as a version satisfying version constraints is found") + "Stops lookup as soon as a version satisfying version constraints is found" +) # virtual environment is used before any other standard paths to look-up for the # interpreter set(Python3_FIND_VIRTUALENV "FIRST" - CACHE STRING "Virtual environment is used before any other standard paths") + CACHE STRING + "Virtual environment is used before any other standard paths" +) set_property(CACHE Python3_FIND_VIRTUALENV PROPERTY STRINGS "FIRST;LAST;NEVER") if(APPLE) set(Python3_FIND_FRAMEWORK "LAST" CACHE STRING - "Order of preference between Apple-style and unix-style package components") + "Order of preference between Apple-style and unix-style package components" + ) set_property(CACHE Python3_FIND_FRAMEWORK PROPERTY STRINGS "FIRST;LAST;NEVER") endif() # PyPy does not support embedding the interpreter set(Python3_FIND_IMPLEMENTATIONS "CPython" - CACHE STRING "Different implementations which will be searched.") -set_property(CACHE Python3_FIND_IMPLEMENTATIONS PROPERTY STRINGS - "CPython;IronPython;PyPy") + CACHE STRING + "Different implementations which will be searched." +) +set_property( + CACHE Python3_FIND_IMPLEMENTATIONS + PROPERTY STRINGS "CPython;IronPython;PyPy" +) # variable is a 3-tuple specifying, in order, pydebug (d), pymalloc (m) and unicode (u) # set(Python3_FIND_ABI "OFF" "OFF" "OFF" CACHE STRING "variable is a 3-tuple specifying @@ -41,20 +49,30 @@ set_property(CACHE Python3_FIND_IMPLEMENTATIONS PROPERTY STRINGS # requirements. set(Python3_ARTIFACTS_INTERACTIVE OFF - CACHE BOOL "Create CMake cache entries so that users can edit them interactively" - FORCE) + CACHE BOOL + "Create CMake cache entries so that users can edit them interactively" + FORCE +) # if("${Python3_USE_STATIC_LIBS}" STREQUAL "ANY") set(Python3_USE_STATIC_LIBS "OFF" CACHE # STRING "If ON, only static libs; if OFF, only shared libs; if ANY, shared then static") # set_property(CACHE Python3_USE_STATIC_LIBS PROPERTY STRINGS "ON;OFF;ANY") else() # unset(Python3_USE_STATIC_LIBS) endif() -foreach(_VAR FIND_STRATEGY FIND_VIRTUALENV FIND_FRAMEWORK FIND_IMPLEMENTATIONS - ARTIFACTS_INTERACTIVE) +foreach( + _VAR + FIND_STRATEGY + FIND_VIRTUALENV + FIND_FRAMEWORK + FIND_IMPLEMENTATIONS + ARTIFACTS_INTERACTIVE +) if(DEFINED Python3_${_VAR}) set(Python_${_VAR} "${Python3_${_VAR}}" - CACHE STRING "Set via Python3_${_VAR} setting (rocprofsys)") + CACHE STRING + "Set via Python3_${_VAR} setting (rocprofsys)" + ) mark_as_advanced(Python_${_VAR}) mark_as_advanced(Python3_${_VAR}) endif() @@ -62,7 +80,8 @@ endforeach() # display version rocprofiler_systems_add_feature(ROCPROFSYS_PYTHON_VERSIONS - "Python version for rocprofsys" DOC) + "Python version for rocprofsys" DOC +) option(PYBIND11_INSTALL "Enable Pybind11 installation" OFF) @@ -73,7 +92,8 @@ if(ROCPROFSYS_BUILD_PYTHON AND NOT TARGET pybind11) RELATIVE_PATH external/pybind11 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} REPO_URL https://github.com/jrmadsen/pybind11.git - REPO_BRANCH omnitrace) + REPO_BRANCH omnitrace + ) if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION) set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF) @@ -82,13 +102,17 @@ if(ROCPROFSYS_BUILD_PYTHON AND NOT TARGET pybind11) rocprofiler_systems_save_variables(IPO VARIABLES CMAKE_INTERPROCEDURAL_OPTIMIZATION) add_subdirectory(${PROJECT_SOURCE_DIR}/external/pybind11) rocprofiler_systems_restore_variables(IPO - VARIABLES CMAKE_INTERPROCEDURAL_OPTIMIZATION) + VARIABLES CMAKE_INTERPROCEDURAL_OPTIMIZATION + ) endif() execute_process( - COMMAND ${PYTHON_EXECUTABLE} -c - "import time ; print('{} {}'.format(time.ctime(), time.tzname[0]))" + COMMAND + ${PYTHON_EXECUTABLE} -c + "import time ; print('{} {}'.format(time.ctime(), time.tzname[0]))" OUTPUT_VARIABLE ROCPROFSYS_INSTALL_DATE - OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET +) string(REPLACE " " " " ROCPROFSYS_INSTALL_DATE "${ROCPROFSYS_INSTALL_DATE}") diff --git a/projects/rocprofiler-systems/source/python/cmake/Modules/FindPyBind11Python.cmake b/projects/rocprofiler-systems/source/python/cmake/Modules/FindPyBind11Python.cmake index cee46fe16d..dcabdb6a2f 100644 --- a/projects/rocprofiler-systems/source/python/cmake/Modules/FindPyBind11Python.cmake +++ b/projects/rocprofiler-systems/source/python/cmake/Modules/FindPyBind11Python.cmake @@ -70,8 +70,15 @@ if(NOT PyBind11Python_COMPONENTS) endif() # Use the Python interpreter to find the libs. -find_package(${PyBind11Python_PYTHON} ${PyBind11Python_FIND_VERSION} ${_find_exact} MODULE - ${_find_required} ${_find_quiet} COMPONENTS ${PyBind11Python_COMPONENTS}) +find_package( + ${PyBind11Python_PYTHON} + ${PyBind11Python_FIND_VERSION} + ${_find_exact} + MODULE + ${_find_required} + ${_find_quiet} + COMPONENTS ${PyBind11Python_COMPONENTS} +) # According to # https://stackoverflow.com/questions/646518/python-how-to-detect-debug-interpreter @@ -110,7 +117,8 @@ print(s.get_config_var('MULTIARCH') or ''); " RESULT_VARIABLE _PYTHON_SUCCESS OUTPUT_VARIABLE _PYTHON_VALUES - ERROR_VARIABLE _PYTHON_ERROR_VALUE) + ERROR_VARIABLE _PYTHON_ERROR_VALUE +) if(NOT _PYTHON_SUCCESS MATCHES 0) if(PyBind11Python_FIND_REQUIRED) @@ -139,13 +147,18 @@ list(GET _PYTHON_VALUES 9 PYTHON_MULTIARCH) # Make sure the Python has the same pointer-size as the chosen compiler Skip if # CMAKE_SIZEOF_VOID_P is not defined -if(CMAKE_SIZEOF_VOID_P AND (NOT "${PYTHON_SIZEOF_VOID_P}" STREQUAL - "${CMAKE_SIZEOF_VOID_P}")) +if( + CMAKE_SIZEOF_VOID_P + AND (NOT "${PYTHON_SIZEOF_VOID_P}" STREQUAL "${CMAKE_SIZEOF_VOID_P}") +) if(PyBind11Python_FIND_REQUIRED) math(EXPR _PYTHON_BITS "${PYTHON_SIZEOF_VOID_P} * 8") math(EXPR _CMAKE_BITS "${CMAKE_SIZEOF_VOID_P} * 8") - message(FATAL_ERROR "Python config failure: Python is ${_PYTHON_BITS}-bit, " - "chosen compiler is ${_CMAKE_BITS}-bit") + message( + FATAL_ERROR + "Python config failure: Python is ${_PYTHON_BITS}-bit, " + "chosen compiler is ${_CMAKE_BITS}-bit" + ) endif() set(PyBind11Python_FOUND FALSE) return() @@ -157,7 +170,8 @@ list(GET _PYTHON_VERSION_LIST 0 PYTHON_VERSION_MAJOR) list(GET _PYTHON_VERSION_LIST 1 PYTHON_VERSION_MINOR) list(GET _PYTHON_VERSION_LIST 2 PYTHON_VERSION_PATCH) set(PYTHON_VERSION - "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}") + "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}" +) # Make sure all directory separators are '/' string(REGEX REPLACE "\\\\" "/" PYTHON_PREFIX "${PYTHON_PREFIX}") diff --git a/projects/rocprofiler-systems/source/python/cmake/PyBind11Tools.cmake b/projects/rocprofiler-systems/source/python/cmake/PyBind11Tools.cmake index d400f9710b..1d15d792b4 100644 --- a/projects/rocprofiler-systems/source/python/cmake/PyBind11Tools.cmake +++ b/projects/rocprofiler-systems/source/python/cmake/PyBind11Tools.cmake @@ -26,34 +26,32 @@ function(ROCPROFILER_SYSTEMS_FIND_PYTHON _VAR) set(Python3_FIND_VIRTUALENV "FIRST") set(Python3_ARTIFACTS_INTERACTIVE OFF) - find_package(Python3 ${ARG_VERSION} ${_EXACT} ${_QUIET} MODULE ${_FIND_REQUIREMENT} - COMPONENTS ${ARG_COMPONENTS}) + find_package( + Python3 + ${ARG_VERSION} + ${_EXACT} + ${_QUIET} + MODULE + ${_FIND_REQUIREMENT} + COMPONENTS ${ARG_COMPONENTS} + ) - set(${_VAR}_FOUND - "${Python3_FOUND}" - PARENT_SCOPE) + set(${_VAR}_FOUND "${Python3_FOUND}" PARENT_SCOPE) if(NOT Python3_FOUND) - set(${_VAR}_EXECUTABLE - "" - PARENT_SCOPE) - set(${_VAR}_ROOT_DIR - "" - PARENT_SCOPE) - set(${_VAR}_VERSION - "" - PARENT_SCOPE) + set(${_VAR}_EXECUTABLE "" PARENT_SCOPE) + set(${_VAR}_ROOT_DIR "" PARENT_SCOPE) + set(${_VAR}_VERSION "" PARENT_SCOPE) return() else() - set(${_VAR}_EXECUTABLE - "${Python3_EXECUTABLE}" - PARENT_SCOPE) + set(${_VAR}_EXECUTABLE "${Python3_EXECUTABLE}" PARENT_SCOPE) execute_process( COMMAND "${Python3_EXECUTABLE}" "-c" "import sys; print('.'.join(str(v) for v in [sys.version_info[0], sys.version_info[1]])); print(sys.prefix);" RESULT_VARIABLE _PYTHON_SUCCESS OUTPUT_VARIABLE _PYTHON_VALUES - ERROR_VARIABLE _PYTHON_ERROR_VALUE) + ERROR_VARIABLE _PYTHON_ERROR_VALUE + ) if(_PYTHON_SUCCESS MATCHES 0) # Convert the process output into a list @@ -61,12 +59,8 @@ function(ROCPROFILER_SYSTEMS_FIND_PYTHON _VAR) string(REGEX REPLACE "\n" ";" _PYTHON_VALUES ${_PYTHON_VALUES}) list(GET _PYTHON_VALUES 0 _PYTHON_VERSION_LIST) list(GET _PYTHON_VALUES 1 _PYTHON_PREFIX) - set(${_VAR}_ROOT_DIR - "${_PYTHON_PREFIX}" - PARENT_SCOPE) - set(${_VAR}_VERSION - "${_PYTHON_VERSION_LIST}" - PARENT_SCOPE) + set(${_VAR}_ROOT_DIR "${_PYTHON_PREFIX}" PARENT_SCOPE) + set(${_VAR}_VERSION "${_PYTHON_VERSION_LIST}" PARENT_SCOPE) else() rocprofiler_systems_message(WARNING "${_PYTHON_ERROR_VALUE}") endif() @@ -80,28 +74,26 @@ function(_ROCPROFSYS_PYBIND11_ADD_LTO_FLAGS target_name prefer_thin_lto) # name for each set of flags: the compilation result will be cached base on the result # variable. If the flags work, sets them in cxxflags_out/linkerflags_out internal # cache variables (in addition to ${result}). - function(_PYBIND11_RETURN_IF_CXX_AND_LINKER_FLAGS_WORK result cxxflags linkerflags - cxxflags_out linkerflags_out) + function( + _PYBIND11_RETURN_IF_CXX_AND_LINKER_FLAGS_WORK + result + cxxflags + linkerflags + cxxflags_out + linkerflags_out + ) include(CheckCXXCompilerFlag) set(CMAKE_REQUIRED_LIBRARIES ${linkerflags}) check_cxx_compiler_flag("${cxxflags}" ${result}) if(${result}) - set(${cxxflags_out} - "${cxxflags}" - CACHE INTERNAL "" FORCE) - set(${linkerflags_out} - "${linkerflags}" - CACHE INTERNAL "" FORCE) + set(${cxxflags_out} "${cxxflags}" CACHE INTERNAL "" FORCE) + set(${linkerflags_out} "${linkerflags}" CACHE INTERNAL "" FORCE) endif() endfunction() if(NOT DEFINED PYBIND11_LTO_CXX_FLAGS) - set(PYBIND11_LTO_CXX_FLAGS - "" - CACHE INTERNAL "") - set(PYBIND11_LTO_LINKER_FLAGS - "" - CACHE INTERNAL "") + set(PYBIND11_LTO_CXX_FLAGS "" CACHE INTERNAL "") + set(PYBIND11_LTO_LINKER_FLAGS "" CACHE INTERNAL "") if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") set(cxx_append "") @@ -117,19 +109,22 @@ function(_ROCPROFSYS_PYBIND11_ADD_LTO_FLAGS target_name prefer_thin_lto) if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND prefer_thin_lto) _pybind11_return_if_cxx_and_linker_flags_work( HAS_FLTO_THIN "-flto=thin${cxx_append}" "-flto=thin${linker_append}" - PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS) + PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS + ) endif() if(NOT HAS_FLTO_THIN) _pybind11_return_if_cxx_and_linker_flags_work( HAS_FLTO "-flto${cxx_append}" "-flto${linker_append}" - PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS) + PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS + ) endif() elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel") # Intel equivalent to LTO is called IPO _pybind11_return_if_cxx_and_linker_flags_work( HAS_INTEL_IPO "-ipo" "-ipo" PYBIND11_LTO_CXX_FLAGS - PYBIND11_LTO_LINKER_FLAGS) + PYBIND11_LTO_LINKER_FLAGS + ) elseif(MSVC) # cmake only interprets libraries as linker flags when they start with a - # (otherwise it converts /LTCG to \LTCG as if it was a Windows path). Luckily @@ -137,7 +132,8 @@ function(_ROCPROFSYS_PYBIND11_ADD_LTO_FLAGS target_name prefer_thin_lto) # non-standard: _pybind11_return_if_cxx_and_linker_flags_work( HAS_MSVC_GL_LTCG "/GL" "-LTCG" PYBIND11_LTO_CXX_FLAGS - PYBIND11_LTO_LINKER_FLAGS) + PYBIND11_LTO_LINKER_FLAGS + ) endif() if(PYBIND11_LTO_CXX_FLAGS) @@ -146,24 +142,35 @@ function(_ROCPROFSYS_PYBIND11_ADD_LTO_FLAGS target_name prefer_thin_lto) rocprofiler_systems_message( STATUS "${target_name} :: LTO disabled (not supported by the compiler and/or linker)" - ) + ) endif() endif() # Enable LTO flags if found, except for Debug builds if(PYBIND11_LTO_CXX_FLAGS) target_compile_options( - ${target_name} PRIVATE "$<$>:${PYBIND11_LTO_CXX_FLAGS}>") + ${target_name} + PRIVATE "$<$>:${PYBIND11_LTO_CXX_FLAGS}>" + ) endif() if(PYBIND11_LTO_LINKER_FLAGS) target_link_libraries( ${target_name} - PRIVATE "$<$>:${PYBIND11_LTO_LINKER_FLAGS}>") + PRIVATE "$<$>:${PYBIND11_LTO_LINKER_FLAGS}>" + ) endif() endfunction() # function(ROCPROFILER_SYSTEMS_PYBIND11_ADD_MODULE target_name) - set(options MODULE SHARED EXCLUDE_FROM_ALL NO_EXTRAS SYSTEM THIN_LTO LTO) + set(options + MODULE + SHARED + EXCLUDE_FROM_ALL + NO_EXTRAS + SYSTEM + THIN_LTO + LTO + ) set(args PYTHON_VERSION VISIBILITY CXX_STANDARD) set(kwargs) cmake_parse_arguments(ARG "${options}" "${args}" "${kwargs}" ${ARGN}) @@ -202,10 +209,14 @@ function(ROCPROFILER_SYSTEMS_PYBIND11_ADD_MODULE target_name) find_package(PyBind11Python ${ARG_PYTHON_VERSION}) target_include_directories( - ${target_name} ${inc_isystem} - PRIVATE ${PYBIND11_INCLUDE_DIR} # from project CMakeLists.txt - PRIVATE ${pybind11_INCLUDE_DIR} # from pybind11Config - PRIVATE ${Python3_INCLUDE_DIRS}) + ${target_name} + ${inc_isystem} + PRIVATE + ${PYBIND11_INCLUDE_DIR} # from project CMakeLists.txt + PRIVATE + ${pybind11_INCLUDE_DIR} # from pybind11Config + PRIVATE ${Python3_INCLUDE_DIRS} + ) # Python debug libraries expose slightly different objects # https://docs.python.org/3.6/c-api/intro.html#debugging-builds @@ -223,10 +234,14 @@ function(ROCPROFILER_SYSTEMS_PYBIND11_ADD_MODULE target_name) # force it on everything inside the `pybind11` namespace; also turning it on for a # pybind module compilation here avoids potential warnings or issues from having mixed # hidden/non-hidden types. - set_target_properties(${target_name} PROPERTIES CXX_VISIBILITY_PRESET - "${ARG_VISIBILITY}") - set_target_properties(${target_name} PROPERTIES CUDA_VISIBILITY_PRESET - "${ARG_VISIBILITY}") + set_target_properties( + ${target_name} + PROPERTIES CXX_VISIBILITY_PRESET "${ARG_VISIBILITY}" + ) + set_target_properties( + ${target_name} + PROPERTIES CUDA_VISIBILITY_PRESET "${ARG_VISIBILITY}" + ) if(WIN32 OR CYGWIN) # Link against the Python shared library on Windows @@ -253,8 +268,10 @@ function(ROCPROFILER_SYSTEMS_PYBIND11_ADD_MODULE target_name) endif() # Make sure C++11/14 are enabled - set_target_properties(${target_name} PROPERTIES CXX_STANDARD ${ARG_CXX_STANDARD} - CXX_STANDARD_REQUIRED ON) + set_target_properties( + ${target_name} + PROPERTIES CXX_STANDARD ${ARG_CXX_STANDARD} CXX_STANDARD_REQUIRED ON + ) if(ARG_NO_EXTRAS) return() @@ -271,12 +288,14 @@ function(ROCPROFILER_SYSTEMS_PYBIND11_ADD_MODULE target_name) add_custom_command( TARGET ${target_name} POST_BUILD - COMMAND ${CMAKE_STRIP} -x $) + COMMAND ${CMAKE_STRIP} -x $ + ) else() add_custom_command( TARGET ${target_name} POST_BUILD - COMMAND ${CMAKE_STRIP} $) + COMMAND ${CMAKE_STRIP} $ + ) endif() endif() endif() @@ -295,7 +314,8 @@ function(ROCPROFILER_SYSTEMS_PYBIND11_ADD_MODULE target_name) # build to fail. target_compile_options( ${target_name} - PRIVATE $<$>:$<$:/MP>>) + PRIVATE $<$>:$<$:/MP>> + ) endif() endif() endfunction() diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-annotate-tests.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-annotate-tests.cmake index 9295450ab5..dbe70bc9ef 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-annotate-tests.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-annotate-tests.cmake @@ -26,15 +26,20 @@ # # -------------------------------------------------------------------------------------- # -if(ROCPROFSYS_USE_PAPI - AND (rocprofiler_systems_perf_event_paranoid LESS_EQUAL 3 +if( + ROCPROFSYS_USE_PAPI + AND ( + rocprofiler_systems_perf_event_paranoid LESS_EQUAL 3 OR rocprofiler_systems_cap_sys_admin EQUAL 0 - OR rocprofiler_systems_cap_perfmon EQUAL 0)) + OR rocprofiler_systems_cap_perfmon EQUAL 0 + ) +) set(_annotate_environment "${_base_environment}" "ROCPROFSYS_TIMEMORY_COMPONENTS=thread_cpu_clock papi_array" "ROCPROFSYS_PAPI_EVENTS=perf::PERF_COUNT_SW_CPU_CLOCK" - "ROCPROFSYS_USE_SAMPLING=OFF") + "ROCPROFSYS_USE_SAMPLING=OFF" + ) rocprofiler_systems_add_test( SKIP_BASELINE SKIP_RUNTIME @@ -58,23 +63,28 @@ if(ROCPROFSYS_USE_PAPI functions --print-instructions ENVIRONMENT "${_annotate_environment}" - LABELS "annotate;papi") + LABELS "annotate;papi" + ) rocprofiler_systems_add_validation_test( NAME annotate-binary-rewrite PERFETTO_FILE "perfetto-trace.proto" LABELS "annotate;papi" - ARGS --key-names perf::PERF_COUNT_SW_CPU_CLOCK thread_cpu_clock --key-counts 8 8) + ARGS --key-names perf::PERF_COUNT_SW_CPU_CLOCK thread_cpu_clock --key-counts 8 8 + ) rocprofiler_systems_add_validation_test( NAME annotate-sampling PERFETTO_FILE "perfetto-trace.proto" LABELS "papi" - ARGS --key-names thread_cpu_clock --key-counts 6) + ARGS --key-names thread_cpu_clock --key-counts 6 + ) else() set(_annotate_environment - "${_base_environment}" "ROCPROFSYS_TIMEMORY_COMPONENTS=thread_cpu_clock" - "ROCPROFSYS_USE_SAMPLING=OFF") + "${_base_environment}" + "ROCPROFSYS_TIMEMORY_COMPONENTS=thread_cpu_clock" + "ROCPROFSYS_USE_SAMPLING=OFF" + ) rocprofiler_systems_add_test( SKIP_BASELINE SKIP_RUNTIME @@ -98,17 +108,20 @@ else() functions --print-instructions ENVIRONMENT "${_annotate_environment}" - LABELS "annotate") + LABELS "annotate" + ) rocprofiler_systems_add_validation_test( NAME annotate-binary-rewrite PERFETTO_FILE "perfetto-trace.proto" LABELS "annotate" - ARGS --key-names thread_cpu_clock --key-counts 8) + ARGS --key-names thread_cpu_clock --key-counts 8 + ) rocprofiler_systems_add_validation_test( NAME annotate-sampling PERFETTO_FILE "perfetto-trace.proto" LABELS "annotate" - ARGS --key-names thread_cpu_clock --key-counts 6) + ARGS --key-names thread_cpu_clock --key-counts 6 + ) endif() diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-attach-tests.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-attach-tests.cmake index ec9fe0a544..e2647d40d0 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-attach-tests.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-attach-tests.cmake @@ -38,7 +38,7 @@ else() rocprofiler_systems_message( AUTHOR_WARNING "Disabling attach tests. Run 'echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope' to enable attaching to process" - ) + ) endif() if(NOT _VALID_PTRACE_SCOPE) @@ -55,21 +55,22 @@ add_test( ${CMAKE_CURRENT_LIST_DIR}/run-rocprof-sys-pid.sh $ -ME "\.c$" -E fib -e -v 1 --label return args file -l -- $ 30 8 1000 - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +) set(_parallel_overhead_attach_environ - "${_attach_environment}" "ROCPROFSYS_OUTPUT_PATH=rocprof-sys-tests-output" - "ROCPROFSYS_OUTPUT_PREFIX=parallel-overhead-attach/") + "${_attach_environment}" + "ROCPROFSYS_OUTPUT_PATH=rocprof-sys-tests-output" + "ROCPROFSYS_OUTPUT_PREFIX=parallel-overhead-attach/" +) set_tests_properties( parallel-overhead-attach - PROPERTIES ENVIRONMENT - "${_parallel_overhead_attach_environ}" - TIMEOUT - 300 - LABELS - "parallel-overhead;attach" - PASS_REGULAR_EXPRESSION - "Outputting.*(perfetto-trace.proto).*Outputting.*(wall_clock.txt)" - FAIL_REGULAR_EXPRESSION - "Dyninst was unable to attach to the specified process") + PROPERTIES + ENVIRONMENT "${_parallel_overhead_attach_environ}" + TIMEOUT 300 + LABELS "parallel-overhead;attach" + PASS_REGULAR_EXPRESSION + "Outputting.*(perfetto-trace.proto).*Outputting.*(wall_clock.txt)" + FAIL_REGULAR_EXPRESSION "Dyninst was unable to attach to the specified process" +) diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-causal-tests.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-causal-tests.cmake index e34da228f8..cbb4e522eb 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-causal-tests.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-causal-tests.cmake @@ -33,7 +33,7 @@ rocprofiler_systems_add_causal_test( CAUSAL_MODE "function" CAUSAL_PASS_REGEX "Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz" - ) +) rocprofiler_systems_add_causal_test( SKIP_BASELINE @@ -43,7 +43,7 @@ rocprofiler_systems_add_causal_test( CAUSAL_MODE "function" CAUSAL_PASS_REGEX "Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz" - ) +) rocprofiler_systems_add_causal_test( SKIP_BASELINE @@ -53,7 +53,7 @@ rocprofiler_systems_add_causal_test( CAUSAL_MODE "line" CAUSAL_PASS_REGEX "Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz" - ) +) rocprofiler_systems_add_causal_test( NAME both-rocprofsys-func @@ -79,7 +79,7 @@ rocprofiler_systems_add_causal_test( ENVIRONMENT "ROCPROFSYS_STRICT_CONFIG=OFF" CAUSAL_PASS_REGEX "Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz" - ) +) rocprofiler_systems_add_causal_test( NAME lulesh-func @@ -89,7 +89,7 @@ rocprofiler_systems_add_causal_test( CAUSAL_ARGS -s 0,10,25,50,75 CAUSAL_PASS_REGEX "Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz" - ) +) rocprofiler_systems_add_causal_test( SKIP_BASELINE @@ -100,7 +100,7 @@ rocprofiler_systems_add_causal_test( CAUSAL_ARGS -s 0,10,25,50,75 CAUSAL_PASS_REGEX "Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz" - ) +) rocprofiler_systems_add_causal_test( SKIP_BASELINE @@ -111,13 +111,14 @@ rocprofiler_systems_add_causal_test( CAUSAL_ARGS -s 0,10,25,50,75 -S lulesh.cc CAUSAL_PASS_REGEX "Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz" - ) +) # set(_causal_e2e_exe_args 80 100 432525 100000000) set(_causal_e2e_exe_args 80 12 432525 # 500000000) set(_causal_e2e_exe_args 80 50 432525 100000000) set(_causal_common_args - "-n 5 -e -s 0 10 20 30 -B $") + "-n 5 -e -s 0 10 20 30 -B $" +) macro( causal_e2e_args_and_validation @@ -129,14 +130,14 @@ macro( _V20 _V30 _TOL # tolerance for virtual speedup - ) +) # arguments to rocprofiler-systems-causal set(${_NAME}_args "${_causal_common_args} ${_MODE} ${_EXPER}") # arguments to validate-causal-json.py set(${_NAME}_valid "-n 0 -i rocprof-sys-tests-output/causal-cpu-rocprofsys-${_TEST}-e2e/causal/experiments.json -v ${_EXPER} $ 10 ${_V10} ${_TOL} ${_EXPER} $ 20 ${_V20} ${_TOL} ${_EXPER} $ 30 ${_V30} ${_TOL}" - ) + ) # patch string for command-line string(REPLACE " " ";" ${_NAME}_args "${${_NAME}_args}") @@ -144,7 +145,8 @@ macro( endmacro() causal_e2e_args_and_validation(_causal_slow_func slow-func "-F" "cpu_slow_func" 10 20 20 - 5) + 5 +) causal_e2e_args_and_validation(_causal_fast_func fast-func "-F" "cpu_fast_func" 0 0 0 5) causal_e2e_args_and_validation(_causal_line_100 line-100 "-S" "causal.cpp:100" 10 20 20 5) causal_e2e_args_and_validation(_causal_line_110 line-110 "-S" "causal.cpp:110" 0 0 0 5) @@ -167,7 +169,8 @@ rocprofiler_systems_add_causal_test( CAUSAL_PASS_REGEX "Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz" ENVIRONMENT "${_causal_e2e_environment}" - PROPERTIES PROCESSORS 2 PROCESSOR_AFFINITY OFF) + PROPERTIES PROCESSORS 2 PROCESSOR_AFFINITY OFF +) rocprofiler_systems_add_causal_test( SKIP_BASELINE @@ -181,7 +184,8 @@ rocprofiler_systems_add_causal_test( CAUSAL_PASS_REGEX "Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz" ENVIRONMENT "${_causal_e2e_environment}" - PROPERTIES PROCESSORS 2 PROCESSOR_AFFINITY OFF) + PROPERTIES PROCESSORS 2 PROCESSOR_AFFINITY OFF +) rocprofiler_systems_add_causal_test( SKIP_BASELINE @@ -195,7 +199,8 @@ rocprofiler_systems_add_causal_test( CAUSAL_PASS_REGEX "Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz" ENVIRONMENT "${_causal_e2e_environment}" - PROPERTIES PROCESSORS 2 PROCESSOR_AFFINITY OFF) + PROPERTIES PROCESSORS 2 PROCESSOR_AFFINITY OFF +) rocprofiler_systems_add_causal_test( SKIP_BASELINE @@ -209,4 +214,5 @@ rocprofiler_systems_add_causal_test( CAUSAL_PASS_REGEX "Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz" ENVIRONMENT "${_causal_e2e_environment}" - PROPERTIES PROCESSORS 2 PROCESSOR_AFFINITY OFF) + PROPERTIES PROCESSORS 2 PROCESSOR_AFFINITY OFF +) diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-code-coverage-tests.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-code-coverage-tests.cmake index b1bdbb5a27..5893bc4d8d 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-code-coverage-tests.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-code-coverage-tests.cmake @@ -63,7 +63,8 @@ rocprofiler_systems_add_test( RUN_ARGS 10 ${NUM_THREADS} 1000 ENVIRONMENT "${_base_environment}" RUNTIME_PASS_REGEX "(\\\[[0-9]+\\\]) code coverage :: 66.67%" - REWRITE_RUN_PASS_REGEX "(\\\[[0-9]+\\\]) code coverage :: 66.67%") + REWRITE_RUN_PASS_REGEX "(\\\[[0-9]+\\\]) code coverage :: 66.67%" +) rocprofiler_systems_add_test( SKIP_BASELINE SKIP_SAMPLING @@ -90,7 +91,8 @@ rocprofiler_systems_add_test( RUN_ARGS 10 ${NUM_THREADS} 1000 ENVIRONMENT "${_base_environment}" RUNTIME_PASS_REGEX "(\\\[[0-9]+\\\]) code coverage :: 66.67%" - REWRITE_RUN_PASS_REGEX "(\\\[[0-9]+\\\]) code coverage :: 66.67%") + REWRITE_RUN_PASS_REGEX "(\\\[[0-9]+\\\]) code coverage :: 66.67%" +) rocprofiler_systems_add_test( SKIP_BASELINE SKIP_SAMPLING @@ -129,7 +131,8 @@ rocprofiler_systems_add_test( RUN_ARGS 10 ${NUM_THREADS} 1000 ENVIRONMENT "${_base_environment}" RUNTIME_PASS_REGEX "(\\\[[0-9]+\\\]) function coverage :: 66.67%" - REWRITE_RUN_PASS_REGEX "(\\\[[0-9]+\\\]) function coverage :: 66.67%") + REWRITE_RUN_PASS_REGEX "(\\\[[0-9]+\\\]) function coverage :: 66.67%" +) rocprofiler_systems_add_test( SKIP_BASELINE SKIP_SAMPLING @@ -156,4 +159,5 @@ rocprofiler_systems_add_test( RUN_ARGS 10 ${NUM_THREADS} 1000 ENVIRONMENT "${_base_environment}" RUNTIME_PASS_REGEX "(\\\[[0-9]+\\\]) function coverage :: 66.67%" - REWRITE_RUN_PASS_REGEX "(\\\[[0-9]+\\\]) function coverage :: 66.67%") + REWRITE_RUN_PASS_REGEX "(\\\[[0-9]+\\\]) function coverage :: 66.67%" +) diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-config-tests.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-config-tests.cmake index 6265c7ffe1..4463ddb4ca 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-config-tests.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-config-tests.cmake @@ -27,11 +27,13 @@ # -------------------------------------------------------------------------------------- # file( - WRITE ${CMAKE_CURRENT_BINARY_DIR}/invalid.cfg + WRITE + ${CMAKE_CURRENT_BINARY_DIR}/invalid.cfg " ROCPROFSYS_CONFIG_FILE = FOOBAR = ON -") +" +) if(TARGET parallel-overhead) set(_CONFIG_TEST_EXE $) @@ -42,33 +44,31 @@ endif() add_test( NAME rocprofiler-systems-invalid-config COMMAND $ -- ${_CONFIG_TEST_EXE} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +) set_tests_properties( rocprofiler-systems-invalid-config PROPERTIES ENVIRONMENT - "ROCPROFSYS_CONFIG_FILE=${CMAKE_CURRENT_BINARY_DIR}/invalid.cfg;ROCPROFSYS_CI=ON;ROCPROFSYS_CI_TIMEOUT=120" - TIMEOUT - 120 - LABELS - "config" - WILL_FAIL - ON) + "ROCPROFSYS_CONFIG_FILE=${CMAKE_CURRENT_BINARY_DIR}/invalid.cfg;ROCPROFSYS_CI=ON;ROCPROFSYS_CI_TIMEOUT=120" + TIMEOUT 120 + LABELS "config" + WILL_FAIL ON +) add_test( NAME rocprofiler-systems-missing-config COMMAND $ -- ${_CONFIG_TEST_EXE} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +) set_tests_properties( rocprofiler-systems-missing-config PROPERTIES ENVIRONMENT - "ROCPROFSYS_CONFIG_FILE=${CMAKE_CURRENT_BINARY_DIR}/missing.cfg;ROCPROFSYS_CI=ON;ROCPROFSYS_CI_TIMEOUT=120" - TIMEOUT - 120 - LABELS - "config" - WILL_FAIL - ON) + "ROCPROFSYS_CONFIG_FILE=${CMAKE_CURRENT_BINARY_DIR}/missing.cfg;ROCPROFSYS_CI=ON;ROCPROFSYS_CI_TIMEOUT=120" + TIMEOUT 120 + LABELS "config" + WILL_FAIL ON +) diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-decode-tests.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-decode-tests.cmake index 3725d0ab84..b164504ed6 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-decode-tests.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-decode-tests.cmake @@ -30,12 +30,14 @@ set(_video_decode_environment "${_base_environment}" "ROCPROFSYS_ROCM_DOMAINS=hip_runtime_api,kernel_dispatch,memory_copy,rocdecode_api" "ROCPROFSYS_AMD_SMI_METRICS=busy,temp,power,vcn_activity,mem_usage" - "ROCPROFSYS_SAMPLING_CPUS=none") + "ROCPROFSYS_SAMPLING_CPUS=none" +) set(_jpeg_decode_environment "${_base_environment}" "ROCPROFSYS_ROCM_DOMAINS=hip_runtime_api,kernel_dispatch,memory_copy,rocjpeg_api" "ROCPROFSYS_AMD_SMI_METRICS=busy,temp,power,jpeg_activity,mem_usage" - "ROCPROFSYS_SAMPLING_CPUS=none") + "ROCPROFSYS_SAMPLING_CPUS=none" +) rocprofiler_systems_get_gfx_archs(MI300_DETECTED GFX_MATCH "gfx9[4-9][A-Fa-f0-9]" ECHO) @@ -54,14 +56,16 @@ rocprofiler_systems_add_test( GPU ON ENVIRONMENT "${_video_decode_environment}" RUN_ARGS -i ${PROJECT_BINARY_DIR}/videos -t 1 - LABELS "decode") + LABELS "decode" +) rocprofiler_systems_add_validation_test( NAME video-decode-sampling PERFETTO_METRIC "rocm_rocdecode_api" PERFETTO_FILE "perfetto-trace.proto" LABELS "decode" - ARGS -l rocDecCreateVideoParser -c 2 -d 1 ${VCN_COUNTER_NAMES_ARG} -p) + ARGS -l rocDecCreateVideoParser -c 2 -d 1 ${VCN_COUNTER_NAMES_ARG} -p +) # -------------------------------------------------------------------------------------- # # @@ -76,11 +80,13 @@ rocprofiler_systems_add_test( GPU ON ENVIRONMENT "${_jpeg_decode_environment}" RUN_ARGS -i ${PROJECT_BINARY_DIR}/images -b 32 - LABELS "decode") + LABELS "decode" +) rocprofiler_systems_add_validation_test( NAME jpeg-decode-sampling PERFETTO_METRIC "rocm_rocjpeg_api" PERFETTO_FILE "perfetto-trace.proto" LABELS "decode" - ARGS -l rocJpegCreate -c 1 -d 1 ${JPEG_COUNTER_NAMES_ARG} -p) + ARGS -l rocJpegCreate -c 1 -d 1 ${JPEG_COUNTER_NAMES_ARG} -p +) diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-fork-tests.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-fork-tests.cmake index 6c97094e45..700e8d4cd6 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-fork-tests.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-fork-tests.cmake @@ -38,4 +38,5 @@ rocprofiler_systems_add_test( REWRITE_RUN_PASS_REGEX "fork.. called on PID" SAMPLING_FAIL_REGEX "(${ROCPROFSYS_ABORT_FAIL_REGEX})" RUNTIME_FAIL_REGEX "(${ROCPROFSYS_ABORT_FAIL_REGEX})" - REWRITE_RUN_FAIL_REGEX "(${ROCPROFSYS_ABORT_FAIL_REGEX})") + REWRITE_RUN_FAIL_REGEX "(${ROCPROFSYS_ABORT_FAIL_REGEX})" +) diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-instrument-tests.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-instrument-tests.cmake index 9979ed3faf..407eb1a401 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-instrument-tests.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-instrument-tests.cmake @@ -45,7 +45,8 @@ rocprofiler_systems_add_test( ENVIRONMENT "${_base_environment};ROCPROFSYS_COUT_OUTPUT=ON" BASELINE_PASS_REGEX "number of calls made = 17" REWRITE_PASS_REGEX "\\[function\\]\\[Forcing\\] caller-include-regex :: 'outer'" - REWRITE_RUN_PASS_REGEX ">>> ._outer ([ \\|]+) 17") + REWRITE_RUN_PASS_REGEX ">>> ._outer ([ \\|]+) 17" +) rocprofiler_systems_add_test( NAME parallel-overhead @@ -62,7 +63,8 @@ rocprofiler_systems_add_test( return args RUN_ARGS 10 ${NUM_THREADS} 1000 - ENVIRONMENT "${_base_environment}") + ENVIRONMENT "${_base_environment}" +) rocprofiler_systems_add_test( SKIP_BASELINE SKIP_RUNTIME @@ -73,4 +75,4 @@ rocprofiler_systems_add_test( RUN_ARGS 10 4 1000 ENVIRONMENT "${_lock_environment};ROCPROFSYS_FLAT_PROFILE=ON;ROCPROFSYS_PROFILE=OFF;ROCPROFSYS_TRACE=ON;ROCPROFSYS_SAMPLING_KEEP_INTERNAL=OFF" - ) +) diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-kokkos-tests.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-kokkos-tests.cmake index d7e7fa1828..750efee537 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-kokkos-tests.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-kokkos-tests.cmake @@ -50,7 +50,8 @@ rocprofiler_systems_add_test( ENVIRONMENT "${_base_environment};ROCPROFSYS_USE_KOKKOSP=ON;ROCPROFSYS_COUT_OUTPUT=ON;ROCPROFSYS_SAMPLING_FREQ=50;ROCPROFSYS_KOKKOSP_PREFIX=[kokkos];KOKKOS_TOOLS_LIBS=librocprof-sys-dl.so" REWRITE_RUN_PASS_REGEX "\\|_\\[kokkos\\] [a-zA-Z]" - RUNTIME_PASS_REGEX "\\|_\\[kokkos\\] [a-zA-Z]") + RUNTIME_PASS_REGEX "\\|_\\[kokkos\\] [a-zA-Z]" +) rocprofiler_systems_add_test( SKIP_RUNTIME SKIP_REWRITE @@ -63,7 +64,8 @@ rocprofiler_systems_add_test( RUN_ARGS -i 10 -s 20 -p ENVIRONMENT "${_base_environment};ROCPROFSYS_USE_KOKKOSP=ON;ROCPROFSYS_COUT_OUTPUT=ON;ROCPROFSYS_SAMPLING_FREQ=50;ROCPROFSYS_KOKKOSP_PREFIX=[kokkos];KOKKOS_TOOLS_LIBS=librocprof-sys.so" - BASELINE_PASS_REGEX "\\|_\\[kokkos\\] [a-zA-Z]") + BASELINE_PASS_REGEX "\\|_\\[kokkos\\] [a-zA-Z]" +) rocprofiler_systems_add_test( SKIP_RUNTIME SKIP_REWRITE @@ -76,7 +78,8 @@ rocprofiler_systems_add_test( RUN_ARGS -i 10 -s 20 -p ENVIRONMENT "${_base_environment};ROCPROFSYS_USE_KOKKOSP=ON;ROCPROFSYS_COUT_OUTPUT=ON;ROCPROFSYS_SAMPLING_FREQ=50;ROCPROFSYS_KOKKOSP_PREFIX=[kokkos];KOKKOS_TOOLS_LIBS=librocprof-sys-dl.so" - BASELINE_PASS_REGEX "\\|_\\[kokkos\\] [a-zA-Z]") + BASELINE_PASS_REGEX "\\|_\\[kokkos\\] [a-zA-Z]" +) rocprofiler_systems_add_test( SKIP_BASELINE @@ -99,7 +102,8 @@ rocprofiler_systems_add_test( -ME [==[lib(gomp|m-)]==] RUN_ARGS -i 10 -s 20 -p - ENVIRONMENT "${_base_environment};ROCPROFSYS_USE_KOKKOSP=ON") + ENVIRONMENT "${_base_environment};ROCPROFSYS_USE_KOKKOSP=ON" +) rocprofiler_systems_add_test( SKIP_BASELINE @@ -121,7 +125,8 @@ rocprofiler_systems_add_test( -ME [==[libgomp]==] RUN_ARGS -i 10 -s 20 -p - ENVIRONMENT "${_perfetto_environment};ROCPROFSYS_USE_KOKKOSP=OFF") + ENVIRONMENT "${_perfetto_environment};ROCPROFSYS_USE_KOKKOSP=OFF" +) rocprofiler_systems_add_test( NAME lulesh-timemory @@ -143,4 +148,5 @@ rocprofiler_systems_add_test( ROCPROFSYS_TIMEMORY_COMPONENTS="wall_clock peak_rss" RUN_ARGS -i 10 -s 20 -p ENVIRONMENT "${_timemory_environment};ROCPROFSYS_USE_KOKKOSP=OFF" - REWRITE_FAIL_REGEX "0 instrumented loops in procedure") + REWRITE_FAIL_REGEX "0 instrumented loops in procedure" +) diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-mpi-tests.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-mpi-tests.cmake index cf1f9ff4a2..9ac89e096e 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-mpi-tests.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-mpi-tests.cmake @@ -52,7 +52,7 @@ rocprofiler_systems_add_test( "(/[A-Za-z-]+/perfetto-trace-0.proto).*(/[A-Za-z-]+/wall_clock-0.txt')" REWRITE_RUN_FAIL_REGEX "(perfetto-trace|trip_count|sampling_percent|sampling_cpu_clock|sampling_wall_clock|wall_clock)-[0-9][0-9]+.(json|txt|proto)|ROCPROFSYS_ABORT_FAIL_REGEX" - ) +) rocprofiler_systems_add_test( SKIP_RUNTIME @@ -75,7 +75,7 @@ rocprofiler_systems_add_test( "${_flat_environment};ROCPROFSYS_USE_SAMPLING=OFF;ROCPROFSYS_STRICT_CONFIG=OFF;ROCPROFSYS_USE_MPIP=ON" REWRITE_RUN_PASS_REGEX ">>> mpi-flat-mpip.inst(.*\n.*)>>> MPI_Init_thread(.*\n.*)>>> pthread_create(.*\n.*)>>> MPI_Comm_size(.*\n.*)>>> MPI_Comm_rank(.*\n.*)>>> MPI_Barrier(.*\n.*)>>> MPI_Alltoall" - ) +) rocprofiler_systems_add_test( SKIP_RUNTIME @@ -97,7 +97,7 @@ rocprofiler_systems_add_test( ENVIRONMENT "${_flat_environment};ROCPROFSYS_USE_SAMPLING=OFF" REWRITE_RUN_PASS_REGEX ">>> mpi-flat.inst(.*\n.*)>>> MPI_Init_thread(.*\n.*)>>> pthread_create(.*\n.*)>>> MPI_Comm_size(.*\n.*)>>> MPI_Comm_rank(.*\n.*)>>> MPI_Barrier(.*\n.*)>>> MPI_Alltoall" - ) +) set(_mpip_environment "ROCPROFSYS_TRACE=ON" @@ -111,7 +111,8 @@ set(_mpip_environment "ROCPROFSYS_VERBOSE=2" "ROCPROFSYS_DL_VERBOSE=2" "${_test_openmp_env}" - "${_test_library_path}") + "${_test_library_path}" +) set(_mpip_all2all_environment "ROCPROFSYS_TRACE=ON" @@ -125,9 +126,19 @@ set(_mpip_all2all_environment "ROCPROFSYS_VERBOSE=3" "ROCPROFSYS_DL_VERBOSE=3" "${_test_openmp_env}" - "${_test_library_path}") + "${_test_library_path}" +) -foreach(_EXAMPLE all2all allgather allreduce bcast reduce scatter-gather send-recv) +foreach( + _EXAMPLE + all2all + allgather + allreduce + bcast + reduce + scatter-gather + send-recv +) if("${_mpip_${_EXAMPLE}_environment}" STREQUAL "") set(_mpip_${_EXAMPLE}_environment "${_mpip_environment}") endif() @@ -140,5 +151,6 @@ foreach(_EXAMPLE all2all allgather allreduce bcast reduce scatter-gather send-re LABELS "mpip" REWRITE_ARGS -e -v 2 --label file line --min-instructions 0 RUN_ARGS 30 - ENVIRONMENT "${_mpip_${_EXAMPLE}_environment}") + ENVIRONMENT "${_mpip_${_EXAMPLE}_environment}" + ) endforeach() diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-nic-perf.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-nic-perf.cmake index 88e6ceeb5f..e0b7fa892b 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-nic-perf.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-nic-perf.cmake @@ -30,7 +30,8 @@ execute_process( COMMAND "${CMAKE_SOURCE_DIR}/tests/get_default_nic.sh" OUTPUT_STRIP_TRAILING_WHITESPACE - OUTPUT_VARIABLE _network_interface) + OUTPUT_VARIABLE _network_interface +) message(STATUS "Default network interface is ${_network_interface}") @@ -46,23 +47,28 @@ set(_nic_perf_environment "ROCPROFSYS_TIMEMORY_COMPONENTS=wall_clock,papi_array,network_stats" "ROCPROFSYS_NETWORK_INTERFACE=${_network_interface}" "ROCPROFSYS_PAPI_EVENTS=net:::${_network_interface}:tx:byte net:::${_network_interface}:rx:byte net:::${_network_interface}:rx:packet net:::${_network_interface}:tx:packet" - "ROCPROFSYS_SAMPLING_DELAY=0.05") + "ROCPROFSYS_SAMPLING_DELAY=0.05" +) # Set _download_url to a large file that will give rocprof-sys-sample time to collect NIC # performance data (but not too large, because each test will time out after 2 min). set(_download_url "https://github.com/ROCm/rocprofiler-systems/releases/download/rocm-6.4.1/rocprofiler-systems-1.0.1-ubuntu-22.04-ROCm-60400-PAPI-OMPT-Python3.sh" - ) +) # Run the NIC performance test add_test( NAME nic-performance - COMMAND $ -- wget --no-check-certificate - ${_download_url} -O /tmp/rocprofiler-systems.test.bin - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + COMMAND + $ -- wget --no-check-certificate + ${_download_url} -O /tmp/rocprofiler-systems.test.bin + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +) -set_tests_properties(nic-performance PROPERTIES ENVIRONMENT "${_nic_perf_environment}" - TIMEOUT 120 LABELS "network") +set_tests_properties( + nic-performance + PROPERTIES ENVIRONMENT "${_nic_perf_environment}" TIMEOUT 120 LABELS "network" +) # Validate the perfetto file generated from NIC performance test output add_test( @@ -73,22 +79,22 @@ add_test( ${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/nic-performance/perfetto-trace.proto --counter-names rx:byte rx:packet tx:byte tx:packet -t /opt/trace_processor/bin/trace_processor_shell -p - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +) set(_test_pass_regex - "rocprof-sys-tests-output/nic-performance/perfetto-trace.proto validated") + "rocprof-sys-tests-output/nic-performance/perfetto-trace.proto validated" +) set(_test_fail_regex - "Failure validating rocprof-sys-tests-output/nic-performance/perfetto-trace.proto") + "Failure validating rocprof-sys-tests-output/nic-performance/perfetto-trace.proto" +) set_tests_properties( validate-nic-performance-perfetto - PROPERTIES TIMEOUT - 30 - LABELS - "network" - DEPENDS - nic-performance - PASS_REGULAR_EXPRESSION - ${_test_pass_regex} - FAIL_REGULAR_EXPRESSION - ${_test_fail_regex}) + PROPERTIES + TIMEOUT 30 + LABELS "network" + DEPENDS nic-performance + PASS_REGULAR_EXPRESSION ${_test_pass_regex} + FAIL_REGULAR_EXPRESSION ${_test_fail_regex} +) diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-openmp-tests.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-openmp-tests.cmake index 7bd20a65f4..c087d81717 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-openmp-tests.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-openmp-tests.cmake @@ -44,7 +44,8 @@ rocprofiler_systems_add_test( "${_ompt_environment};ROCPROFSYS_USE_SAMPLING=OFF;ROCPROFSYS_COUT_OUTPUT=ON" REWRITE_RUN_PASS_REGEX "${_OMPT_PASS_REGEX}" RUNTIME_PASS_REGEX "${_OMPT_PASS_REGEX}" - REWRITE_FAIL_REGEX "0 instrumented loops in procedure") + REWRITE_FAIL_REGEX "0 instrumented loops in procedure" +) rocprofiler_systems_add_test( SKIP_RUNTIME @@ -58,7 +59,8 @@ rocprofiler_systems_add_test( ENVIRONMENT "${_ompt_environment};ROCPROFSYS_USE_SAMPLING=ON;ROCPROFSYS_SAMPLING_FREQ=50;ROCPROFSYS_COUT_OUTPUT=ON" REWRITE_RUN_PASS_REGEX "${_OMPT_PASS_REGEX}" - REWRITE_FAIL_REGEX "0 instrumented loops in procedure") + REWRITE_FAIL_REGEX "0 instrumented loops in procedure" +) rocprofiler_systems_add_test( SKIP_RUNTIME SKIP_REWRITE @@ -67,7 +69,8 @@ rocprofiler_systems_add_test( GPU ON LABELS "openmp;openmp-target" ENVIRONMENT - "${_ompt_environment};ROCPROFSYS_ROCM_DOMAINS=hip_runtime_api,kernel_dispatch") + "${_ompt_environment};ROCPROFSYS_ROCM_DOMAINS=hip_runtime_api,kernel_dispatch" +) rocprofiler_systems_add_validation_test( NAME openmp-target-sampling @@ -86,7 +89,8 @@ rocprofiler_systems_add_validation_test( 0 0 0 - -p) + -p +) set(_ompt_sampling_environ "${_ompt_environment}" @@ -101,7 +105,8 @@ set(_ompt_sampling_environ "ROCPROFSYS_SAMPLING_REALTIME=ON" "ROCPROFSYS_SAMPLING_CPUTIME_FREQ=1000" "ROCPROFSYS_SAMPLING_REALTIME_FREQ=500" - "ROCPROFSYS_MONOCHROME=ON") + "ROCPROFSYS_MONOCHROME=ON" +) set(_ompt_sample_no_tmpfiles_environ "${_ompt_environment}" @@ -113,17 +118,18 @@ set(_ompt_sample_no_tmpfiles_environ "ROCPROFSYS_SAMPLING_REALTIME=OFF" "ROCPROFSYS_SAMPLING_CPUTIME_FREQ=700" "ROCPROFSYS_USE_TEMPORARY_FILES=OFF" - "ROCPROFSYS_MONOCHROME=ON") + "ROCPROFSYS_MONOCHROME=ON" +) set(_ompt_sampling_samp_regex "Sampler for thread 0 will be triggered 1000.0x per second of CPU-time(.*)Sampler for thread 0 will be triggered 500.0x per second of wall-time(.*)Sampling will be disabled after 0.250000 seconds(.*)Sampling duration of 0.250000 seconds has elapsed. Shutting down sampling" - ) +) set(_ompt_sampling_file_regex "sampling-duration-sampling/sampling_percent.(json|txt)(.*)sampling-duration-sampling/sampling_cpu_clock.(json|txt)(.*)sampling-duration-sampling/sampling_wall_clock.(json|txt)" - ) +) set(_notmp_sampling_file_regex "sampling-no-tmp-files-sampling/sampling_percent.(json|txt)(.*)sampling-no-tmp-files-sampling/sampling_cpu_clock.(json|txt)(.*)sampling-no-tmp-files-sampling/sampling_wall_clock.(json|txt)" - ) +) rocprofiler_systems_add_test( SKIP_BASELINE SKIP_RUNTIME SKIP_REWRITE @@ -131,7 +137,8 @@ rocprofiler_systems_add_test( TARGET openmp-cg LABELS "openmp;sampling-duration" ENVIRONMENT "${_ompt_sampling_environ}" - SAMPLING_PASS_REGEX "${_ompt_sampling_samp_regex}(.*)${_ompt_sampling_file_regex}") + SAMPLING_PASS_REGEX "${_ompt_sampling_samp_regex}(.*)${_ompt_sampling_file_regex}" +) rocprofiler_systems_add_test( SKIP_BASELINE SKIP_RUNTIME SKIP_REWRITE @@ -139,7 +146,8 @@ rocprofiler_systems_add_test( TARGET openmp-lu LABELS "openmp;sampling-duration" ENVIRONMENT "${_ompt_sampling_environ}" - SAMPLING_PASS_REGEX "${_ompt_sampling_samp_regex}(.*)${_ompt_sampling_file_regex}") + SAMPLING_PASS_REGEX "${_ompt_sampling_samp_regex}(.*)${_ompt_sampling_file_regex}" +) rocprofiler_systems_add_test( SKIP_BASELINE SKIP_RUNTIME SKIP_REWRITE @@ -147,4 +155,5 @@ rocprofiler_systems_add_test( TARGET openmp-cg LABELS "openmp;no-tmp-files" ENVIRONMENT "${_ompt_sample_no_tmpfiles_environ}" - SAMPLING_PASS_REGEX "${_notmp_sampling_file_regex}") + SAMPLING_PASS_REGEX "${_notmp_sampling_file_regex}" +) diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-overflow-tests.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-overflow-tests.cmake index 5abd9003aa..4b8f6a75fd 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-overflow-tests.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-overflow-tests.cmake @@ -34,11 +34,14 @@ set(_overflow_environment "ROCPROFSYS_SAMPLING_OVERFLOW=ON" "ROCPROFSYS_SAMPLING_OVERFLOW_EVENT=PERF_COUNT_SW_CPU_CLOCK" "ROCPROFSYS_SAMPLING_OVERFLOW_FREQ=10000" - "ROCPROFSYS_DEBUG_THREADING_GET_ID=ON") + "ROCPROFSYS_DEBUG_THREADING_GET_ID=ON" +) -if(rocprofiler_systems_perf_event_paranoid LESS_EQUAL 3 - OR rocprofiler_systems_cap_sys_admin EQUAL 0 - OR rocprofiler_systems_cap_perfmon EQUAL 0) +if( + rocprofiler_systems_perf_event_paranoid LESS_EQUAL 3 + OR rocprofiler_systems_cap_sys_admin EQUAL 0 + OR rocprofiler_systems_cap_perfmon EQUAL 0 +) rocprofiler_systems_add_test( SKIP_BASELINE NAME overflow @@ -50,5 +53,6 @@ if(rocprofiler_systems_perf_event_paranoid LESS_EQUAL 3 LABELS "perf;overflow" SAMPLING_PASS_REGEX "sampling_wall_clock.txt" RUNTIME_PASS_REGEX "sampling_wall_clock.txt" - REWRITE_RUN_PASS_REGEX "sampling_wall_clock.txt") + REWRITE_RUN_PASS_REGEX "sampling_wall_clock.txt" + ) endif() diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-pthread-tests.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-pthread-tests.cmake index 89d4b4a65b..cfeb05dece 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-pthread-tests.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-pthread-tests.cmake @@ -39,7 +39,7 @@ rocprofiler_systems_add_test( "wall_clock .*\\|_pthread_create .* 4 .*\\|_pthread_mutex_lock .* 1000 .*\\|_pthread_mutex_unlock .* 1000 .*\\|_pthread_mutex_lock .* 1000 .*\\|_pthread_mutex_unlock .* 1000 .*\\|_pthread_mutex_lock .* 1000 .*\\|_pthread_mutex_unlock .* 1000 .*\\|_pthread_mutex_lock .* 1000 .*\\|_pthread_mutex_unlock .* 1000" RUNTIME_PASS_REGEX "wall_clock .*\\|_pthread_create .* 4 .*\\|_pthread_mutex_lock .* 1000 .*\\|_pthread_mutex_unlock .* 1000 .*\\|_pthread_mutex_lock .* 1000 .*\\|_pthread_mutex_unlock .* 1000 .*\\|_pthread_mutex_lock .* 1000 .*\\|_pthread_mutex_unlock .* 1000 .*\\|_pthread_mutex_lock .* 1000 .*\\|_pthread_mutex_unlock .* 1000" - ) +) rocprofiler_systems_add_test( SKIP_RUNTIME @@ -53,4 +53,4 @@ rocprofiler_systems_add_test( "${_lock_environment};ROCPROFSYS_FLAT_PROFILE=ON;ROCPROFSYS_PROFILE=ON;ROCPROFSYS_TRACE=OFF;ROCPROFSYS_SAMPLING_KEEP_INTERNAL=OFF" REWRITE_RUN_PASS_REGEX "start_thread (.*) 4 (.*) pthread_mutex_lock (.*) 4000 (.*) pthread_mutex_unlock (.*) 4000" - ) +) diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-python-tests.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-python-tests.cmake index d281e5b5f5..d1e76e6e83 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-python-tests.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-python-tests.cmake @@ -38,7 +38,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) rocprofiler_systems_find_python( _PYTHON ROOT_DIR "${_PYTHON_ROOT_DIR}" - COMPONENTS Interpreter) + COMPONENTS Interpreter + ) # ---------------------------------------------------------------------------------- # # python tests @@ -50,7 +51,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) FILE ${CMAKE_SOURCE_DIR}/examples/python/external.py PROFILE_ARGS "--label" "file" RUN_ARGS -v 10 -n 5 - ENVIRONMENT "${_python_environment}") + ENVIRONMENT "${_python_environment}" + ) rocprofiler_systems_add_python_test( NAME python-external-exclude-inefficient @@ -59,7 +61,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) FILE ${CMAKE_SOURCE_DIR}/examples/python/external.py PROFILE_ARGS -E "^inefficient$" RUN_ARGS -v 10 -n 5 - ENVIRONMENT "${_python_environment}") + ENVIRONMENT "${_python_environment}" + ) rocprofiler_systems_add_python_test( NAME python-builtin @@ -68,7 +71,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) FILE ${CMAKE_SOURCE_DIR}/examples/python/builtin.py PROFILE_ARGS "-b" "--label" "file" "line" RUN_ARGS -v 10 -n 5 - ENVIRONMENT "${_python_environment}") + ENVIRONMENT "${_python_environment}" + ) rocprofiler_systems_add_python_test( NAME python-builtin-noprofile @@ -77,7 +81,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) FILE ${CMAKE_SOURCE_DIR}/examples/python/noprofile.py PROFILE_ARGS "-b" "--label" "file" RUN_ARGS -v 15 -n 5 - ENVIRONMENT "${_python_environment}") + ENVIRONMENT "${_python_environment}" + ) rocprofiler_systems_add_python_test( STANDALONE @@ -86,7 +91,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) PYTHON_VERSION ${_VERSION} FILE ${CMAKE_SOURCE_DIR}/examples/python/source.py RUN_ARGS -v 5 -n 5 -s 3 - ENVIRONMENT "${_python_environment}") + ENVIRONMENT "${_python_environment}" + ) rocprofiler_systems_add_python_test( STANDALONE @@ -104,16 +110,14 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) code-coverage-basic-blocks-binary-rewrite-run code-coverage-basic-blocks-hybrid-runtime-instrument LABELS "code-coverage" - ENVIRONMENT "${_python_environment}") + ENVIRONMENT "${_python_environment}" + ) # ---------------------------------------------------------------------------------- # # python output tests # ---------------------------------------------------------------------------------- # if(CMAKE_VERSION VERSION_LESS "3.18.0") - find_program( - ROCPROFSYS_CAT_EXE - NAMES cat - PATH_SUFFIXES bin) + find_program(ROCPROFSYS_CAT_EXE NAMES cat PATH_SUFFIXES bin) if(ROCPROFSYS_CAT_EXE) set(ROCPROFSYS_CAT_COMMAND ${ROCPROFSYS_CAT_EXE}) @@ -131,7 +135,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) PASS_REGEX "(\\\[compile\\\]).*(\\\| \\\|0>>> \\\[run\\\]\\\[external.py\\\]).*(\\\| \\\|0>>> \\\|_\\\[fib\\\]\\\[external.py\\\]).*(\\\| \\\|0>>> \\\|_\\\[inefficient\\\]\\\[external.py\\\])" DEPENDS python-external-${_VERSION} - ENVIRONMENT "${_python_environment}") + ENVIRONMENT "${_python_environment}" + ) rocprofiler_systems_add_python_test( NAME python-external-exclude-inefficient-check @@ -140,7 +145,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) FILE rocprof-sys-tests-output/python-external-exclude-inefficient/${_VERSION}/trip_count.txt FAIL_REGEX "(\\\|_inefficient).*(\\\|_sum)|ROCPROFSYS_ABORT_FAIL_REGEX" DEPENDS python-external-exclude-inefficient-${_VERSION} - ENVIRONMENT "${_python_environment}") + ENVIRONMENT "${_python_environment}" + ) rocprofiler_systems_add_python_test( NAME python-builtin-check @@ -149,7 +155,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) FILE rocprof-sys-tests-output/python-builtin/${_VERSION}/trip_count.txt PASS_REGEX "\\\[inefficient\\\]\\\[builtin.py:14\\\]" DEPENDS python-builtin-${_VERSION} - ENVIRONMENT "${_python_environment}") + ENVIRONMENT "${_python_environment}" + ) rocprofiler_systems_add_python_test( NAME python-builtin-noprofile-check @@ -159,17 +166,23 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) PASS_REGEX ".(run)..(noprofile.py)." FAIL_REGEX ".(fib|inefficient)..(noprofile.py).|ROCPROFSYS_ABORT_FAIL_REGEX" DEPENDS python-builtin-noprofile-${_VERSION} - ENVIRONMENT "${_python_environment}") + ENVIRONMENT "${_python_environment}" + ) else() rocprofiler_systems_message( WARNING "Neither 'cat' nor 'cmake -E cat' are available. Python source checks are disabled" - ) + ) endif() function(ROCPROFILER_SYSTEMS_ADD_PYTHON_VALIDATION_TEST) - cmake_parse_arguments(TEST "" "NAME;TIMEMORY_METRIC;TIMEMORY_FILE;PERFETTO_FILE" - "ARGS;PERFETTO_METRIC" ${ARGN}) + cmake_parse_arguments( + TEST + "" + "NAME;TIMEMORY_METRIC;TIMEMORY_FILE;PERFETTO_FILE" + "ARGS;PERFETTO_METRIC" + ${ARGN} + ) rocprofiler_systems_add_python_test( NAME ${TEST_NAME}-validate-timemory @@ -181,7 +194,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) DEPENDS ${TEST_NAME}-${_VERSION} PASS_REGEX "rocprof-sys-tests-output/${TEST_NAME}/${_VERSION}/${TEST_TIMEMORY_FILE} validated" - ENVIRONMENT "${_python_environment}") + ENVIRONMENT "${_python_environment}" + ) rocprofiler_systems_add_python_test( NAME ${TEST_NAME}-validate-perfetto @@ -194,7 +208,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) DEPENDS ${TEST_NAME}-${_VERSION} PASS_REGEX "rocprof-sys-tests-output/${TEST_NAME}/${_VERSION}/${TEST_PERFETTO_FILE} validated" - ENVIRONMENT "${_python_environment}") + ENVIRONMENT "${_python_environment}" + ) endfunction() set(python_source_labels @@ -206,7 +221,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) fib fib inefficient - _sum) + _sum + ) set(python_source_count 5 3 @@ -216,7 +232,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) 18 6 3 - 3) + 3 + ) set(python_source_depth 0 1 @@ -226,7 +243,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) 5 6 2 - 3) + 3 + ) set(python_source_categories python user) @@ -237,7 +255,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) PERFETTO_FILE "perfetto-trace.proto" PERFETTO_METRIC ${python_source_categories} ARGS -l ${python_source_labels} -c ${python_source_count} -d - ${python_source_depth}) + ${python_source_depth} + ) set(python_builtin_labels [run][builtin.py:28] @@ -251,7 +270,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) [fib][builtin.py:10] [fib][builtin.py:10] [fib][builtin.py:10] - [inefficient][builtin.py:14]) + [inefficient][builtin.py:14] + ) set(python_builtin_count 5 5 @@ -264,7 +284,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) 220 80 10 - 5) + 5 + ) set(python_builtin_depth 0 1 @@ -277,7 +298,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) 8 9 10 - 1) + 1 + ) rocprofiler_systems_add_python_validation_test( NAME python-builtin @@ -286,6 +308,7 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) PERFETTO_METRIC "python" PERFETTO_FILE "perfetto-trace.proto" ARGS -l ${python_builtin_labels} -c ${python_builtin_count} -d - ${python_builtin_depth}) + ${python_builtin_depth} + ) math(EXPR _INDEX "${_INDEX} + 1") endforeach() diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-rccl-tests.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-rccl-tests.cmake index 3e241a0ee3..e1cb1dcba8 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-rccl-tests.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-rccl-tests.cmake @@ -81,12 +81,14 @@ foreach(_TARGET ${RCCL_TEST_TARGETS}) -z -s 1 - ENVIRONMENT "${_rccl_environment}") + ENVIRONMENT "${_rccl_environment}" + ) rocprofiler_systems_add_validation_test( NAME rccl-test-${_NAME}-sampling PERFETTO_METRIC "rocm_rccl_api" PERFETTO_FILE "perfetto-trace.proto" LABELS "rccl-tests;rcclp" - ARGS --counter-names "RCCL Comm" -p) + ARGS --counter-names "RCCL Comm" -p + ) endforeach() diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-rocm-tests.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-rocm-tests.cmake index 68d6685893..37c383e79f 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-rocm-tests.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-rocm-tests.cmake @@ -45,7 +45,8 @@ rocprofiler_systems_add_test( -E uniform_int_distribution ENVIRONMENT "${_base_environment}" - RUNTIME_TIMEOUT 480) + RUNTIME_TIMEOUT 480 +) rocprofiler_systems_add_test( SKIP_REWRITE SKIP_RUNTIME @@ -55,7 +56,8 @@ rocprofiler_systems_add_test( GPU ON NUM_PROCS 1 RUN_ARGS 1 2 2 - ENVIRONMENT "${_base_environment}") + ENVIRONMENT "${_base_environment}" +) rocprofiler_systems_add_test( SKIP_BASELINE SKIP_RUNTIME @@ -79,7 +81,8 @@ rocprofiler_systems_add_test( uniform_int_distribution RUN_ARGS 2 100 50 ENVIRONMENT "${_base_environment}" - REWRITE_FAIL_REGEX "0 instrumented loops in procedure transpose") + REWRITE_FAIL_REGEX "0 instrumented loops in procedure transpose" +) if(ROCPROFSYS_USE_ROCM) set(NAVI_REGEX "gfx(10|11|12)[A-Fa-f0-9][A-Fa-f0-9]") @@ -91,12 +94,20 @@ if(ROCPROFSYS_USE_ROCM) set(ROCPROFSYS_COUNTER_NAMES_ARG "SQ_WAVES") else() set(ROCPROFSYS_ROCM_EVENTS_TEST - "GRBM_COUNT,SQ_WAVES,SQ_INSTS_VALU,TA_TA_BUSY:device=0") + "GRBM_COUNT,SQ_WAVES,SQ_INSTS_VALU,TA_TA_BUSY:device=0" + ) set(ROCPROFSYS_FILE_CHECKS - "rocprof-device-0-GRBM_COUNT.txt" "rocprof-device-0-SQ_WAVES.txt" - "rocprof-device-0-SQ_INSTS_VALU.txt" "rocprof-device-0-TA_TA_BUSY.txt") - set(ROCPROFSYS_COUNTER_NAMES_ARG "GRBM_COUNT" "SQ_WAVES" "SQ_INSTS_VALU" - "TA_TA_BUSY") + "rocprof-device-0-GRBM_COUNT.txt" + "rocprof-device-0-SQ_WAVES.txt" + "rocprof-device-0-SQ_INSTS_VALU.txt" + "rocprof-device-0-TA_TA_BUSY.txt" + ) + set(ROCPROFSYS_COUNTER_NAMES_ARG + "GRBM_COUNT" + "SQ_WAVES" + "SQ_INSTS_VALU" + "TA_TA_BUSY" + ) endif() rocprofiler_systems_add_test( @@ -111,19 +122,22 @@ if(ROCPROFSYS_USE_ROCM) ENVIRONMENT "${_base_environment};ROCPROFSYS_ROCM_EVENTS=${ROCPROFSYS_ROCM_EVENTS_TEST}" REWRITE_RUN_PASS_REGEX "${_ROCP_PASS_REGEX}" - SAMPLING_PASS_REGEX "${_ROCP_PASS_REGEX}") + SAMPLING_PASS_REGEX "${_ROCP_PASS_REGEX}" + ) rocprofiler_systems_add_validation_test( NAME transpose-rocprofiler-sampling PERFETTO_FILE "perfetto-trace.proto" ARGS --counter-names ${ROCPROFSYS_COUNTER_NAMES_ARG} -p EXIST_FILES ${ROCPROFSYS_FILE_CHECKS} - LABELS "rocprofiler") + LABELS "rocprofiler" + ) rocprofiler_systems_add_validation_test( NAME transpose-rocprofiler-binary-rewrite PERFETTO_FILE "perfetto-trace.proto" ARGS --counter-names ${ROCPROFSYS_COUNTER_NAMES_ARG} -p EXIST_FILES ${ROCPROFSYS_FILE_CHECKS} - LABELS "rocprofiler") + LABELS "rocprofiler" + ) endif() diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-testing.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-testing.cmake index 15d4d42584..98886fe90e 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-testing.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-testing.cmake @@ -31,8 +31,13 @@ if(EXISTS /etc/os-release AND NOT IS_DIRECTORY /etc/os-release) if(_OS_RELEASE_RAW) string(REPLACE "\"" "" _OS_RELEASE_RAW "${_OS_RELEASE_RAW}") string(REPLACE "-" " " _OS_RELEASE_RAW "${_OS_RELEASE_RAW}") - string(REGEX REPLACE "NAME=.*\nVERSION=([0-9]+)\.([0-9]+).*\nID=([a-z]+).*" - "\\3-\\1.\\2" _OS_RELEASE "${_OS_RELEASE_RAW}") + string( + REGEX REPLACE + "NAME=.*\nVERSION=([0-9]+)\.([0-9]+).*\nID=([a-z]+).*" + "\\3-\\1.\\2" + _OS_RELEASE + "${_OS_RELEASE_RAW}" + ) endif() unset(_OS_RELEASE_RAW) endif() @@ -41,7 +46,7 @@ rocprofiler_systems_message(STATUS "OS release: ${_OS_RELEASE}") include(ProcessorCount) if(NOT DEFINED NUM_PROCS_REAL) - processorcount(NUM_PROCS_REAL) + ProcessorCount(NUM_PROCS_REAL) endif() if(NOT DEFINED NUM_PROCS) @@ -64,13 +69,20 @@ if(MAX_CAUSAL_ITERATIONS GREATER 100) endif() set(_test_library_path - "LD_LIBRARY_PATH=${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}:$ENV{LD_LIBRARY_PATH}") + "LD_LIBRARY_PATH=${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}:$ENV{LD_LIBRARY_PATH}" +) set(_test_openmp_env "OMP_PROC_BIND=spread" "OMP_PLACES=threads" "OMP_NUM_THREADS=2") set(_base_environment - "ROCPROFSYS_TRACE=ON" "ROCPROFSYS_PROFILE=ON" "ROCPROFSYS_USE_SAMPLING=ON" - "ROCPROFSYS_USE_PROCESS_SAMPLING=ON" "ROCPROFSYS_TIME_OUTPUT=OFF" - "ROCPROFSYS_FILE_OUTPUT=ON" "${_test_openmp_env}" "${_test_library_path}") + "ROCPROFSYS_TRACE=ON" + "ROCPROFSYS_PROFILE=ON" + "ROCPROFSYS_USE_SAMPLING=ON" + "ROCPROFSYS_USE_PROCESS_SAMPLING=ON" + "ROCPROFSYS_TIME_OUTPUT=OFF" + "ROCPROFSYS_FILE_OUTPUT=ON" + "${_test_openmp_env}" + "${_test_library_path}" +) set(_flat_environment "ROCPROFSYS_TRACE=ON" @@ -84,7 +96,8 @@ set(_flat_environment "ROCPROFSYS_SAMPLING_FREQ=50" "ROCPROFSYS_TIMEMORY_COMPONENTS=wall_clock,trip_count" "${_test_openmp_env}" - "${_test_library_path}") + "${_test_library_path}" +) set(_lock_environment "ROCPROFSYS_USE_SAMPLING=ON" @@ -98,7 +111,8 @@ set(_lock_environment "ROCPROFSYS_TIME_OUTPUT=OFF" "ROCPROFSYS_TIMELINE_PROFILE=OFF" "ROCPROFSYS_VERBOSE=2" - "${_test_library_path}") + "${_test_library_path}" +) set(_ompt_environment "ROCPROFSYS_TRACE=ON" @@ -107,7 +121,8 @@ set(_ompt_environment "ROCPROFSYS_USE_OMPT=ON" "ROCPROFSYS_TIMEMORY_COMPONENTS=wall_clock,trip_count,peak_rss" "${_test_openmp_env}" - "${_test_library_path}") + "${_test_library_path}" +) set(_perfetto_environment "ROCPROFSYS_TRACE=ON" @@ -118,7 +133,8 @@ set(_perfetto_environment "ROCPROFSYS_PERFETTO_BACKEND=inprocess" "ROCPROFSYS_PERFETTO_FILL_POLICY=ring_buffer" "${_test_openmp_env}" - "${_test_library_path}") + "${_test_library_path}" +) set(_timemory_environment "ROCPROFSYS_TRACE=OFF" @@ -128,13 +144,18 @@ set(_timemory_environment "ROCPROFSYS_TIME_OUTPUT=OFF" "ROCPROFSYS_TIMEMORY_COMPONENTS=wall_clock,trip_count,peak_rss" "${_test_openmp_env}" - "${_test_library_path}") + "${_test_library_path}" +) set(_test_environment ${_base_environment}) set(_causal_environment - "${_test_openmp_env}" "${_test_library_path}" "ROCPROFSYS_TIME_OUTPUT=OFF" - "ROCPROFSYS_FILE_OUTPUT=ON" "ROCPROFSYS_CAUSAL_RANDOM_SEED=1342342") + "${_test_openmp_env}" + "${_test_library_path}" + "ROCPROFSYS_TIME_OUTPUT=OFF" + "ROCPROFSYS_FILE_OUTPUT=ON" + "ROCPROFSYS_CAUSAL_RANDOM_SEED=1342342" +) set(_python_environment "ROCPROFSYS_TRACE=ON" @@ -146,7 +167,8 @@ set(_python_environment "ROCPROFSYS_USE_PID=OFF" "ROCPROFSYS_TIMEMORY_COMPONENTS=wall_clock,trip_count" "${_test_library_path}" - "PYTHONPATH=${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}") + "PYTHONPATH=${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}" +) set(_attach_environment "ROCPROFSYS_TRACE=ON" @@ -159,7 +181,8 @@ set(_attach_environment "ROCPROFSYS_USE_PID=OFF" "ROCPROFSYS_TIMEMORY_COMPONENTS=wall_clock,trip_count" "OMP_NUM_THREADS=${NUM_PROCS_REAL}" - "${_test_library_path}") + "${_test_library_path}" +) set(_rccl_environment "ROCPROFSYS_TRACE=ON" @@ -171,7 +194,8 @@ set(_rccl_environment "ROCPROFSYS_USE_RCCLP=ON" "ROCPROFSYS_ROCM_DOMAINS=hip_runtime_api,kernel_dispatch,memory_copy" "${_test_openmp_env}" - "${_test_library_path}") + "${_test_library_path}" +) set(_window_environment "ROCPROFSYS_TRACE=ON" @@ -182,7 +206,8 @@ set(_window_environment "ROCPROFSYS_FILE_OUTPUT=ON" "ROCPROFSYS_VERBOSE=2" "${_test_openmp_env}" - "${_test_library_path}") + "${_test_library_path}" +) # -------------------------------------------------------------------------------------- # @@ -190,13 +215,16 @@ set(MPIEXEC_EXECUTABLE_ARGS) option( ROCPROFSYS_CI_MPI_RUN_AS_ROOT "Enabled --allow-run-as-root in MPI tests with OpenMPI. Enable with care! Should only be in docker containers" - OFF) + OFF +) mark_as_advanced(ROCPROFSYS_CI_MPI_RUN_AS_ROOT) if(ROCPROFSYS_CI_MPI_RUN_AS_ROOT) execute_process( COMMAND ${MPIEXEC_EXECUTABLE} --allow-run-as-root --help RESULT_VARIABLE _mpiexec_allow_run_as_root - OUTPUT_QUIET ERROR_QUIET) + OUTPUT_QUIET + ERROR_QUIET + ) if(_mpiexec_allow_run_as_root EQUAL 0) list(APPEND MPIEXEC_EXECUTABLE_ARGS --allow-run-as-root) endif() @@ -205,40 +233,54 @@ endif() execute_process( COMMAND ${MPIEXEC_EXECUTABLE} --oversubscribe -n 1 ls RESULT_VARIABLE _mpiexec_oversubscribe - OUTPUT_QUIET ERROR_QUIET) + OUTPUT_QUIET + ERROR_QUIET +) set(rocprofiler_systems_perf_event_paranoid "4") set(rocprofiler_systems_cap_sys_admin "1") set(rocprofiler_systems_cap_perfmon "1") if(EXISTS "/proc/sys/kernel/perf_event_paranoid") - file(STRINGS "/proc/sys/kernel/perf_event_paranoid" - rocprofiler_systems_perf_event_paranoid LIMIT_COUNT 1) + file( + STRINGS + "/proc/sys/kernel/perf_event_paranoid" + rocprofiler_systems_perf_event_paranoid + LIMIT_COUNT 1 + ) endif() execute_process( - COMMAND ${CMAKE_CXX_COMPILER} -O2 -g -std=c++17 - ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-capchk.cpp -o rocprof-sys-capchk + COMMAND + ${CMAKE_CXX_COMPILER} -O2 -g -std=c++17 + ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-capchk.cpp -o rocprof-sys-capchk WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/bin RESULT_VARIABLE _capchk_compile - OUTPUT_QUIET ERROR_QUIET) + OUTPUT_QUIET + ERROR_QUIET +) if(_capchk_compile EQUAL 0) execute_process( COMMAND ${PROJECT_BINARY_DIR}/bin/rocprof-sys-capchk CAP_SYS_ADMIN effective WORKING_DIRECTORY ${PROJECT_BINARY_DIR} RESULT_VARIABLE rocprofiler_systems_cap_sys_admin - OUTPUT_QUIET ERROR_QUIET) + OUTPUT_QUIET + ERROR_QUIET + ) execute_process( COMMAND ${PROJECT_BINARY_DIR}/bin/rocprof-sys-capchk CAP_PERFMON effective WORKING_DIRECTORY ${PROJECT_BINARY_DIR} RESULT_VARIABLE rocprofiler_systems_cap_perfmon - OUTPUT_QUIET ERROR_QUIET) + OUTPUT_QUIET + ERROR_QUIET + ) endif() rocprofiler_systems_message( - STATUS "perf_event_paranoid: ${rocprofiler_systems_perf_event_paranoid}") + STATUS "perf_event_paranoid: ${rocprofiler_systems_perf_event_paranoid}" +) rocprofiler_systems_message(STATUS "CAP_SYS_ADMIN: ${rocprofiler_systems_cap_sys_admin}") rocprofiler_systems_message(STATUS "CAP_PERFMON: ${rocprofiler_systems_cap_perfmon}") @@ -256,13 +298,15 @@ if(ROCPROFSYS_USE_ROCM AND (NOT DEFINED ROCPROFSYS_CI_GPU OR ROCPROFSYS_CI_GPU)) NAMES amd-smi HINTS ${ROCmVersion_DIR} PATHS ${ROCmVersion_DIR} - PATH_SUFFIXES bin) + PATH_SUFFIXES bin + ) if(ROCPROFSYS_AMD_SMI_EXE) execute_process( COMMAND ${ROCPROFSYS_AMD_SMI_EXE} OUTPUT_VARIABLE _AMDSMI_OUT ERROR_VARIABLE _AMDSMI_ERR - RESULT_VARIABLE _AMDSMI_RET) + RESULT_VARIABLE _AMDSMI_RET + ) if(_AMDSMI_RET EQUAL 0) if("${_AMDSMI_OUTPUT}" MATCHES "ERROR" OR "${_AMDSMI_ERR}" MATCHES "ERROR") set(_VALID_GPU OFF) @@ -273,7 +317,8 @@ if(ROCPROFSYS_USE_ROCM AND (NOT DEFINED ROCPROFSYS_CI_GPU OR ROCPROFSYS_CI_GPU)) endif() if(NOT _VALID_GPU) rocprofiler_systems_message( - AUTHOR_WARNING "amd-smi did not successfully run. Disabling GPU tests...") + AUTHOR_WARNING "amd-smi did not successfully run. Disabling GPU tests..." + ) endif() endif() @@ -285,21 +330,28 @@ endif() # -------------------------------------------------------------------------------------- # macro(ROCPROFILER_SYSTEMS_CHECK_PASS_FAIL_REGEX NAME PASS FAIL) - if(NOT "${${PASS}}" STREQUAL "" - AND NOT "${${FAIL}}" STREQUAL "" - AND NOT "${${FAIL}}" MATCHES "\\|ROCPROFSYS_ABORT_FAIL_REGEX" - AND NOT "${${FAIL}}" MATCHES "${ROCPROFSYS_ABORT_FAIL_REGEX}") + if( + NOT "${${PASS}}" STREQUAL "" + AND NOT "${${FAIL}}" STREQUAL "" + AND NOT "${${FAIL}}" MATCHES "\\|ROCPROFSYS_ABORT_FAIL_REGEX" + AND NOT "${${FAIL}}" MATCHES "${ROCPROFSYS_ABORT_FAIL_REGEX}" + ) rocprofiler_systems_message( FATAL_ERROR "${NAME} has set pass and fail regexes but fail regex does not include '|ROCPROFSYS_ABORT_FAIL_REGEX'" - ) + ) endif() if("${${FAIL}}" STREQUAL "") set(${FAIL} "(${ROCPROFSYS_ABORT_FAIL_REGEX})") else() - string(REPLACE "|ROCPROFSYS_ABORT_FAIL_REGEX" "|${ROCPROFSYS_ABORT_FAIL_REGEX}" - ${FAIL} "${${FAIL}}") + string( + REPLACE + "|ROCPROFSYS_ABORT_FAIL_REGEX" + "|${ROCPROFSYS_ABORT_FAIL_REGEX}" + ${FAIL} + "${${FAIL}}" + ) endif() endmacro() @@ -308,7 +360,7 @@ endmacro() function(ROCPROFILER_SYSTEMS_WRITE_TEST_CONFIG _FILE _ENV) set(_ENV_ONLY "ROCPROFSYS_(CI|CI_TIMEOUT|MODE|USE_MPIP|DEBUG_[A-Z_]+|FORCE_ROCPROFILER_INIT|DEFAULT_MIN_INSTRUCTIONS|MONOCHROME|VERBOSE)=" - ) + ) set(_FILE_CONTENTS) set(_ENV_CONTENTS) @@ -326,7 +378,8 @@ function(ROCPROFILER_SYSTEMS_WRITE_TEST_CONFIG _FILE _ENV) set(_CONFIG_FILE ${PROJECT_BINARY_DIR}/rocprof-sys-tests-config/${_FILE}) file( - WRITE ${_CONFIG_FILE} + WRITE + ${_CONFIG_FILE} "# auto-generated by cmake # default values @@ -340,14 +393,13 @@ ROCPROFSYS_SAMPLING_GPUS = $env:HIP_VISIBLE_DEVICES # test-specific values ${_FILE_CONTENTS} -") +" + ) list(APPEND _ENV_CONTENTS "ROCPROFSYS_CONFIG_FILE=${_CONFIG_FILE}") if(_DEBUG_SETTINGS) list(APPEND _ENV_CONTENTS "ROCPROFSYS_DEBUG_SETTINGS=1") endif() - set(${_ENV} - "${_ENV_CONTENTS}" - PARENT_SCOPE) + set(${_ENV} "${_ENV_CONTENTS}" PARENT_SCOPE) endfunction() # -------------------------------------------------------------------------------------- # @@ -370,7 +422,8 @@ function(ROCPROFILER_SYSTEMS_GET_GFX_ARCHS _VAR) NAMES rocminfo HINTS ${ROCmVersion_DIR} ${ROCM_PATH} /opt/rocm PATHS ${ROCmVersion_DIR} ${ROCM_PATH} /opt/rocm - PATH_SUFFIXES bin) + PATH_SUFFIXES bin + ) if(rocminfo_EXECUTABLE) execute_process( @@ -378,14 +431,14 @@ function(ROCPROFILER_SYSTEMS_GET_GFX_ARCHS _VAR) RESULT_VARIABLE rocminfo_RET OUTPUT_VARIABLE rocminfo_OUT ERROR_VARIABLE rocminfo_ERR - OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE) + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE + ) if(rocminfo_RET EQUAL 0) string(REGEX MATCHALL "gfx([0-9A-Fa-f]+)" rocminfo_GFXINFO "${rocminfo_OUT}") list(REMOVE_DUPLICATES rocminfo_GFXINFO) - set(${_VAR} - "${rocminfo_GFXINFO}" - PARENT_SCOPE) + set(${_VAR} "${rocminfo_GFXINFO}" PARENT_SCOPE) if(ARG_ECHO) string(REPLACE ";" "${ARG_DELIM}" _GFXINFO_ECHO "${rocminfo_GFXINFO}") @@ -396,23 +449,21 @@ function(ROCPROFILER_SYSTEMS_GET_GFX_ARCHS _VAR) if(ARG_GFX_MATCH) string(REGEX MATCH "${ARG_GFX_MATCH}" _GFX_MATCH "${rocminfo_GFXINFO}") list(REMOVE_DUPLICATES _GFX_MATCH) - set(${_VAR} - "${_GFX_MATCH}" - PARENT_SCOPE) + set(${_VAR} "${_GFX_MATCH}" PARENT_SCOPE) if(ARG_ECHO) string(REPLACE ";" "${ARG_DELIM}" _GFXINFO_ECHO "${_GFX_MATCH}") message( STATUS - "${ARG_PREFIX}System architectures (filtered: ${ARG_GFX_MATCH}): ${_GFXINFO_ECHO}" - ) + "${ARG_PREFIX}System architectures (filtered: ${ARG_GFX_MATCH}): ${_GFXINFO_ECHO}" + ) endif() endif() else() message( AUTHOR_WARNING - "${rocminfo_EXECUTABLE} failed with error code ${rocminfo_RET}\nstderr:\n${rocminfo_ERR}\nstdout:\n${rocminfo_OUT}" - ) + "${rocminfo_EXECUTABLE} failed with error code ${rocminfo_RET}\nstderr:\n${rocminfo_ERR}\nstdout:\n${rocminfo_OUT}" + ) endif() endif() endfunction() @@ -422,9 +473,7 @@ endfunction() function(ROCPROFILER_SYSTEMS_ADJUST_TIMEOUT_FOR_SANITIZER _VAR) if(ROCPROFSYS_USE_SANITIZER) math(EXPR _timeout_v "2 * ${${_VAR}}") - set(${_VAR} - "${_timeout_v}" - PARENT_SCOPE) + set(${_VAR} "${_timeout_v}" PARENT_SCOPE) endif() endfunction() @@ -438,7 +487,7 @@ macro(ROCPROFILER_SYSTEMS_PATCH_SANITIZER_ENVIRONMENT _VAR) rocprofiler_systems_message( FATAL_ERROR "Please define the realpath to the address sanitizer library in variable ASAN_LIBRARY" - ) + ) endif() list(APPEND ${_VAR} "LD_PRELOAD=${ASAN_LIBRARY}") elseif(ROCPROFSYS_SANITIZER_TYPE MATCHES "thread") @@ -446,7 +495,7 @@ macro(ROCPROFILER_SYSTEMS_PATCH_SANITIZER_ENVIRONMENT _VAR) rocprofiler_systems_message( FATAL_ERROR "Please define the realpath to the thread sanitizer library in variable TSAN_LIBRARY" - ) + ) endif() list(APPEND ${_VAR} "LD_PRELOAD=${TSAN_LIBRARY}") endif() @@ -457,20 +506,45 @@ endmacro() # -------------------------------------------------------------------------------------- # function(ROCPROFILER_SYSTEMS_ADD_TEST) - foreach(_PREFIX SAMPLING RUNTIME REWRITE REWRITE_RUN BASELINE) + foreach( + _PREFIX + SAMPLING + RUNTIME + REWRITE + REWRITE_RUN + BASELINE + ) foreach(_TYPE PASS FAIL SKIP) list(APPEND _REGEX_OPTS "${_PREFIX}_${_TYPE}_REGEX") endforeach() endforeach() - set(_KWARGS REWRITE_ARGS RUNTIME_ARGS SAMPLING_ARGS RUN_ARGS ENVIRONMENT LABELS - PROPERTIES ${_REGEX_OPTS}) + set(_KWARGS + REWRITE_ARGS + RUNTIME_ARGS + SAMPLING_ARGS + RUN_ARGS + ENVIRONMENT + LABELS + PROPERTIES + ${_REGEX_OPTS} + ) cmake_parse_arguments( - TEST "SKIP_BASELINE;SKIP_SAMPLING;SKIP_REWRITE;SKIP_RUNTIME" + TEST + "SKIP_BASELINE;SKIP_SAMPLING;SKIP_REWRITE;SKIP_RUNTIME" "NAME;TARGET;MPI;GPU;NUM_PROCS;SAMPLING_TIMEOUT;REWRITE_TIMEOUT;RUNTIME_TIMEOUT" - "${_KWARGS}" ${ARGN}) + "${_KWARGS}" + ${ARGN} + ) - foreach(_PREFIX SAMPLING RUNTIME REWRITE REWRITE_RUN BASELINE) + foreach( + _PREFIX + SAMPLING + RUNTIME + REWRITE + REWRITE_RUN + BASELINE + ) if("${${_PREFIX}_FAIL_REGEX}" STREQUAL "") set(${_PREFIX}_FAIL_REGEX "(${ROCPROFSYS_ABORT_FAIL_REGEX})") endif() @@ -478,7 +552,8 @@ function(ROCPROFILER_SYSTEMS_ADD_TEST) if(TEST_GPU AND NOT _VALID_GPU) rocprofiler_systems_message( - STATUS "${TEST_NAME} requires a GPU and no valid GPUs were found") + STATUS "${TEST_NAME} requires a GPU and no valid GPUs were found" + ) return() endif() @@ -527,28 +602,38 @@ function(ROCPROFILER_SYSTEMS_ADD_TEST) endif() endif() - if("ROCPROFSYS_USE_ROCM=ON" IN_LIST TEST_ENVIRONMENT AND NOT "rocm" IN_LIST - TEST_ENVIRONMENT) + if( + "ROCPROFSYS_USE_ROCM=ON" IN_LIST TEST_ENVIRONMENT + AND NOT "rocm" IN_LIST TEST_ENVIRONMENT + ) list(APPEND TEST_LABELS "rocm") endif() - if("ROCPROFSYS_USE_AMD_SMI=ON" IN_LIST TEST_ENVIRONMENT AND NOT "amd-smi" IN_LIST - TEST_ENVIRONMENT) + if( + "ROCPROFSYS_USE_AMD_SMI=ON" IN_LIST TEST_ENVIRONMENT + AND NOT "amd-smi" IN_LIST TEST_ENVIRONMENT + ) list(APPEND TEST_LABELS "amd-smi") endif() if(TARGET ${TEST_TARGET}) - if(DEFINED TEST_MPI - AND ${TEST_MPI} - AND TEST_NUM_PROCS GREATER 0) + if(DEFINED TEST_MPI AND ${TEST_MPI} AND TEST_NUM_PROCS GREATER 0) if(NOT TEST_NUM_PROCS GREATER NUM_PROCS_REAL) - set(COMMAND_PREFIX ${MPIEXEC_EXECUTABLE} ${MPIEXEC_EXECUTABLE_ARGS} - ${MPIEXEC_NUMPROC_FLAG} ${TEST_NUM_PROCS}) + set(COMMAND_PREFIX + ${MPIEXEC_EXECUTABLE} + ${MPIEXEC_EXECUTABLE_ARGS} + ${MPIEXEC_NUMPROC_FLAG} + ${TEST_NUM_PROCS} + ) list(APPEND TEST_LABELS mpi parallel-${TEST_NUM_PROCS}) list(APPEND TEST_PROPERTIES PARALLEL_LEVEL ${TEST_NUM_PROCS}) else() - set(COMMAND_PREFIX ${MPIEXEC_EXECUTABLE} ${MPIEXEC_EXECUTABLE_ARGS} - ${MPIEXEC_NUMPROC_FLAG} 1) + set(COMMAND_PREFIX + ${MPIEXEC_EXECUTABLE} + ${MPIEXEC_EXECUTABLE_ARGS} + ${MPIEXEC_NUMPROC_FLAG} + 1 + ) endif() else() list(APPEND TEST_ENVIRONMENT "ROCPROFSYS_USE_PID=OFF") @@ -558,7 +643,8 @@ function(ROCPROFILER_SYSTEMS_ADD_TEST) add_test( NAME ${TEST_NAME}-baseline COMMAND ${COMMAND_PREFIX} $ ${TEST_RUN_ARGS} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) endif() if(NOT TEST_SKIP_SAMPLING) @@ -567,7 +653,8 @@ function(ROCPROFILER_SYSTEMS_ADD_TEST) COMMAND ${COMMAND_PREFIX} $ ${TEST_SAMPLE_ARGS} -- $ ${TEST_RUN_ARGS} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) endif() if(NOT TEST_SKIP_REWRITE) @@ -577,31 +664,43 @@ function(ROCPROFILER_SYSTEMS_ADD_TEST) $ -o $/${TEST_NAME}.inst ${TEST_REWRITE_ARGS} -- $ - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) add_test( NAME ${TEST_NAME}-binary-rewrite-run COMMAND ${COMMAND_PREFIX} $ -- $/${TEST_NAME}.inst ${TEST_RUN_ARGS} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) endif() if(NOT TEST_SKIP_RUNTIME AND NOT ROCPROFSYS_USE_SANITIZER) add_test( NAME ${TEST_NAME}-runtime-instrument - COMMAND $ ${TEST_RUNTIME_ARGS} - -- $ ${TEST_RUN_ARGS} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + COMMAND + $ ${TEST_RUNTIME_ARGS} -- + $ ${TEST_RUN_ARGS} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) endif() if(TEST ${TEST_NAME}-binary-rewrite-run) - set_tests_properties(${TEST_NAME}-binary-rewrite-run - PROPERTIES DEPENDS ${TEST_NAME}-binary-rewrite) + set_tests_properties( + ${TEST_NAME}-binary-rewrite-run + PROPERTIES DEPENDS ${TEST_NAME}-binary-rewrite + ) endif() - foreach(_TEST baseline sampling binary-rewrite binary-rewrite-run - runtime-instrument) + foreach( + _TEST + baseline + sampling + binary-rewrite + binary-rewrite-run + runtime-instrument + ) string(REGEX REPLACE "-run(-|/)" "\\1" _prefix "${TEST_NAME}-${_TEST}/") set(_labels "${_TEST}") string(REPLACE "-run" "" _labels "${_TEST}") @@ -613,9 +712,11 @@ function(ROCPROFILER_SYSTEMS_ADD_TEST) endif() set(_environ - "ROCPROFSYS_DEFAULT_MIN_INSTRUCTIONS=64" "${TEST_ENVIRONMENT}" + "ROCPROFSYS_DEFAULT_MIN_INSTRUCTIONS=64" + "${TEST_ENVIRONMENT}" "ROCPROFSYS_OUTPUT_PATH=${PROJECT_BINARY_DIR}/rocprof-sys-tests-output" - "ROCPROFSYS_OUTPUT_PREFIX=${_prefix}") + "ROCPROFSYS_OUTPUT_PREFIX=${_prefix}" + ) set(_timeout ${TEST_REWRITE_TIMEOUT}) if("${_TEST}" MATCHES "sampling") @@ -663,24 +764,21 @@ function(ROCPROFILER_SYSTEMS_ADD_TEST) list(APPEND _environ "ROCPROFSYS_CI_TIMEOUT=${_timeout}") rocprofiler_systems_check_pass_fail_regex("${TEST_NAME}-${_TEST}" - "${_PASS_REGEX}" "${_FAIL_REGEX}") + "${_PASS_REGEX}" "${_FAIL_REGEX}" + ) if(TEST ${TEST_NAME}-${_TEST}) rocprofiler_systems_write_test_config(${TEST_NAME}-${_TEST}.cfg _environ) set_tests_properties( ${TEST_NAME}-${_TEST} - PROPERTIES ENVIRONMENT - "${_environ}" - TIMEOUT - ${_timeout} - LABELS - "${_labels}" - PASS_REGULAR_EXPRESSION - "${${_PASS_REGEX}}" - FAIL_REGULAR_EXPRESSION - "${${_FAIL_REGEX}}" - SKIP_REGULAR_EXPRESSION - "${${_SKIP_REGEX}}" - ${_props}) + PROPERTIES + ENVIRONMENT "${_environ}" + TIMEOUT ${_timeout} + LABELS "${_labels}" + PASS_REGULAR_EXPRESSION "${${_PASS_REGEX}}" + FAIL_REGULAR_EXPRESSION "${${_FAIL_REGEX}}" + SKIP_REGULAR_EXPRESSION "${${_SKIP_REGEX}}" + ${_props} + ) endif() endforeach() endif() @@ -695,17 +793,28 @@ function(ROCPROFILER_SYSTEMS_ADD_CAUSAL_TEST) endforeach() endforeach() - set(_KWARGS CAUSAL_ARGS CAUSAL_VALIDATE_ARGS RUN_ARGS ENVIRONMENT LABELS PROPERTIES - ${_REGEX_OPTS}) + set(_KWARGS + CAUSAL_ARGS + CAUSAL_VALIDATE_ARGS + RUN_ARGS + ENVIRONMENT + LABELS + PROPERTIES + ${_REGEX_OPTS} + ) cmake_parse_arguments( - TEST "SKIP_BASELINE" - "NAME;TARGET;CAUSAL_MODE;CAUSAL_TIMEOUT;CAUSAL_VALIDATE_TIMEOUT" "${_KWARGS}" - ${ARGN}) + TEST + "SKIP_BASELINE" + "NAME;TARGET;CAUSAL_MODE;CAUSAL_TIMEOUT;CAUSAL_VALIDATE_TIMEOUT" + "${_KWARGS}" + ${ARGN} + ) if(NOT DEFINED TEST_CAUSAL_MODE) rocprofiler_systems_message(FATAL_ERROR - "${TEST_NAME} :: CAUSAL_MODE must be defined") + "${TEST_NAME} :: CAUSAL_MODE must be defined" + ) endif() if(NOT TEST_CAUSAL_TIMEOUT) @@ -721,25 +830,35 @@ function(ROCPROFILER_SYSTEMS_ADD_CAUSAL_TEST) endif() if(TARGET ${TEST_TARGET}) - set(COMMAND_PREFIX $ --reset -m - ${TEST_CAUSAL_MODE} ${TEST_CAUSAL_ARGS} --) + set(COMMAND_PREFIX + $ + --reset + -m + ${TEST_CAUSAL_MODE} + ${TEST_CAUSAL_ARGS} + -- + ) if(NOT TEST_SKIP_BASELINE) add_test( NAME ${TEST_NAME}-baseline COMMAND $ ${TEST_RUN_ARGS} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) endif() add_test( NAME causal-${TEST_NAME} COMMAND ${COMMAND_PREFIX} $ ${TEST_RUN_ARGS} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) if(NOT "${TEST_CAUSAL_VALIDATE_ARGS}" STREQUAL "") - if("$ENV{ROCPROFSYS_CI}" MATCHES "ON|on|1|true|TRUE" - OR "$ENV{CI}" MATCHES "true" - OR NOT "$ENV{GITHUB_RUN_ID}" STREQUAL "") + if( + "$ENV{ROCPROFSYS_CI}" MATCHES "ON|on|1|true|TRUE" + OR "$ENV{CI}" MATCHES "true" + OR NOT "$ENV{GITHUB_RUN_ID}" STREQUAL "" + ) set(_VALIDATE_EXTRA "--ci") else() set(_VALIDATE_EXTRA "") @@ -747,18 +866,21 @@ function(ROCPROFILER_SYSTEMS_ADD_CAUSAL_TEST) add_test( NAME validate-causal-${TEST_NAME} - COMMAND ${CMAKE_CURRENT_LIST_DIR}/validate-causal-json.py - ${_VALIDATE_EXTRA} ${TEST_CAUSAL_VALIDATE_ARGS} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + COMMAND + ${CMAKE_CURRENT_LIST_DIR}/validate-causal-json.py ${_VALIDATE_EXTRA} + ${TEST_CAUSAL_VALIDATE_ARGS} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) endif() if(TEST validate-causal-${TEST_NAME}) - set_tests_properties(validate-causal-${TEST_NAME} - PROPERTIES DEPENDS causal-${TEST_NAME}) + set_tests_properties( + validate-causal-${TEST_NAME} + PROPERTIES DEPENDS causal-${TEST_NAME} + ) endif() foreach(_TEST baseline causal validate-causal) - if(NOT TEST ${_TEST}-${TEST_NAME}) if(NOT TEST ${TEST_NAME}-${_TEST}) continue() @@ -790,7 +912,8 @@ function(ROCPROFILER_SYSTEMS_ADD_CAUSAL_TEST) "ROCPROFSYS_VERBOSE=1" "ROCPROFSYS_DL_VERBOSE=0" "ROCPROFSYS_DEBUG_SETTINGS=0" - "${TEST_ENVIRONMENT}") + "${TEST_ENVIRONMENT}" + ) set(_timeout ${TEST_CAUSAL_TIMEOUT}) @@ -821,22 +944,19 @@ function(ROCPROFILER_SYSTEMS_ADD_CAUSAL_TEST) list(APPEND _environ "ROCPROFSYS_CI_TIMEOUT=${_timeout}") rocprofiler_systems_write_test_config(${_NAME}.cfg _environ) rocprofiler_systems_check_pass_fail_regex("${_NAME}" "${_PASS_REGEX}" - "${_FAIL_REGEX}") + "${_FAIL_REGEX}" + ) set_tests_properties( ${_NAME} - PROPERTIES ENVIRONMENT - "${_environ}" - TIMEOUT - ${_timeout} - LABELS - "${_labels}" - PASS_REGULAR_EXPRESSION - "${${_PASS_REGEX}}" - FAIL_REGULAR_EXPRESSION - "${${_FAIL_REGEX}}" - SKIP_REGULAR_EXPRESSION - "${${_SKIP_REGEX}}" - ${_props}) + PROPERTIES + ENVIRONMENT "${_environ}" + TIMEOUT ${_timeout} + LABELS "${_labels}" + PASS_REGULAR_EXPRESSION "${${_PASS_REGEX}}" + FAIL_REGULAR_EXPRESSION "${${_FAIL_REGEX}}" + SKIP_REGULAR_EXPRESSION "${${_SKIP_REGEX}}" + ${_props} + ) endforeach() endif() endfunction() @@ -854,7 +974,8 @@ function(ROCPROFILER_SYSTEMS_ADD_PYTHON_TEST) "NAME;FILE;TIMEOUT;PYTHON_EXECUTABLE;PYTHON_VERSION" # single value args "PROFILE_ARGS;RUN_ARGS;ENVIRONMENT;LABELS;PROPERTIES;PASS_REGEX;FAIL_REGEX;SKIP_REGEX;DEPENDS;COMMAND" # multiple # value args - ${ARGN}) + ${ARGN} + ) if(NOT TEST_TIMEOUT) set(TEST_TIMEOUT 120) @@ -871,50 +992,69 @@ function(ROCPROFILER_SYSTEMS_ADD_PYTHON_TEST) list(APPEND TEST_LABELS "python" "python-${TEST_PYTHON_VERSION}") if(NOT TEST_COMMAND) - list(APPEND TEST_ENVIRONMENT "ROCPROFSYS_CI=ON" - "ROCPROFSYS_OUTPUT_PATH=${PROJECT_BINARY_DIR}/rocprof-sys-tests-output") + list( + APPEND + TEST_ENVIRONMENT + "ROCPROFSYS_CI=ON" + "ROCPROFSYS_OUTPUT_PATH=${PROJECT_BINARY_DIR}/rocprof-sys-tests-output" + ) get_filename_component(_TEST_FILE "${TEST_FILE}" NAME) set(_TEST_FILE - ${PROJECT_BINARY_DIR}/python/tests/${TEST_PYTHON_VERSION}/${_TEST_FILE}) + ${PROJECT_BINARY_DIR}/python/tests/${TEST_PYTHON_VERSION}/${_TEST_FILE} + ) configure_file(${TEST_FILE} ${_TEST_FILE} @ONLY) if(TEST_STANDALONE) add_test( NAME ${TEST_NAME}-${TEST_PYTHON_VERSION} COMMAND ${TEST_PYTHON_EXECUTABLE} ${_TEST_FILE} ${TEST_RUN_ARGS} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) else() add_test( NAME ${TEST_NAME}-${TEST_PYTHON_VERSION} - COMMAND ${TEST_PYTHON_EXECUTABLE} -m rocprofsys ${TEST_PROFILE_ARGS} -- - ${_TEST_FILE} ${TEST_RUN_ARGS} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + COMMAND + ${TEST_PYTHON_EXECUTABLE} -m rocprofsys ${TEST_PROFILE_ARGS} -- + ${_TEST_FILE} ${TEST_RUN_ARGS} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) add_test( NAME ${TEST_NAME}-${TEST_PYTHON_VERSION}-annotated - COMMAND ${TEST_PYTHON_EXECUTABLE} -m rocprofsys ${TEST_PROFILE_ARGS} - --annotate-trace -- ${_TEST_FILE} ${TEST_RUN_ARGS} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + COMMAND + ${TEST_PYTHON_EXECUTABLE} -m rocprofsys ${TEST_PROFILE_ARGS} + --annotate-trace -- ${_TEST_FILE} ${TEST_RUN_ARGS} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) endif() else() list(APPEND TEST_LABELS "python-check" "python-${TEST_PYTHON_VERSION}-check") add_test( NAME ${TEST_NAME}-${TEST_PYTHON_VERSION} COMMAND ${TEST_COMMAND} ${TEST_FILE} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) endif() - foreach(_TEST ${TEST_NAME}-${TEST_PYTHON_VERSION} - ${TEST_NAME}-${TEST_PYTHON_VERSION}-annotated) - + foreach( + _TEST + ${TEST_NAME}-${TEST_PYTHON_VERSION} + ${TEST_NAME}-${TEST_PYTHON_VERSION}-annotated + ) if(NOT TEST "${_TEST}") continue() endif() - string(REPLACE "${TEST_NAME}-${TEST_PYTHON_VERSION}" "${TEST_NAME}" _TEST_DIR - "${_TEST}") + string( + REPLACE + "${TEST_NAME}-${TEST_PYTHON_VERSION}" + "${TEST_NAME}" + _TEST_DIR + "${_TEST}" + ) set(_TEST_ENV "${TEST_ENVIRONMENT}" "ROCPROFSYS_OUTPUT_PREFIX=${_TEST_DIR}/${TEST_PYTHON_VERSION}/" - "ROCPROFSYS_CI_TIMEOUT=${TEST_TIMEOUT}") + "ROCPROFSYS_CI_TIMEOUT=${TEST_TIMEOUT}" + ) set(_TEST_PROPERTIES "${TEST_PROPERTIES}") # assign pass variable to pass regex @@ -923,26 +1063,21 @@ function(ROCPROFILER_SYSTEMS_ADD_PYTHON_TEST) set(_FAIL_REGEX TEST_FAIL_REGEX) rocprofiler_systems_check_pass_fail_regex("${_TEST}" "${_PASS_REGEX}" - "${_FAIL_REGEX}") + "${_FAIL_REGEX}" + ) set_tests_properties( ${_TEST} - PROPERTIES ENVIRONMENT - "${_TEST_ENV}" - TIMEOUT - ${TEST_TIMEOUT} - LABELS - "${TEST_LABELS}" - DEPENDS - "${TEST_DEPENDS}" - PASS_REGULAR_EXPRESSION - "${${_PASS_REGEX}}" - FAIL_REGULAR_EXPRESSION - "${${_FAIL_REGEX}}" - SKIP_REGULAR_EXPRESSION - "${TEST_SKIP_REGEX}" - REQUIRED_FILES - "${TEST_FILE}" - ${_TEST_PROPERTIES}) + PROPERTIES + ENVIRONMENT "${_TEST_ENV}" + TIMEOUT ${TEST_TIMEOUT} + LABELS "${TEST_LABELS}" + DEPENDS "${TEST_DEPENDS}" + PASS_REGULAR_EXPRESSION "${${_PASS_REGEX}}" + FAIL_REGULAR_EXPRESSION "${${_FAIL_REGEX}}" + SKIP_REGULAR_EXPRESSION "${TEST_SKIP_REGEX}" + REQUIRED_FILES "${TEST_FILE}" + ${_TEST_PROPERTIES} + ) endforeach() endfunction() @@ -957,12 +1092,15 @@ if(NOT ROCPROFSYS_USE_PYTHON) if(Python3_FOUND) set(ROCPROFSYS_VALIDATION_PYTHON ${Python3_EXECUTABLE}) - execute_process(COMMAND ${Python3_EXECUTABLE} -c "import perfetto" - RESULT_VARIABLE ROCPROFSYS_VALIDATION_PYTHON_PERFETTO) + execute_process( + COMMAND ${Python3_EXECUTABLE} -c "import perfetto" + RESULT_VARIABLE ROCPROFSYS_VALIDATION_PYTHON_PERFETTO + ) if(NOT ROCPROFSYS_VALIDATION_PYTHON_PERFETTO EQUAL 0) rocprofiler_systems_message(AUTHOR_WARNING - "Python3 found but perfetto support is disabled") + "Python3 found but perfetto support is disabled" + ) endif() endif() else() @@ -977,12 +1115,15 @@ else() rocprofiler_systems_find_python( _PYTHON ROOT_DIR "${_PYTHON_ROOT_DIR}" - COMPONENTS Interpreter) + COMPONENTS Interpreter + ) if(_PYTHON_EXECUTABLE) set(ROCPROFSYS_VALIDATION_PYTHON ${_PYTHON_EXECUTABLE}) - execute_process(COMMAND ${_PYTHON_EXECUTABLE} -c "import perfetto" - RESULT_VARIABLE ROCPROFSYS_VALIDATION_PYTHON_PERFETTO) + execute_process( + COMMAND ${_PYTHON_EXECUTABLE} -c "import perfetto" + RESULT_VARIABLE ROCPROFSYS_VALIDATION_PYTHON_PERFETTO + ) # prefer Python3 with perfetto support if(ROCPROFSYS_VALIDATION_PYTHON_PERFETTO EQUAL 0) @@ -990,7 +1131,8 @@ else() else() rocprofiler_systems_message( AUTHOR_WARNING - "${_PYTHON_EXECUTABLE} found but perfetto support is disabled") + "${_PYTHON_EXECUTABLE} found but perfetto support is disabled" + ) endif() endif() @@ -1000,7 +1142,8 @@ endif() if(NOT ROCPROFSYS_VALIDATION_PYTHON) rocprofiler_systems_message( - AUTHOR_WARNING "Python3 interpreter not found. Validation tests will be disabled") + AUTHOR_WARNING "Python3 interpreter not found. Validation tests will be disabled" + ) endif() # -------------------------------------------------------------------------------------- # @@ -1010,7 +1153,6 @@ endif() # -------------------------------------------------------------------------------------- # function(ROCPROFILER_SYSTEMS_ADD_VALIDATION_TEST) - if(NOT ROCPROFSYS_VALIDATION_PYTHON) return() endif() @@ -1020,12 +1162,14 @@ function(ROCPROFILER_SYSTEMS_ADD_VALIDATION_TEST) "" "NAME;TIMEOUT;TIMEMORY_METRIC;TIMEMORY_FILE;PERFETTO_METRIC;PERFETTO_FILE" "ENVIRONMENT;LABELS;PROPERTIES;PASS_REGEX;FAIL_REGEX;SKIP_REGEX;DEPENDS;EXIST_FILES;ARGS" - ${ARGN}) + ${ARGN} + ) if(NOT TEST "${TEST_NAME}") rocprofiler_systems_message( AUTHOR_WARNING - "No validation test(s) for ${TEST_NAME} because test does not exist") + "No validation test(s) for ${TEST_NAME} because test does not exist" + ) return() endif() @@ -1050,15 +1194,17 @@ function(ROCPROFILER_SYSTEMS_ADD_VALIDATION_TEST) if(NOT TEST_PASS_REGEX) set(TEST_PASS_REGEX "rocprof-sys-tests-output/${TEST_NAME}/(${TEST_TIMEMORY_FILE}|${TEST_PERFETTO_FILE}) validated" - ) + ) endif() foreach(_FILE ${TEST_EXIST_FILES}) add_test( NAME validate-${TEST_NAME}-${_FILE}-exists - COMMAND test -e - ${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/${TEST_NAME}/${_FILE} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + COMMAND + test -e + ${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/${TEST_NAME}/${_FILE} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) endforeach() if(TEST_TIMEMORY_FILE) @@ -1069,7 +1215,8 @@ function(ROCPROFILER_SYSTEMS_ADD_VALIDATION_TEST) ${CMAKE_CURRENT_LIST_DIR}/validate-timemory-json.py -m "${TEST_TIMEMORY_METRIC}" ${TEST_ARGS} -i ${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/${TEST_NAME}/${TEST_TIMEMORY_FILE} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) endif() if(ROCPROFSYS_VALIDATION_PYTHON_PERFETTO EQUAL 0 AND TEST_PERFETTO_FILE) @@ -1081,37 +1228,32 @@ function(ROCPROFILER_SYSTEMS_ADD_VALIDATION_TEST) "${TEST_PERFETTO_METRIC}" ${TEST_ARGS} -i ${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/${TEST_NAME}/${TEST_PERFETTO_FILE} -t /opt/trace_processor/bin/trace_processor_shell - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) endif() list(APPEND TEST_ENVIRONMENT "ROCPROFSYS_CI_TIMEOUT=${TEST_TIMEOUT}") foreach(_TEST validate-${TEST_NAME}-timemory validate-${TEST_NAME}-perfetto) - if(NOT TEST "${_TEST}") continue() endif() rocprofiler_systems_check_pass_fail_regex("${_TEST}" "TEST_PASS_REGEX" - "TEST_FAIL_REGEX") + "TEST_FAIL_REGEX" + ) set_tests_properties( ${_TEST} - PROPERTIES ENVIRONMENT - "${TEST_ENVIRONMENT}" - TIMEOUT - ${TEST_TIMEOUT} - LABELS - "${TEST_LABELS}" - DEPENDS - "${TEST_DEPENDS};${TEST_NAME}" - PASS_REGULAR_EXPRESSION - "${TEST_PASS_REGEX}" - FAIL_REGULAR_EXPRESSION - "${TEST_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${TEST_SKIP_REGEX}" - REQUIRED_FILES - "${TEST_FILE}" - ${TEST_PROPERTIES}) + PROPERTIES + ENVIRONMENT "${TEST_ENVIRONMENT}" + TIMEOUT ${TEST_TIMEOUT} + LABELS "${TEST_LABELS}" + DEPENDS "${TEST_DEPENDS};${TEST_NAME}" + PASS_REGULAR_EXPRESSION "${TEST_PASS_REGEX}" + FAIL_REGULAR_EXPRESSION "${TEST_FAIL_REGEX}" + SKIP_REGULAR_EXPRESSION "${TEST_SKIP_REGEX}" + REQUIRED_FILES "${TEST_FILE}" + ${TEST_PROPERTIES} + ) endforeach() endfunction() diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-time-window-tests.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-time-window-tests.cmake index 096f057f1f..6badca3773 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-time-window-tests.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-time-window-tests.cmake @@ -33,7 +33,8 @@ rocprofiler_systems_add_test( REWRITE_ARGS -e -v 2 --caller-include inner -i 4096 RUNTIME_ARGS -e -v 1 --caller-include inner -i 4096 LABELS "time-window" - ENVIRONMENT "${_window_environment};ROCPROFSYS_TRACE_DURATION=1.25") + ENVIRONMENT "${_window_environment};ROCPROFSYS_TRACE_DURATION=1.25" +) rocprofiler_systems_add_validation_test( NAME trace-time-window-binary-rewrite @@ -58,7 +59,8 @@ rocprofiler_systems_add_validation_test( 1 1 1 - -p) + -p +) rocprofiler_systems_add_validation_test( NAME trace-time-window-runtime-instrument @@ -83,7 +85,8 @@ rocprofiler_systems_add_validation_test( 1 1 1 - -p) + -p +) rocprofiler_systems_add_test( SKIP_BASELINE SKIP_SAMPLING ${_TRACE_WINDOW_SKIP} @@ -94,7 +97,7 @@ rocprofiler_systems_add_test( LABELS "time-window" ENVIRONMENT "${_window_environment};ROCPROFSYS_TRACE_DELAY=0.75;ROCPROFSYS_TRACE_DURATION=0.75" - ) +) rocprofiler_systems_add_validation_test( NAME trace-time-window-delay-binary-rewrite @@ -112,7 +115,8 @@ rocprofiler_systems_add_validation_test( -d 0 0 - -p) + -p +) rocprofiler_systems_add_validation_test( NAME trace-time-window-delay-runtime-instrument @@ -130,4 +134,5 @@ rocprofiler_systems_add_validation_test( -d 0 0 - -p) + -p +) diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-user-api-tests.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-user-api-tests.cmake index f02535c1b4..811252c988 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-user-api-tests.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-user-api-tests.cmake @@ -50,4 +50,5 @@ rocprofiler_systems_add_test( RUNTIME_PASS_REGEX "Pushing custom region :: run.10. x 1000" SAMPLING_PASS_REGEX "Pushing custom region :: run.10. x 1000" BASELINE_FAIL_REGEX "Pushing custom region" - REWRITE_FAIL_REGEX "0 instrumented loops in procedure") + REWRITE_FAIL_REGEX "0 instrumented loops in procedure" +) diff --git a/projects/rocprofiler-systems/tests/source/CMakeLists.txt b/projects/rocprofiler-systems/tests/source/CMakeLists.txt index 6d7d221b44..27364bdc95 100644 --- a/projects/rocprofiler-systems/tests/source/CMakeLists.txt +++ b/projects/rocprofiler-systems/tests/source/CMakeLists.txt @@ -38,14 +38,16 @@ set(_thread_limit_environment "ROCPROFSYS_USE_SAMPLING=ON" "ROCPROFSYS_SAMPLING_FREQ=250" "ROCPROFSYS_VERBOSE=2" - "ROCPROFSYS_TIMEMORY_COMPONENTS=wall_clock,peak_rss,page_rss") + "ROCPROFSYS_TIMEMORY_COMPONENTS=wall_clock,peak_rss,page_rss" +) math(EXPR THREAD_LIMIT_TEST_VALUE "${ROCPROFSYS_MAX_THREADS} + 24") math(EXPR THREAD_LIMIT_TEST_VALUE_PLUS_ONE "${THREAD_LIMIT_TEST_VALUE} + 1") set(_thread_limit_pass_regex "\\|${THREAD_LIMIT_TEST_VALUE}>>>") set(_thread_limit_fail_regex - "\\|${THREAD_LIMIT_TEST_VALUE_PLUS_ONE}>>>|ROCPROFSYS_ABORT_FAIL_REGEX") + "\\|${THREAD_LIMIT_TEST_VALUE_PLUS_ONE}>>>|ROCPROFSYS_ABORT_FAIL_REGEX" +) rocprofiler_systems_add_test( SKIP_BASELINE @@ -63,4 +65,5 @@ rocprofiler_systems_add_test( RUNTIME_FAIL_REGEX "${_thread_limit_fail_regex}" SAMPLING_FAIL_REGEX "${_thread_limit_fail_regex}" REWRITE_RUN_FAIL_REGEX "${_thread_limit_fail_regex}" - ENVIRONMENT "${_thread_limit_environment}") + ENVIRONMENT "${_thread_limit_environment}" +)