Files
rocm-systems/projects/rocprofiler-systems/cmake/DyninstExternals.cmake
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

119 lines
3.9 KiB
CMake
Raw Normal View History

2025-06-06 22:52:23 -04:00
include(MacroUtilities)
# Map deprecated DYNINST_BUILD_* variables to new ROCPROFSYS_BUILD_* variables
foreach(dep BOOST TBB ELFUTILS LIBIBERTY)
if(DYNINST_BUILD_${dep})
message(
WARNING
2025-06-22 10:44:33 -04:00
"DYNINST_BUILD_${dep} is deprecated. Using ROCPROFSYS_BUILD_${dep} instead."
)
2025-06-06 22:52:23 -04:00
set(ROCPROFSYS_BUILD_${dep} ON)
endif()
endforeach()
set(TPL_STAGING_PREFIX
"${PROJECT_BINARY_DIR}/external"
2025-06-22 10:44:33 -04:00
CACHE PATH
"Third-party library build-tree install prefix"
)
2025-06-06 22:52:23 -04:00
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(
2025-06-22 10:44:33 -04:00
rocprofiler-systems-boost
PROPERTIES JOB_POOL_COMPILE external_deps_pool JOB_POOL_LINK external_deps_pool
)
2025-06-06 22:52:23 -04:00
# 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(
2025-06-22 10:44:33 -04:00
rocprofiler-systems-tbb-build
PROPERTIES JOB_POOL_COMPILE external_deps_pool JOB_POOL_LINK external_deps_pool
)
2025-06-06 22:52:23 -04:00
add_dependencies(external-prebuild rocprofiler-systems-tbb-build)
endif()
include(DyninstElfUtils)
if(TARGET rocprofiler-systems-elfutils-build AND TARGET external-prebuild)
set_target_properties(
2025-06-22 10:44:33 -04:00
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)
2025-06-06 22:52:23 -04:00
endif()
include(DyninstLibIberty)
if(TARGET rocprofiler-systems-libiberty-build AND TARGET external-prebuild)
set_target_properties(
2025-06-22 10:44:33 -04:00
rocprofiler-systems-libiberty-build
PROPERTIES JOB_POOL_COMPILE external_deps_pool JOB_POOL_LINK external_deps_pool
)
2025-06-06 22:52:23 -04:00
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)
2025-06-22 10:44:33 -04:00
set_target_properties(
Dyninst::Boost
PROPERTIES INTERFACE_LINK_LIBRARIES rocprofiler-systems-boost
)
2025-06-06 22:52:23 -04:00
message(
STATUS
2025-06-22 10:44:33 -04:00
"Created imported target Dyninst::Boost linked to rocprofiler-systems-boost"
)
2025-06-06 22:52:23 -04:00
endif()
if(NOT TARGET Dyninst::ElfUtils AND TARGET rocprofiler-systems-elfutils)
2025-06-06 22:52:23 -04:00
add_library(Dyninst::ElfUtils INTERFACE IMPORTED)
2025-06-22 10:44:33 -04:00
set_target_properties(
Dyninst::ElfUtils
PROPERTIES INTERFACE_LINK_LIBRARIES rocprofiler-systems-elfutils
)
2025-06-06 22:52:23 -04:00
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)
2025-06-22 10:44:33 -04:00
set_target_properties(
Dyninst::TBB
PROPERTIES INTERFACE_LINK_LIBRARIES rocprofiler-systems-tbb
)
2025-06-06 22:52:23 -04:00
message(
2025-06-22 10:44:33 -04:00
STATUS
"Created imported target Dyninst::TBB linked to rocprofiler-systems-tbb"
)
2025-06-06 22:52:23 -04:00
endif()
if(NOT TARGET Dyninst::LibIberty AND TARGET rocprofiler-systems-libiberty)
add_library(Dyninst::LibIberty INTERFACE IMPORTED)
2025-06-22 10:44:33 -04:00
set_target_properties(
Dyninst::LibIberty
PROPERTIES INTERFACE_LINK_LIBRARIES rocprofiler-systems-libiberty
)
2025-06-06 22:52:23 -04:00
message(
STATUS
2025-06-22 10:44:33 -04:00
"Created imported target Dyninst::LibIberty linked to rocprofiler-systems-libiberty"
)
2025-06-06 22:52:23 -04:00
endif()