Files
David Galiffi 3883bd3e93 Support for TheRock builds (#1545)
* Cleaning up some BUILD_<dep> config variables

The `ROCPROFSYS_BUILD_<dep>` settings were being translated to `BUILD_<dep>` for the old Dyninst dependencies.
Remove this extra layer
Add `rocprofiler_systems_add_option` for the `ROCPROFSYS_BUILD_<dep>` options, so there is a better description in the in the CMakeCache.

* Changes to support USE_ROCM in TheRock builds

* Removed `amd-smi::roctx` from Findamd-smi.cmake

* Fix linking error on rocm-6.4 when including amd_smi

* Format cmake

* Fix typo in logs

* Removing Findamd-smi.cmake

* Refactor the cmake parameters for `amd-smi`.

The `drm` libraries were only required ba amdsmi for rocm-6.4.0. There was no point adding them for other versions.
2025-11-10 14:38:51 -05:00

119 baris
3.9 KiB
CMake

include(MacroUtilities)
# Map deprecated DYNINST_BUILD_* variables to new ROCPROFSYS_BUILD_* variables
foreach(dep BOOST TBB ELFUTILS LIBIBERTY)
if(DYNINST_BUILD_${dep})
message(
WARNING
"DYNINST_BUILD_${dep} is deprecated. Using ROCPROFSYS_BUILD_${dep} instead."
)
set(ROCPROFSYS_BUILD_${dep} ON)
endif()
endforeach()
set(TPL_STAGING_PREFIX
"${PROJECT_BINARY_DIR}/external"
CACHE PATH
"Third-party library build-tree install prefix"
)
file(MAKE_DIRECTORY "${TPL_STAGING_PREFIX}")
file(MAKE_DIRECTORY "${TPL_STAGING_PREFIX}/include")
add_custom_target(external-prebuild)
# Add external dependencies to be built
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
)
# Create a prebuild target that depends on Boost
add_dependencies(external-prebuild rocprofiler-systems-boost-build)
endif()
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
)
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
)
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
)
add_dependencies(external-prebuild rocprofiler-systems-libiberty-build)
endif()
# Final dependency check
if(NOT TARGET external-prebuild)
message(WARNING "Not all dyninst external dependencies found. Build may fail.")
endif()
# Create a dummy target to ensure external dependencies are fully built
add_custom_target(external-deps-complete)
if(TARGET external-prebuild)
add_dependencies(external-deps-complete external-prebuild)
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
)
message(
STATUS
"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
)
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
)
message(
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
)
message(
STATUS
"Created imported target Dyninst::LibIberty linked to rocprofiler-systems-libiberty"
)
endif()