Files
TheRock/rocm-systems/projects/rocprofiler-systems/source/lib/common/CMakeLists.txt
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

102 lines
3.4 KiB
CMake

# Copyright (c) Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT
# ------------------------------------------------------------------------------#
#
# rocprofiler-systems common headers
#
# ------------------------------------------------------------------------------#
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
)
# Query clang for host target triple for defines.h
# This is useful when LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON and
# the openmp libraries are installed one level deeper in lib/<host-target-triple>.
find_program(
amdclang_EXECUTABLE
NAMES amdclang
HINTS ${ROCmVersion_DIR} ${ROCM_PATH}
ENV ROCM_PATH
/opt/rocm
PATH_SUFFIXES bin llvm/bin lib/llvm/bin
)
mark_as_advanced(amdclang_EXECUTABLE)
set(LLVM_HOST_TRIPLE "")
if(amdclang_EXECUTABLE)
execute_process(
COMMAND "${amdclang_EXECUTABLE}" --print-target-triple
OUTPUT_VARIABLE LLVM_HOST_TRIPLE
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE _llvm_host_triple_result
)
if(NOT _llvm_host_triple_result EQUAL 0)
set(LLVM_HOST_TRIPLE "")
rocprofiler_systems_message(
FATAL_ERROR
"'${amdclang_EXECUTABLE} --print-target-triple' failed (exit code ${_llvm_host_triple_result})"
"This toolchain may be broken."
)
endif()
else()
rocprofiler_systems_message(
WARNING
"Could not find amdclang to determine the LLVM host triple; "
"libomptarget discovery for LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON may not work."
)
endif()
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}/md5sum.hpp
${CMAKE_CURRENT_SOURCE_DIR}/path.hpp
${CMAKE_CURRENT_SOURCE_DIR}/setup.hpp
${CMAKE_CURRENT_SOURCE_DIR}/span.hpp
${CMAKE_CURRENT_SOURCE_DIR}/static_object.hpp
${CMAKE_CURRENT_SOURCE_DIR}/synchronized.hpp
${CMAKE_CURRENT_SOURCE_DIR}/traits.hpp
${CMAKE_CURRENT_SOURCE_DIR}/units.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
$<BUILD_INTERFACE:${COMMON_SOURCE_INCLUDE_DIR}>
$<BUILD_INTERFACE:${COMMON_BINARY_INCLUDE_DIR}>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/timemory/source>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/timemory/source>
)
target_compile_definitions(
rocprofiler-systems-common-library
INTERFACE $<BUILD_INTERFACE:ROCPROFSYS_INTERNAL_BUILD=1>
)
target_link_libraries(
rocprofiler-systems-common-library
INTERFACE $<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-logger>
)
if(ROCPROFSYS_BUILD_TESTING)
add_subdirectory(tests)
endif()