Update dyninst to v13 (#190)
Update Dyninst submodule
Refactoring of build scripts to build TBB, Boost, ElfUtils, and LibIberty, since Dyninst build scripts no longer do.
Workflows are now building Dyninst and its dependencies.
---------
Co-authored-by: marantic-amd <marantic@amd.com>
Co-authored-by: David Galiffi <David.Galiffi@amd.com>
[ROCm/rocprofiler-systems commit: 96df9b6d3e]
This commit is contained in:
@@ -98,6 +98,11 @@ jobs:
|
||||
-DROCPROFSYS_USE_ROCM=OFF
|
||||
-DROCPROFSYS_USE_OMPT=OFF
|
||||
-DROCPROFSYS_USE_PYTHON=ON
|
||||
-DROCPROFSYS_BUILD_DYNINST=ON
|
||||
-DROCPROFSYS_BUILD_BOOST=ON
|
||||
-DROCPROFSYS_BUILD_TBB=ON
|
||||
-DROCPROFSYS_BUILD_ELFUTILS=ON
|
||||
-DROCPROFSYS_BUILD_LIBIBERTY=ON
|
||||
-DROCPROFSYS_INSTALL_PERFETTO_TOOLS=OFF
|
||||
-DROCPROFSYS_USE_MPI_HEADERS=ON
|
||||
-DROCPROFSYS_PYTHON_PREFIX=/opt/conda/envs
|
||||
|
||||
@@ -114,6 +114,11 @@ jobs:
|
||||
-DROCPROFSYS_USE_ROCM=${USE_HIP}
|
||||
-DROCPROFSYS_USE_OMPT=OFF
|
||||
-DROCPROFSYS_USE_PYTHON=ON
|
||||
-DROCPROFSYS_BUILD_DYNINST=ON
|
||||
-DROCPROFSYS_BUILD_BOOST=ON
|
||||
-DROCPROFSYS_BUILD_TBB=ON
|
||||
-DROCPROFSYS_BUILD_ELFUTILS=ON
|
||||
-DROCPROFSYS_BUILD_LIBIBERTY=ON
|
||||
-DROCPROFSYS_USE_MPI_HEADERS=ON
|
||||
-DROCPROFSYS_CI_MPI_RUN_AS_ROOT=ON
|
||||
-DROCPROFSYS_MAX_THREADS=64
|
||||
|
||||
@@ -150,6 +150,11 @@ jobs:
|
||||
-DROCPROFSYS_USE_ROCM=OFF
|
||||
-DROCPROFSYS_USE_OMPT=OFF
|
||||
-DROCPROFSYS_USE_PAPI=OFF
|
||||
-DROCPROFSYS_BUILD_DYNINST=ON
|
||||
-DROCPROFSYS_BUILD_BOOST=ON
|
||||
-DROCPROFSYS_BUILD_TBB=ON
|
||||
-DROCPROFSYS_BUILD_ELFUTILS=ON
|
||||
-DROCPROFSYS_BUILD_LIBIBERTY=ON
|
||||
-DROCPROFSYS_USE_PYTHON=${{ matrix.python }}
|
||||
-DROCPROFSYS_USE_MPI_HEADERS=${{ matrix.mpi-headers }}
|
||||
-DROCPROFSYS_STRIP_LIBRARIES=${{ matrix.strip }}
|
||||
@@ -346,6 +351,11 @@ jobs:
|
||||
-DROCPROFSYS_USE_OMPT=OFF
|
||||
-DROCPROFSYS_USE_PYTHON=ON
|
||||
-DROCPROFSYS_USE_MPI_HEADERS=${{ matrix.mpi-headers }}
|
||||
-DROCPROFSYS_BUILD_DYNINST=ON
|
||||
-DROCPROFSYS_BUILD_BOOST=ON
|
||||
-DROCPROFSYS_BUILD_TBB=ON
|
||||
-DROCPROFSYS_BUILD_ELFUTILS=ON
|
||||
-DROCPROFSYS_BUILD_LIBIBERTY=ON
|
||||
-DROCPROFSYS_USE_SANITIZER=OFF
|
||||
-DROCPROFSYS_PYTHON_PREFIX=/opt/conda/envs
|
||||
-DROCPROFSYS_PYTHON_ENVS="py3.6;py3.7;py3.8;py3.9;py3.10;py3.11"
|
||||
@@ -455,7 +465,11 @@ jobs:
|
||||
-DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-systems
|
||||
-DROCPROFSYS_BUILD_CI=OFF
|
||||
-DROCPROFSYS_BUILD_TESTING=ON
|
||||
-DROCPROFSYS_BUILD_DYNINST=OFF
|
||||
-DROCPROFSYS_BUILD_DYNINST=ON
|
||||
-DROCPROFSYS_BUILD_BOOST=ON
|
||||
-DROCPROFSYS_BUILD_TBB=ON
|
||||
-DROCPROFSYS_BUILD_ELFUTILS=ON
|
||||
-DROCPROFSYS_BUILD_LIBIBERTY=ON
|
||||
-DROCPROFSYS_BUILD_DEBUG=OFF
|
||||
-DROCPROFSYS_BUILD_HIDDEN_VISIBILITY=OFF
|
||||
-DROCPROFSYS_USE_MPI=ON
|
||||
|
||||
@@ -57,7 +57,7 @@ jobs:
|
||||
hidden: ['ON', 'OFF']
|
||||
build-type: ['Release']
|
||||
mpi-headers: ['ON', 'OFF']
|
||||
build-dyninst: ['OFF']
|
||||
build-dyninst: ['ON']
|
||||
rocm-version: ['0.0']
|
||||
|
||||
env:
|
||||
@@ -133,6 +133,10 @@ jobs:
|
||||
-DROCPROFSYS_USE_PYTHON=${{ matrix.python }}
|
||||
-DROCPROFSYS_USE_MPI_HEADERS=${{ matrix.mpi-headers }}
|
||||
-DROCPROFSYS_BUILD_DYNINST=${{ matrix.build-dyninst }}
|
||||
-DROCPROFSYS_BUILD_BOOST=${{ matrix.build-dyninst }}
|
||||
-DROCPROFSYS_BUILD_TBB=${{ matrix.build-dyninst }}
|
||||
-DROCPROFSYS_BUILD_ELFUTILS=${{ matrix.build-dyninst }}
|
||||
-DROCPROFSYS_BUILD_LIBIBERTY=${{ matrix.build-dyninst }}
|
||||
-DROCPROFSYS_BUILD_HIDDEN_VISIBILITY=${{ matrix.hidden }}
|
||||
-DROCPROFSYS_PYTHON_PREFIX=/opt/conda/envs
|
||||
-DROCPROFSYS_PYTHON_ENVS="py3.7;py3.8;py3.9;py3.10;py3.11"
|
||||
@@ -210,7 +214,7 @@ jobs:
|
||||
hidden: ['ON']
|
||||
build-type: ['Release']
|
||||
mpi-headers: ['OFF']
|
||||
build-dyninst: ['OFF']
|
||||
build-dyninst: ['ON']
|
||||
rocm-version: ['6.3', '6.4']
|
||||
|
||||
env:
|
||||
@@ -310,6 +314,10 @@ jobs:
|
||||
-DROCPROFSYS_USE_PYTHON=${{ matrix.python }}
|
||||
-DROCPROFSYS_USE_MPI_HEADERS=${{ matrix.mpi-headers }}
|
||||
-DROCPROFSYS_BUILD_DYNINST=${{ matrix.build-dyninst }}
|
||||
-DROCPROFSYS_BUILD_BOOST=${{ matrix.build-dyninst }}
|
||||
-DROCPROFSYS_BUILD_TBB=${{ matrix.build-dyninst }}
|
||||
-DROCPROFSYS_BUILD_ELFUTILS=${{ matrix.build-dyninst }}
|
||||
-DROCPROFSYS_BUILD_LIBIBERTY=${{ matrix.build-dyninst }}
|
||||
-DROCPROFSYS_BUILD_HIDDEN_VISIBILITY=${{ matrix.hidden }}
|
||||
-DROCPROFSYS_PYTHON_PREFIX=/opt/conda/envs
|
||||
-DROCPROFSYS_PYTHON_ENVS="py3.7;py3.8;py3.9;py3.10;py3.11"
|
||||
|
||||
@@ -105,6 +105,11 @@ jobs:
|
||||
-DROCPROFSYS_DISABLE_EXAMPLES="transpose;rccl;openmp-target" \
|
||||
-DROCPROFSYS_USE_ROCM=${USE_ROCM} \
|
||||
-DRCOPROFSYS_USE_PYTHON=ON \
|
||||
-DROCPROFSYS_BUILD_DYNINST=ON \
|
||||
-DROCPROFSYS_BUILD_BOOST=ON \
|
||||
-DROCPROFSYS_BUILD_TBB=ON \
|
||||
-DROCPROFSYS_BUILD_ELFUTILS=ON \
|
||||
-DROCPROFSYS_BUILD_LIBIBERTY=ON \
|
||||
-DROCPROFSYS_STRIP_LIBRARIES=${{ matrix.strip }} \
|
||||
-DROCPROFSYS_PYTHON_PREFIX=/opt/conda/envs \
|
||||
-DROCPROFSYS_PYTHON_ENVS="py3.8;py3.9;py3.10;py3.11;py3.12"
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
[submodule "external/dyninst"]
|
||||
path = external/dyninst
|
||||
url = https://github.com/ROCm/dyninst.git
|
||||
branch = dyninst_13
|
||||
[submodule "external/PTL"]
|
||||
path = external/PTL
|
||||
url = https://github.com/jrmadsen/PTL.git
|
||||
|
||||
@@ -9,6 +9,11 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND CMAKE_CURRENT_SOURCE_DIR STREQ
|
||||
message(AUTHOR_WARNING "In-source build")
|
||||
endif()
|
||||
|
||||
# find_package() uses upper-case <PACKAGENAME>_ROOT variables.
|
||||
if(POLICY CMP0144)
|
||||
cmake_policy(SET CMP0144 NEW)
|
||||
endif()
|
||||
|
||||
if(NOT UNIX OR APPLE)
|
||||
message(
|
||||
AUTHOR_WARNING
|
||||
|
||||
@@ -150,16 +150,16 @@ if(ROCPROFSYS_USE_PAPI AND NOT ROCPROFSYS_BUILD_PAPI)
|
||||
list(APPEND _DEBIAN_PACKAGE_DEPENDS libpapi-dev libpfm4)
|
||||
endif()
|
||||
if(NOT ROCPROFSYS_BUILD_DYNINST)
|
||||
if(NOT DYNINST_BUILD_BOOST)
|
||||
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)")
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT DYNINST_BUILD_TBB)
|
||||
if(NOT ROCPROFSYS_BUILD_TBB)
|
||||
list(APPEND _DEBIAN_PACKAGE_DEPENDS "libtbb-dev (>= 2018.6)")
|
||||
endif()
|
||||
if(NOT DYNINST_BUILD_LIBIBERTY)
|
||||
if(NOT ROCPROFSYS_BUILD_LIBIBERTY)
|
||||
list(APPEND _DEBIAN_PACKAGE_DEPENDS "libiberty-dev (>= 20170913)")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -0,0 +1,389 @@
|
||||
# ========================================================================================================
|
||||
# Boost.cmake
|
||||
#
|
||||
# Configure Boost for Dyninst
|
||||
#
|
||||
# ----------------------------------------
|
||||
#
|
||||
# Accepts the following CMake variables
|
||||
#
|
||||
# Boost_ROOT_DIR - Hint directory that contains the Boost installation
|
||||
# PATH_BOOST - Alias for Boost_ROOT_DIR Boost_MIN_VERSION - Minimum
|
||||
# acceptable version of Boost Boost_USE_MULTITHREADED - Use the multithreaded version of
|
||||
# Boost Boost_USE_STATIC_RUNTIME - Use libraries linked statically to the C++ runtime
|
||||
#
|
||||
# Options inherited from Modules/FindBoost.cmake that may be useful
|
||||
#
|
||||
# BOOST_INCLUDEDIR - Hint directory that contains the Boost headers files
|
||||
# BOOST_LIBRARYDIR - Hint directory that contains the Boost library files
|
||||
#
|
||||
# Advanced options:
|
||||
#
|
||||
# Boost_DEBUG - Enable debug output from FindBoost Boost_NO_SYSTEM_PATHS -
|
||||
# Disable searching in locations not specified by hint variables
|
||||
#
|
||||
# Exports the following CMake cache variables
|
||||
#
|
||||
# Boost_ROOT_DIR - Computed base directory the of Boost installation
|
||||
# Boost_INCLUDE_DIRS - Boost include directories Boost_INCLUDE_DIR - Alias for
|
||||
# Boost_INCLUDE_DIRS Boost_LIBRARY_DIRS - Link directories for Boost libraries
|
||||
# Boost_DEFINES - Boost compiler definitions Boost_LIBRARIES - Boost
|
||||
# library files Boost_<C>_LIBRARY_RELEASE - Release libraries to link for component <C>
|
||||
# (<C> is upper-case) Boost_<C>_LIBRARY_DEBUG - Debug libraries to link for component
|
||||
# <C> Boost_THREAD_LIBRARY - The filename of the Boost thread library
|
||||
# Boost_USE_MULTITHREADED - Use the multithreaded version of Boost
|
||||
# Boost_USE_STATIC_RUNTIME - Use libraries linked statically to the C++ runtime
|
||||
#
|
||||
# NOTE: The exported Boost_ROOT_DIR can be different from the value provided by the user
|
||||
# in the case that it is determined to build Boost from source. In such a case,
|
||||
# Boost_ROOT_DIR will contain the directory of the from-source installation.
|
||||
#
|
||||
# See Modules/FindBoost.cmake for additional input and exported variables
|
||||
#
|
||||
# ========================================================================================================
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# always provide Dyninst::Boost even if it is empty
|
||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-boost
|
||||
"Boost interface library")
|
||||
|
||||
if(NOT BUILD_BOOST)
|
||||
find_package(Boost)
|
||||
endif()
|
||||
|
||||
if(Boost_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Need at least Boost-1.67 because of deprecated headers
|
||||
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")
|
||||
|
||||
# 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")
|
||||
|
||||
# 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")
|
||||
|
||||
# If using multithreaded Boost, make sure Threads has been intialized
|
||||
if(Boost_USE_MULTITHREADED AND NOT DEFINED CMAKE_THREAD_LIBS_INIT)
|
||||
find_package(Threads)
|
||||
endif()
|
||||
|
||||
# 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")
|
||||
|
||||
# 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")
|
||||
endif()
|
||||
|
||||
# Provide a default root directory
|
||||
if(NOT PATH_BOOST AND NOT Boost_ROOT_DIR)
|
||||
set(PATH_BOOST "/usr")
|
||||
endif()
|
||||
|
||||
# Set the default location to look for Boost
|
||||
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})
|
||||
|
||||
# -------------- COMPILER DEFINES ---------------------------------------------
|
||||
|
||||
set(_boost_defines)
|
||||
|
||||
# Disable auto-linking
|
||||
list(APPEND _boost_defines BOOST_ALL_NO_LIB=1)
|
||||
|
||||
# Disable generating serialization code in boost::multi_index
|
||||
list(APPEND _boost_defines BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
|
||||
|
||||
# There are broken versions of MSVC that won't handle variadic templates correctly
|
||||
# (despite the C++11 test case passing).
|
||||
if(MSVC)
|
||||
list(APPEND _boost_defines BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
endif()
|
||||
|
||||
set(Boost_DEFINES
|
||||
${_boost_defines}
|
||||
CACHE STRING "Boost compiler defines")
|
||||
add_compile_definitions(${Boost_DEFINES})
|
||||
|
||||
# -------------- INTERNALS ----------------------------------------------------
|
||||
|
||||
# Disable Boost's own CMake as it's known to be buggy NB: This should not be a cache
|
||||
# variable
|
||||
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)
|
||||
|
||||
if(NOT BUILD_BOOST)
|
||||
find_package(Boost ${Boost_MIN_VERSION} QUIET COMPONENTS ${_boost_components})
|
||||
endif()
|
||||
|
||||
# -------------- SOURCE BUILD -------------------------------------------------
|
||||
|
||||
if(Boost_FOUND AND NOT BUILD_BOOST)
|
||||
# Force the cache entries to be updated Normally, these would not be exported.
|
||||
# However, we need them in the Testsuite
|
||||
set(Boost_INCLUDE_DIRS
|
||||
${Boost_INCLUDE_DIRS}
|
||||
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)
|
||||
elseif(NOT Boost_FOUND AND STERILE_BUILD)
|
||||
rocprofiler_systems_message(
|
||||
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)
|
||||
# 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")
|
||||
|
||||
# If the user specifies a version other than ROCPROFSYS_BOOST_DOWNLOAD_VERSION, use
|
||||
# that version.
|
||||
if(${ROCPROFSYS_BOOST_DOWNLOAD_VERSION} VERSION_LESS ${Boost_MIN_VERSION})
|
||||
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)
|
||||
else()
|
||||
set(_boost_threading single)
|
||||
endif()
|
||||
|
||||
if(Boost_USE_STATIC_RUNTIME)
|
||||
set(_boost_runtime_link static)
|
||||
else()
|
||||
set(_boost_runtime_link shared)
|
||||
endif()
|
||||
|
||||
# Change the base directory
|
||||
set(Boost_ROOT_DIR
|
||||
${TPL_STAGING_PREFIX}/boost
|
||||
CACHE PATH "Base directory the of Boost installation" FORCE)
|
||||
|
||||
# Update the exported variables
|
||||
set(Boost_INCLUDE_DIRS
|
||||
"$<BUILD_INTERFACE:${Boost_ROOT_DIR}/include>;$<INSTALL_INTERFACE:${CMAKE_INSTALL_LIBDIR}/${TPL_INSTALL_INCLUDE_DIR}>"
|
||||
CACHE PATH "Boost include directory" FORCE)
|
||||
set(Boost_LIBRARY_DIRS
|
||||
"$<BUILD_INTERFACE:${Boost_ROOT_DIR}/lib>;$<INSTALL_INTERFACE:${CMAKE_INSTALL_LIBDIR}/${TPL_INSTALL_LIB_DIR}>"
|
||||
CACHE PATH "Boost library directory" FORCE)
|
||||
set(Boost_INCLUDE_DIR
|
||||
${Boost_INCLUDE_DIRS}
|
||||
CACHE PATH "Boost include directory" FORCE)
|
||||
|
||||
file(MAKE_DIRECTORY ${Boost_ROOT_DIR}/include)
|
||||
file(MAKE_DIRECTORY ${Boost_ROOT_DIR}/lib)
|
||||
|
||||
if(BOOST_LINK_STATIC)
|
||||
set(_BOOST_LINK static)
|
||||
else()
|
||||
set(_BOOST_LINK shared)
|
||||
endif()
|
||||
|
||||
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
|
||||
set(BOOST_BOOTSTRAP call bootstrap.bat)
|
||||
set(BOOST_BUILD ".\\b2")
|
||||
if(CMAKE_SIZEOF_VOID_P STREQUAL "8")
|
||||
list(APPEND BOOST_ARGS address-model=64)
|
||||
endif()
|
||||
else()
|
||||
set(BOOST_BOOTSTRAP "./bootstrap.sh")
|
||||
set(BOOST_BUILD "./b2")
|
||||
if(CMAKE_BUILD_TYPE MATCHES "^(Debug|DEBUG)$")
|
||||
list(APPEND BOOST_ARGS variant=debug)
|
||||
else()
|
||||
list(APPEND BOOST_ARGS variant=release)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Join the component names together to pass to --with-libraries during bootstrap
|
||||
set(_boost_lib_names "headers,")
|
||||
foreach(c ${_boost_components})
|
||||
# list(JOIN ...) is in cmake 3.12
|
||||
string(CONCAT _boost_lib_names "${_boost_lib_names}${c},")
|
||||
endforeach()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang|Intel)")
|
||||
list(APPEND BOOST_ARGS cflags=-fPIC cxxflags=-fPIC)
|
||||
endif()
|
||||
|
||||
string(REPLACE "." "_" _boost_download_filename ${ROCPROFSYS_BOOST_DOWNLOAD_VERSION})
|
||||
# zip is subject to locales on Unix
|
||||
set(_boost_download_ext "zip")
|
||||
if(UNIX)
|
||||
set(_boost_download_ext "tar.gz")
|
||||
endif()
|
||||
|
||||
set(_LIB_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
if(BOOST_LINK_STATIC)
|
||||
set(_LIB_SUFFIX "${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
# We need to specify different library names for debug vs release
|
||||
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}")
|
||||
set(Boost_${c}_LIBRARY
|
||||
$<BUILD_INTERFACE:${Boost_ROOT_DIR}/lib/libboost_${c}${_LIB_SUFFIX}>
|
||||
$<INSTALL_INTERFACE:boost_${c}>)
|
||||
set(Boost_${c}_LIBRARY_DEBUG
|
||||
$<BUILD_INTERFACE:${Boost_ROOT_DIR}/lib/libboost_${c}${_LIB_SUFFIX}>
|
||||
$<INSTALL_INTERFACE:libboost_${c}-gd>)
|
||||
|
||||
# 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)
|
||||
set(Boost_${_basename}_LIBRARY_DEBUG
|
||||
"${Boost_${c}_LIBRARY_DEBUG}"
|
||||
CACHE FILEPATH "" FORCE)
|
||||
endforeach()
|
||||
else()
|
||||
# Transform the component names into the library filenames e.g., system ->
|
||||
# boost_system
|
||||
set(Boost_LIBRARIES "")
|
||||
foreach(c ${_boost_components})
|
||||
set(Boost_${c}_LIBRARY
|
||||
$<BUILD_INTERFACE:${Boost_ROOT_DIR}/lib/libboost_${c}${_LIB_SUFFIX}>
|
||||
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${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_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)
|
||||
set(Boost_${_basename}_LIBRARY_DEBUG
|
||||
"${Boost_${c}_LIBRARY}"
|
||||
CACHE FILEPATH "" FORCE)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
include(ExternalProject)
|
||||
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
|
||||
BUILD_BYPRODUCTS ${_boost_build_byproducts}
|
||||
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...")
|
||||
endif()
|
||||
|
||||
# -------------- EXPORT VARIABLES ---------------------------------------------
|
||||
|
||||
# Export Boost_THREAD_LIBRARY
|
||||
list(FIND _boost_components "thread" _building_threads)
|
||||
if(Boost_USE_MULTITHREADED AND ${_building_threads})
|
||||
# On Windows, always use the debug version On Linux, we don't use tagged builds, so
|
||||
# the debug/release filenames are the same
|
||||
set(Boost_THREAD_LIBRARY
|
||||
${Boost_THREAD_LIBRARY_DEBUG}
|
||||
CACHE FILEPATH "Boost thread library")
|
||||
endif()
|
||||
|
||||
# Add the system thread library
|
||||
if(Boost_USE_MULTITHREADED)
|
||||
list(APPEND Boost_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
# Export the complete set of libraries
|
||||
set(Boost_LIBRARIES
|
||||
${Boost_LIBRARIES}
|
||||
CACHE FILEPATH "Boost library files" FORCE)
|
||||
|
||||
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})
|
||||
|
||||
rocprofiler_systems_message(STATUS "Boost includes: ${Boost_INCLUDE_DIRS}")
|
||||
rocprofiler_systems_message(STATUS "Boost library dirs: ${Boost_LIBRARY_DIRS}")
|
||||
rocprofiler_systems_message(STATUS "Boost thread library: ${Boost_THREAD_LIBRARY}")
|
||||
rocprofiler_systems_message(STATUS "Boost libraries: ${Boost_LIBRARIES}")
|
||||
|
||||
# Just the headers (effectively a simplified Boost::headers target)
|
||||
add_library(Dyninst::Boost_headers INTERFACE IMPORTED)
|
||||
target_include_directories(Dyninst::Boost_headers SYSTEM INTERFACE ${Boost_INCLUDE_DIRS})
|
||||
@@ -0,0 +1,218 @@
|
||||
# ======================================================================================
|
||||
# elfutils.cmake
|
||||
#
|
||||
# Configure elfutils for Dyninst
|
||||
#
|
||||
# ----------------------------------------
|
||||
#
|
||||
# Accepts the following CMake variables
|
||||
#
|
||||
# ElfUtils_ROOT_DIR - Base directory the of elfutils installation
|
||||
# ElfUtils_INCLUDEDIR - Hint directory that contains the elfutils headers files
|
||||
# ElfUtils_LIBRARYDIR - Hint directory that contains the elfutils library files
|
||||
# ElfUtils_MIN_VERSION - Minimum acceptable version of elfutils
|
||||
#
|
||||
# Directly exports the following CMake variables
|
||||
#
|
||||
# ElfUtils_ROOT_DIR - Computed base directory the of elfutils installation
|
||||
# ElfUtils_INCLUDE_DIRS - elfutils include directories ElfUtils_LIBRARY_DIRS - Link
|
||||
# directories for elfutils libraries ElfUtils_LIBRARIES - elfutils library files
|
||||
#
|
||||
# NOTE: The exported ElfUtils_ROOT_DIR can be different from the value provided by the
|
||||
# user in the case that it is determined to build elfutils from source. In such a case,
|
||||
# ElfUtils_ROOT_DIR will contain the directory of the from-source installation.
|
||||
#
|
||||
# See Modules/FindLibElf.cmake and Modules/FindLibDwarf.cmake for details
|
||||
#
|
||||
# ======================================================================================
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# always provide Dyninst::ElfUtils even if it is a dummy
|
||||
rocprofiler_systems_add_interface_library(ElfUtils "ElfUtils interface library")
|
||||
|
||||
if(NOT BUILD_ELFUTILS)
|
||||
find_package(Elfutils)
|
||||
endif()
|
||||
|
||||
if(LibElf_FOUND
|
||||
AND LibDwarf_FOUND
|
||||
AND NOT ENABLE_DEBUGINFOD)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT UNIX)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Minimum acceptable version of elfutils NB: We need >=0.178 because libdw isn't
|
||||
# thread-safe before then
|
||||
set(_min_version 0.178)
|
||||
|
||||
set(ElfUtils_MIN_VERSION
|
||||
${_min_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")
|
||||
|
||||
# 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")
|
||||
|
||||
# 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")
|
||||
|
||||
# libelf/dwarf-specific directory hints
|
||||
foreach(l LibElf LibDwarf LibDebuginfod)
|
||||
foreach(d ROOT_DIR INCLUDEDIR LIBRARYDIR)
|
||||
set(${l}_${d} ${ElfUtils_${d}})
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
# -------------- PACKAGES------------------------------------------------------
|
||||
|
||||
if(NOT BUILD_ELFUTILS)
|
||||
find_package(LibElf ${ElfUtils_MIN_VERSION})
|
||||
|
||||
# Don't search for libdw or libdebuginfod if we didn't find a suitable libelf
|
||||
if(LibElf_FOUND)
|
||||
find_package(LibDwarf ${ElfUtils_MIN_VERSION})
|
||||
if(ENABLE_DEBUGINFOD)
|
||||
find_package(LibDebuginfod ${ElfUtils_MIN_VERSION} REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# -------------- SOURCE BUILD -------------------------------------------------
|
||||
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_libs ${LibElf_LIBRARIES} ${LibDwarf_LIBRARIES} ${LibDebuginfod_LIBRARIES})
|
||||
else()
|
||||
set(_eu_root ${ElfUtils_ROOT_DIR})
|
||||
set(_eu_inc_dirs ${LibElf_INCLUDE_DIRS} ${LibDwarf_INCLUDE_DIRS})
|
||||
set(_eu_lib_dirs ${LibElf_LIBRARY_DIRS} ${LibDwarf_LIBRARY_DIRS})
|
||||
set(_eu_libs ${LibElf_LIBRARIES} ${LibDwarf_LIBRARIES})
|
||||
endif()
|
||||
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.")
|
||||
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")
|
||||
set(ELFUTILS_DOWNLOAD_VERSION ${ElfUtils_DOWNLOAD_VERSION})
|
||||
|
||||
# make sure we are not downloading a version less than minimum
|
||||
if(${ELFUTILS_DOWNLOAD_VERSION} VERSION_LESS ${ElfUtils_MIN_VERSION})
|
||||
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")
|
||||
|
||||
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")
|
||||
endif()
|
||||
|
||||
set(_eu_root ${TPL_STAGING_PREFIX})
|
||||
set(_eu_inc_dirs $<BUILD_INTERFACE:${_eu_root}/include>
|
||||
$<INSTALL_INTERFACE:${INSTALL_LIB_DIR}/${TPL_INSTALL_INCLUDE_DIR}>)
|
||||
set(_eu_lib_dirs $<BUILD_INTERFACE:${_eu_root}/lib>
|
||||
$<INSTALL_INTERFACE:${INSTALL_LIB_DIR}/${TPL_INSTALL_LIB_DIR}>)
|
||||
set(_eu_libs
|
||||
$<BUILD_INTERFACE:${_eu_root}/lib/libdw${CMAKE_SHARED_LIBRARY_SUFFIX}>
|
||||
$<BUILD_INTERFACE:${_eu_root}/lib/libelf${CMAKE_SHARED_LIBRARY_SUFFIX}>
|
||||
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${INSTALL_LIB_DIR}/${TPL_INSTALL_LIB_DIR}/libdw${CMAKE_SHARED_LIBRARY_SUFFIX}>
|
||||
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${INSTALL_LIB_DIR}/${TPL_INSTALL_LIB_DIR}/libelf${CMAKE_SHARED_LIBRARY_SUFFIX}>
|
||||
)
|
||||
set(_eu_build_byproducts "${_eu_root}/lib/libdw${CMAKE_SHARED_LIBRARY_SUFFIX}"
|
||||
"${_eu_root}/lib/libelf${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
|
||||
include(ExternalProject)
|
||||
externalproject_add(
|
||||
ElfUtils-External
|
||||
PREFIX ${PROJECT_BINARY_DIR}/elfutils
|
||||
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
|
||||
CONFIGURE_COMMAND
|
||||
${CMAKE_COMMAND} -E env CC=${CMAKE_C_COMPILER} CFLAGS=-fPIC\ -O3
|
||||
CXX=${CMAKE_CXX_COMPILER} CXXFLAGS=-fPIC\ -O3
|
||||
[=[LDFLAGS=-Wl,-rpath='$$ORIGIN']=] <SOURCE_DIR>/configure
|
||||
--enable-install-elfh --prefix=${TPL_STAGING_PREFIX} --disable-libdebuginfod
|
||||
--disable-debuginfod --enable-thread-safety ${ElfUtils_CONFIG_OPTIONS}
|
||||
--libdir=${TPL_STAGING_PREFIX}/lib
|
||||
BUILD_COMMAND make install
|
||||
BUILD_BYPRODUCTS ${_eu_build_byproducts}
|
||||
INSTALL_COMMAND "")
|
||||
|
||||
# target for re-executing the installation
|
||||
add_custom_target(
|
||||
install-elfutils-external
|
||||
COMMAND make install
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/elfutils/src/ElfUtils-External
|
||||
COMMENT "Installing ElfUtils...")
|
||||
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)
|
||||
set(ElfUtils_INCLUDE_DIR
|
||||
${ElfUtils_INCLUDE_DIRS}
|
||||
CACHE PATH "elfutils include directory" FORCE)
|
||||
set(ElfUtils_LIBRARIES
|
||||
${_eu_libs}
|
||||
CACHE FILEPATH "elfutils library files" FORCE)
|
||||
|
||||
target_include_directories(ElfUtils SYSTEM INTERFACE ${ElfUtils_INCLUDE_DIRS})
|
||||
target_compile_definitions(ElfUtils INTERFACE ${ElfUtils_DEFINITIONS})
|
||||
target_link_directories(ElfUtils INTERFACE ${ElfUtils_LIBRARY_DIRS})
|
||||
target_link_libraries(ElfUtils INTERFACE ${ElfUtils_LIBRARIES})
|
||||
|
||||
rocprofiler_systems_message(STATUS "ElfUtils includes: ${ElfUtils_INCLUDE_DIRS}")
|
||||
rocprofiler_systems_message(STATUS "ElfUtils library dirs: ${ElfUtils_LIBRARY_DIRS}")
|
||||
rocprofiler_systems_message(STATUS "ElfUtils libraries: ${ElfUtils_LIBRARIES}")
|
||||
@@ -0,0 +1,132 @@
|
||||
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. Use ROCPROFSYS_BUILD_${dep} instead."
|
||||
)
|
||||
set(ROCPROFSYS_BUILD_${dep} ON)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Set BUILD_* to ON if ROCPROFSYS_BUILD_* is ON
|
||||
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)
|
||||
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)
|
||||
elseif(dep STREQUAL "LIBIBERTY")
|
||||
rocprofiler_systems_add_option(BUILD_LIBIBERTY
|
||||
"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")
|
||||
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 ElfUtils-External AND TARGET external-prebuild)
|
||||
set_target_properties(ElfUtils-External PROPERTIES JOB_POOL_COMPILE external_deps_pool
|
||||
JOB_POOL_LINK external_deps_pool)
|
||||
add_dependencies(external-prebuild ElfUtils-External)
|
||||
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 ElfUtils)
|
||||
add_library(Dyninst::ElfUtils INTERFACE IMPORTED)
|
||||
set_target_properties(Dyninst::ElfUtils PROPERTIES INTERFACE_LINK_LIBRARIES 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()
|
||||
|
||||
# for packaging
|
||||
install(
|
||||
DIRECTORY ${TPL_STAGING_PREFIX}/lib/
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
|
||||
FILES_MATCHING
|
||||
PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*"
|
||||
PATTERN "*${CMAKE_STATIC_LIBRARY_SUFFIX}*")
|
||||
|
||||
install(
|
||||
DIRECTORY ${TPL_STAGING_PREFIX}/tbb/lib/
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
|
||||
FILES_MATCHING
|
||||
PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*"
|
||||
PATTERN "*${CMAKE_STATIC_LIBRARY_SUFFIX}*")
|
||||
@@ -0,0 +1,151 @@
|
||||
# ======================================================================================
|
||||
# LibIberty.cmake
|
||||
#
|
||||
# Configure LibIberty for Dyninst
|
||||
#
|
||||
# ----------------------------------------
|
||||
#
|
||||
# Directly exports the following CMake variables
|
||||
#
|
||||
# LibIberty_ROOT_DIR - Computed base directory the of LibIberty installation
|
||||
# LibIberty_LIBRARY_DIRS - Link directories for LibIberty libraries LibIberty_LIBRARIES
|
||||
# - LibIberty library files LibIberty_INCLUDE - LibIberty include files
|
||||
#
|
||||
# NOTE: The exported LibIberty_ROOT_DIR can be different from the value provided by the
|
||||
# user in the case that it is determined to build LibIberty from source. In such a case,
|
||||
# LibIberty_ROOT_DIR will contain the directory of the from-source installation.
|
||||
#
|
||||
# See Modules/FindLibIberty.cmake for details
|
||||
#
|
||||
# ======================================================================================
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# always provide Dyninst::LibIberty even if it is empty
|
||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-libiberty
|
||||
"LibIberty interface library")
|
||||
|
||||
if(NOT UNIX)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# -------------- PATHS --------------------------------------------------------
|
||||
|
||||
# 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")
|
||||
|
||||
# -------------- PACKAGES -----------------------------------------------------
|
||||
|
||||
if(NOT BUILD_LIBIBERTY)
|
||||
find_package(LibIberty)
|
||||
endif()
|
||||
|
||||
# -------------- SOURCE BUILD -------------------------------------------------
|
||||
if(LibIberty_FOUND)
|
||||
set(_li_root ${LibIberty_ROOT_DIR})
|
||||
set(_li_inc_dirs ${LibIberty_INCLUDE_DIRS})
|
||||
set(_li_lib_dirs ${LibIberty_LIBRARY_DIRS})
|
||||
set(_li_libs ${LibIberty_LIBRARIES})
|
||||
elseif(STERILE_BUILD)
|
||||
rocprofiler_systems_message(
|
||||
FATAL_ERROR
|
||||
"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")
|
||||
|
||||
set(_li_root ${TPL_STAGING_PREFIX}/binutils)
|
||||
set(_li_project_name rocprofiler-systems-libiberty-build)
|
||||
set(_li_working_dir ${_li_root}/src/${_li_project_name})
|
||||
set(_li_inc_dirs $<BUILD_INTERFACE:${_li_root}/include>)
|
||||
set(_li_lib_dirs $<BUILD_INTERFACE:${_li_root}/lib>
|
||||
$<INSTALL_INTERFACE:${INSTALL_LIB_DIR}/${TPL_INSTALL_LIB_DIR}>)
|
||||
set(_li_libs
|
||||
$<BUILD_INTERFACE:${_li_root}/lib/libiberty${CMAKE_STATIC_LIBRARY_SUFFIX}>
|
||||
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${INSTALL_LIB_DIR}/${TPL_INSTALL_LIB_DIR}/libiberty${CMAKE_STATIC_LIBRARY_SUFFIX}>
|
||||
)
|
||||
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(
|
||||
${_li_project_name}
|
||||
PREFIX ${_li_root}
|
||||
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
|
||||
CONFIGURE_COMMAND
|
||||
${CMAKE_COMMAND} -E env CC=${CMAKE_C_COMPILER} CFLAGS=-fPIC\ -O3
|
||||
CXX=${CMAKE_CXX_COMPILER} CXXFLAGS=-fPIC\ -O3 <SOURCE_DIR>/configure
|
||||
--prefix=${_li_root}
|
||||
BUILD_COMMAND make
|
||||
BUILD_BYPRODUCTS ${_li_build_byproducts}
|
||||
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...")
|
||||
|
||||
# target for re-executing the installation
|
||||
add_custom_target(
|
||||
rocprofiler-systems-libiberty-install
|
||||
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...")
|
||||
|
||||
# For backward compatibility
|
||||
set(IBERTY_FOUND TRUE)
|
||||
set(IBERTY_BUILD TRUE)
|
||||
endif()
|
||||
|
||||
# -------------- EXPORT VARIABLES ---------------------------------------------
|
||||
|
||||
foreach(_DIR_TYPE inc lib)
|
||||
if(_li_${_DIR_TYPE}_dirs)
|
||||
list(REMOVE_DUPLICATES _li_${_DIR_TYPE}_dirs)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
target_include_directories(rocprofiler-systems-libiberty INTERFACE ${_li_inc_dirs})
|
||||
target_link_directories(rocprofiler-systems-libiberty INTERFACE ${_lib_lib_dirs})
|
||||
target_link_libraries(rocprofiler-systems-libiberty INTERFACE ${_li_libs})
|
||||
|
||||
set(LibIberty_ROOT_DIR
|
||||
${_li_root}
|
||||
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)
|
||||
|
||||
# For backward compatibility only
|
||||
set(IBERTY_LIBRARIES ${LibIberty_LIBRARIES})
|
||||
|
||||
rocprofiler_systems_message(STATUS "LibIberty include dirs: ${LibIberty_INCLUDE_DIRS}")
|
||||
rocprofiler_systems_message(STATUS "LibIberty library dirs: ${LibIberty_LIBRARY_DIRS}")
|
||||
rocprofiler_systems_message(STATUS "LibIberty libraries: ${LibIberty_LIBRARIES}")
|
||||
@@ -0,0 +1,260 @@
|
||||
# =====================================================================================
|
||||
# ThreadingBuildingBlocks.cmake
|
||||
#
|
||||
# Configure Intel's Threading Building Blocks for Dyninst
|
||||
#
|
||||
# ----------------------------------------
|
||||
#
|
||||
# Accepts the following CMake variables
|
||||
#
|
||||
# TBB_ROOT_DIR - Hint directory that contains the TBB installation TBB_INCLUDEDIR -
|
||||
# Hint directory that contains the TBB headers files TBB_LIBRARYDIR - Hint directory
|
||||
# that contains the TBB library files TBB_LIBRARY - Alias for TBB_LIBRARYDIR
|
||||
# TBB_USE_DEBUG_BUILD - Use debug version of tbb libraries, if present TBB_MIN_VERSION -
|
||||
# Minimum acceptable version of TBB
|
||||
#
|
||||
# Directly exports the following CMake variables
|
||||
#
|
||||
# TBB_ROOT_DIR - Computed base directory of TBB installation TBB_INCLUDE_DIRS -
|
||||
# TBB include directory TBB_INCLUDE_DIR - Alias for TBB_INCLUDE_DIRS TBB_LIBRARY_DIRS
|
||||
# - TBB library directory TBB_LIBRARY_DIR - Alias for TBB_LIBRARY_DIRS TBB_DEFINITIONS -
|
||||
# TBB compiler definitions TBB_LIBRARIES - TBB library files
|
||||
#
|
||||
# TBB_<c>_LIBRARY_RELEASE - Path to the release version of component <c>
|
||||
# TBB_<c>_LIBRARY_DEBUG - Path to the debug version of component <c>
|
||||
#
|
||||
# NOTE: The exported TBB_ROOT_DIR can be different from the value provided by the user in
|
||||
# the case that it is determined to build TBB from source. In such a case, TBB_ROOT_DIR
|
||||
# will contain the directory of the from-source installation.
|
||||
#
|
||||
# See Modules/FindTBB.cmake for additional input and exported variables
|
||||
#
|
||||
# =====================================================================================
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# always provide Dyninst::TBB even if it is a dummy
|
||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-tbb
|
||||
"Threading Building Blocks")
|
||||
|
||||
if(TBB_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# -------------- RUNTIME CONFIGURATION ----------------------------------------
|
||||
|
||||
# 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")
|
||||
set(_tbb_min_version 2019.7)
|
||||
else()
|
||||
set(_tbb_min_version 2018.6)
|
||||
endif()
|
||||
|
||||
set(TBB_MIN_VERSION
|
||||
${_tbb_min_version}
|
||||
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")
|
||||
|
||||
# TBB include directory hint
|
||||
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")
|
||||
|
||||
# Translate to FindTBB names
|
||||
set(TBB_LIBRARY ${TBB_LIBRARYDIR})
|
||||
set(TBB_INCLUDE_DIR ${TBB_INCLUDEDIR})
|
||||
|
||||
# The specific TBB libraries we need NB: This should _NOT_ be a cache variable
|
||||
set(_tbb_components tbb tbbmalloc_proxy tbbmalloc)
|
||||
|
||||
if(NOT BUILD_TBB)
|
||||
find_package(TBB ${TBB_MIN_VERSION} COMPONENTS ${_tbb_components})
|
||||
endif()
|
||||
|
||||
# -------------- SOURCE BUILD -------------------------------------------------
|
||||
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)
|
||||
elseif(STERILE_BUILD)
|
||||
rocprofiler_systems_message(
|
||||
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")
|
||||
|
||||
if(NOT UNIX)
|
||||
rocprofiler_systems_message(
|
||||
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_libraries)
|
||||
set(_tbb_components_cfg)
|
||||
set(_tbb_library_dirs $<BUILD_INTERFACE:${TBB_ROOT_DIR}/lib>
|
||||
$<INSTALL_INTERFACE:${INSTALL_LIB_DIR}/${TPL_INSTALL_LIB_DIR}>)
|
||||
set(_tbb_include_dirs
|
||||
$<BUILD_INTERFACE:${TBB_ROOT_DIR}/include>
|
||||
$<INSTALL_INTERFACE:${INSTALL_LIB_DIR}/${TPL_INSTALL_INCLUDE_DIR}>)
|
||||
|
||||
# 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)
|
||||
|
||||
file(MAKE_DIRECTORY "${TBB_ROOT_DIR}/include")
|
||||
file(MAKE_DIRECTORY "${TBB_ROOT_DIR}/lib")
|
||||
|
||||
foreach(c ${_tbb_components})
|
||||
# Generate make target names
|
||||
if(${c} STREQUAL tbbmalloc_proxy)
|
||||
# tbbmalloc_proxy is spelled tbbproxy in their Makefiles
|
||||
list(APPEND _tbb_components_cfg tbbproxy_release)
|
||||
else()
|
||||
list(APPEND _tbb_components_cfg ${c}_release)
|
||||
endif()
|
||||
|
||||
set(_tbb_${c}_lib
|
||||
$<BUILD_INTERFACE:${TBB_ROOT_DIR}/lib/lib${c}${CMAKE_SHARED_LIBRARY_SUFFIX}>
|
||||
$<INSTALL_INTERFACE:${c}>)
|
||||
|
||||
# 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}")
|
||||
|
||||
foreach(t RELEASE DEBUG)
|
||||
set(TBB_${c}_LIBRARY_${t}
|
||||
"${_tbb_${c}_lib}"
|
||||
CACHE FILEPATH "" FORCE)
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
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})
|
||||
list(GET _tbb_download_name 0 _tbb_ver_major)
|
||||
list(GET _tbb_download_name 1 _tbb_ver_minor)
|
||||
|
||||
# Set the compiler for TBB It assumes gcc and tests for Intel, so clang is the only
|
||||
# one that needs special treatment.
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
|
||||
set(_tbb_compiler "compiler=clang")
|
||||
endif()
|
||||
|
||||
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(
|
||||
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
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND
|
||||
${CMAKE_COMMAND} -E env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}
|
||||
[=[LDFLAGS=-Wl,-rpath='$$ORIGIN']=] ${MAKE_EXECUTABLE} -C src
|
||||
${_tbb_components_cfg} tbb_build_dir=${TBB_ROOT_DIR}/src tbb_build_prefix=tbb
|
||||
${_tbb_compiler}
|
||||
BUILD_BYPRODUCTS ${_tbb_build_byproducts}
|
||||
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
|
||||
${CMAKE_CURRENT_LIST_DIR}/DyninstTBBInstall.cmake
|
||||
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...")
|
||||
endif()
|
||||
|
||||
foreach(_DIR_TYPE INCLUDE LIBRARY)
|
||||
if(TBB_${_DIR_TYPE}_DIRS)
|
||||
list(REMOVE_DUPLICATES TBB_${_DIR_TYPE}_DIRS)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
target_include_directories(rocprofiler-systems-tbb SYSTEM INTERFACE ${TBB_INCLUDE_DIRS})
|
||||
target_compile_definitions(rocprofiler-systems-tbb INTERFACE ${TBB_DEFINITIONS})
|
||||
target_link_directories(rocprofiler-systems-tbb INTERFACE ${TBB_LIBRARY_DIRS})
|
||||
target_link_libraries(rocprofiler-systems-tbb INTERFACE ${TBB_LIBRARIES})
|
||||
|
||||
rocprofiler_systems_message(STATUS "TBB include directory: ${TBB_INCLUDE_DIRS}")
|
||||
rocprofiler_systems_message(STATUS "TBB library directory: ${TBB_LIBRARY_DIRS}")
|
||||
rocprofiler_systems_message(STATUS "TBB libraries: ${TBB_LIBRARIES}")
|
||||
rocprofiler_systems_message(STATUS "TBB definitions: ${TBB_DEFINITIONS}")
|
||||
@@ -0,0 +1,43 @@
|
||||
# ########################################################################################
|
||||
# ThreadingBuildingBlocks.cmake
|
||||
#
|
||||
# Install Intel's Threading Building Blocks for Dyninst
|
||||
#
|
||||
# The default TBB build does not have an 'install' target, so we have to do it manually.
|
||||
# This file contains the necessary CMake commands to complete the installation assuming it
|
||||
# has been built using ExternalProject_Add.
|
||||
#
|
||||
# ########################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.13.0)
|
||||
|
||||
if(NOT CMAKE_STRIP)
|
||||
find_program(CMAKE_STRIP NAMES strip)
|
||||
endif()
|
||||
|
||||
file(MAKE_DIRECTORY ${LIBDIR} ${INCDIR})
|
||||
file(
|
||||
COPY ${PREFIX}/src/tbb_release/
|
||||
DESTINATION ${LIBDIR}
|
||||
FILES_MATCHING
|
||||
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})
|
||||
endforeach()
|
||||
|
||||
foreach(_lib ${_tbb_libs})
|
||||
get_filename_component(_lib_realpath "${_lib}" REALPATH)
|
||||
if(NOT "${_lib_realpath}" IN_LIST _tbb_libs_realpath)
|
||||
list(APPEND _tbb_libs_realpath ${_lib_realpath})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach(_lib ${_tbb_libs_realpath})
|
||||
execute_process(COMMAND ${CMAKE_STRIP} ${_lib})
|
||||
endforeach()
|
||||
@@ -0,0 +1,141 @@
|
||||
#[=======================================================================[.rst:
|
||||
FindLibDW
|
||||
---------
|
||||
|
||||
Find libdw, the elfutils library for DWARF data and ELF file or process inspection.
|
||||
|
||||
Variables that affect this module
|
||||
|
||||
``LibDW_NO_SYSTEM_PATHS``
|
||||
If `True`, no system paths are searched.
|
||||
|
||||
Imported targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines the following :prop_tgt:`IMPORTED` target:
|
||||
|
||||
``LibDW::LibDW``
|
||||
The libdw library, if found.
|
||||
|
||||
Result variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module will set the following variables in your project:
|
||||
|
||||
``LibDW_INCLUDE_DIRS``
|
||||
where to find libdw.h, etc.
|
||||
``LibDW_LIBRARIES``
|
||||
the libraries to link against to use libdw.
|
||||
``LibDW_FOUND``
|
||||
If false, do not try to use libdw.
|
||||
``LibDW_VERSION``
|
||||
the version of the libdw library found
|
||||
|
||||
#]=======================================================================]
|
||||
cmake_policy(SET CMP0074 NEW) # Use <Package>_ROOT
|
||||
|
||||
if(LibDW_NO_SYSTEM_PATHS)
|
||||
set(_find_path_args NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH)
|
||||
endif()
|
||||
|
||||
# There is no way to tell pkg-config to ignore directories, so disable it
|
||||
if(NOT LibDW_NO_SYSTEM_PATHS)
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(NOT "x${LibDW_FIND_VERSION}" STREQUAL "x")
|
||||
set(_version ">=${LibDW_FIND_VERSION}")
|
||||
endif()
|
||||
if(LibDW_FIND_QUIETLY)
|
||||
set(_quiet "QUIET")
|
||||
endif()
|
||||
|
||||
pkg_check_modules(PC_LIBDW ${_quiet} "libdw${_version}")
|
||||
unset(_version)
|
||||
unset(_quiet)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(PC_LIBDW_FOUND)
|
||||
# FindPkgConfig sometimes gets the include dir wrong
|
||||
if("x${PC_LIBDW_INCLUDE_DIRS}" STREQUAL "x")
|
||||
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 "")
|
||||
else()
|
||||
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})
|
||||
|
||||
if(EXISTS "${LibDW_INCLUDE_DIRS}/version.h")
|
||||
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}")
|
||||
endif()
|
||||
unset(_version_line)
|
||||
unset(_version)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
LibDW
|
||||
FOUND_VAR LibDW_FOUND
|
||||
REQUIRED_VARS LibDW_LIBRARIES LibDW_INCLUDE_DIRS
|
||||
VERSION_VAR LibDW_VERSION)
|
||||
|
||||
if(LibDW_FOUND)
|
||||
mark_as_advanced(LibDW_INCLUDE_DIRS)
|
||||
mark_as_advanced(LibDW_LIBRARIES)
|
||||
mark_as_advanced(LibDW_VERSION)
|
||||
|
||||
# Some platforms explicitly list libelf as a dependency, so separate it out
|
||||
list(LENGTH LibDW_LIBRARIES _cnt)
|
||||
if(${_cnt} GREATER 1)
|
||||
foreach(_l ${LibDW_LIBRARIES})
|
||||
if(${_l} MATCHES "libdw")
|
||||
set(_libdw ${_l})
|
||||
else()
|
||||
list(APPEND _link_libs ${_l})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
unset(_cnt)
|
||||
|
||||
if(NOT TARGET LibDW::LibDW)
|
||||
add_library(LibDW::LibDW UNKNOWN IMPORTED)
|
||||
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}")
|
||||
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}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
unset(_find_path_args)
|
||||
@@ -0,0 +1,118 @@
|
||||
#[=======================================================================[.rst:
|
||||
FindLibDebuginfod
|
||||
-----------------
|
||||
|
||||
Find libdebuginfod, the elfutils library to query debuginfo files from debuginfod servers.
|
||||
|
||||
Variables that affect this module
|
||||
|
||||
``LibDebuginfod_NO_SYSTEM_PATHS``
|
||||
If `True`, no system paths are searched.
|
||||
|
||||
Imported targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines the following :prop_tgt:`IMPORTED` target:
|
||||
|
||||
``LibDebuginfod::LibDebuginfod``
|
||||
The libdebuginfod library, if found.
|
||||
|
||||
Result variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module will set the following variables in your project:
|
||||
|
||||
``LibDebuginfod_INCLUDE_DIRS``
|
||||
where to find debuginfod.h, etc.
|
||||
``LibDebuginfod_LIBRARIES``
|
||||
the libraries to link against to use libdebuginfod.
|
||||
``LibDebuginfod_FOUND``
|
||||
If false, do not try to use libdebuginfod.
|
||||
``LibDebuginfod_VERSION``
|
||||
the version of the libdebuginfod library found
|
||||
|
||||
#]=======================================================================]
|
||||
cmake_policy(SET CMP0074 NEW) # Use <Package>_ROOT
|
||||
|
||||
if(LibDebuginfod_NO_SYSTEM_PATHS)
|
||||
set(_find_path_args NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH)
|
||||
endif()
|
||||
|
||||
# There is no way to tell pkg-config to ignore directories, so disable it
|
||||
if(NOT LibDebuginfod_NO_SYSTEM_PATHS)
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(NOT "x${LibDebuginfod_FIND_VERSION}" STREQUAL "x")
|
||||
set(_version ">=${LibDebuginfod_FIND_VERSION}")
|
||||
endif()
|
||||
if(LibDebuginfod_FIND_QUIETLY)
|
||||
set(_quiet "QUIET")
|
||||
endif()
|
||||
|
||||
pkg_check_modules(PC_LIBDEBUGINFOD ${_quiet} "libdebuginfod${_version}")
|
||||
unset(_version)
|
||||
unset(_quiet)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(PC_LIBDEBUGINFOD_FOUND)
|
||||
# FindPkgConfig sometimes gets the include dir wrong
|
||||
if("x${PC_LIBDEBUGINFOD_INCLUDE_DIRS}" STREQUAL "x")
|
||||
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 "")
|
||||
else()
|
||||
find_path(
|
||||
LibDebuginfod_INCLUDE_DIRS
|
||||
NAMES debuginfod.h
|
||||
PATH_SUFFIXES elfutils ${_find_path_args})
|
||||
|
||||
find_library(
|
||||
LibDebuginfod_LIBRARIES
|
||||
NAMES libdebuginfod debuginfod
|
||||
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]+")
|
||||
string(REGEX MATCH "[0-9]+" _version "${_version_line}")
|
||||
if(NOT "x${_version}" STREQUAL "x")
|
||||
set(LibDebuginfod_VERSION "0.${_version}")
|
||||
endif()
|
||||
unset(_version_line)
|
||||
unset(_version)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
LibDebuginfod
|
||||
FOUND_VAR LibDebuginfod_FOUND
|
||||
REQUIRED_VARS LibDebuginfod_LIBRARIES LibDebuginfod_INCLUDE_DIRS
|
||||
VERSION_VAR LibDebuginfod_VERSION)
|
||||
|
||||
if(LibDebuginfod_FOUND)
|
||||
mark_as_advanced(LibDebuginfod_INCLUDE_DIR)
|
||||
mark_as_advanced(LibDebuginfod_LIBRARIES)
|
||||
mark_as_advanced(LibDebuginfod_VERSION)
|
||||
|
||||
if(NOT TARGET LibDebuginfod::LibDebuginfod)
|
||||
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}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
unset(_find_path_args)
|
||||
@@ -0,0 +1,86 @@
|
||||
# ===================================================================================
|
||||
# FindLibDwarf.cmake
|
||||
#
|
||||
# Find libdw include dirs and libraries
|
||||
#
|
||||
# ----------------------------------------
|
||||
#
|
||||
# Use this module by invoking find_package with the form::
|
||||
#
|
||||
# find_package(LibDwarf [version] [EXACT] # Minimum or EXACT version e.g. 0.173
|
||||
# [REQUIRED] # Fail with error if libdw is not found )
|
||||
#
|
||||
# This module reads hints about search locations from variables::
|
||||
#
|
||||
# LibDwarf_ROOT_DIR - Base directory the of libdw installation
|
||||
# LibDwarf_INCLUDEDIR - Hint directory that contains the libdw headers files
|
||||
# LibDwarf_LIBRARYDIR - Hint directory that contains the libdw library files
|
||||
#
|
||||
# and saves search results persistently in CMake cache entries::
|
||||
#
|
||||
# LibDwarf_FOUND - True if headers and requested libraries were found
|
||||
# LibDwarf_INCLUDE_DIRS - libdw include directories LibDwarf_LIBRARY_DIRS - Link
|
||||
# directories for libdw libraries LibDwarf_LIBRARIES - libdw library files
|
||||
#
|
||||
# ===================================================================================
|
||||
|
||||
# Non-standard subdirectories to search
|
||||
set(_path_suffixes libdw libdwarf elfutils)
|
||||
|
||||
find_path(
|
||||
LibDwarf_INCLUDE_DIR
|
||||
NAMES libdw.h
|
||||
HINTS ${LibDwarf_ROOT_DIR}/include ${LibDwarf_ROOT_DIR} ${LibDwarf_INCLUDEDIR}
|
||||
PATHS ${DYNINST_SYSTEM_INCLUDE_PATHS}
|
||||
PATH_SUFFIXES ${_path_suffixes}
|
||||
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})
|
||||
|
||||
# Find the library with the highest version
|
||||
set(_max_ver 0.0)
|
||||
set(_max_ver_lib)
|
||||
foreach(l ${LibDwarf_LIBRARIES})
|
||||
get_filename_component(_dw_realpath ${LibDwarf_LIBRARIES} REALPATH)
|
||||
string(REGEX MATCH "libdw\\-(.+)\\.so\\.*$" res ${_dw_realpath})
|
||||
|
||||
# The library version number is stored in CMAKE_MATCH_1
|
||||
set(_cur_ver ${CMAKE_MATCH_1})
|
||||
|
||||
if(${_cur_ver} VERSION_GREATER ${_max_ver})
|
||||
set(_max_ver ${_cur_ver})
|
||||
set(_max_ver_lib ${l})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Set the exported variables to the best match
|
||||
set(LibDwarf_LIBRARIES ${_max_ver_lib})
|
||||
set(LibDwarf_VERSION ${_max_ver})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
LibDwarf
|
||||
FOUND_VAR LibDwarf_FOUND
|
||||
REQUIRED_VARS LibDwarf_LIBRARIES LibDwarf_INCLUDE_DIR
|
||||
VERSION_VAR LibDwarf_VERSION)
|
||||
|
||||
# Export cache variables
|
||||
if(LibDwarf_FOUND)
|
||||
set(LibDwarf_INCLUDE_DIRS ${LibDwarf_INCLUDE_DIR})
|
||||
set(LibDwarf_LIBRARIES ${LibDwarf_LIBRARIES})
|
||||
|
||||
# Because we only report the library with the largest version, we are guaranteed there
|
||||
# is only one file in LibDwarf_LIBRARIES
|
||||
get_filename_component(_dw_dir ${LibDwarf_LIBRARIES} DIRECTORY)
|
||||
set(LibDwarf_LIBRARY_DIRS ${_dw_dir})
|
||||
|
||||
add_library(LibDwarf::LibDwarf INTERFACE IMPORTED)
|
||||
target_include_directories(LibDwarf::LibDwarf INTERFACE ${LibDwarf_INCLUDE_DIR})
|
||||
target_link_directories(LibDwarf::LibDwarf INTERFACE ${LibDwarf_LIBRARY_DIRS})
|
||||
target_link_libraries(LibDwarf::LibDwarf INTERFACE ${LibDwarf_LIBRARIES})
|
||||
endif()
|
||||
@@ -0,0 +1,88 @@
|
||||
# ========================================================================================
|
||||
# FindLibElf.cmake
|
||||
#
|
||||
# Find libelf include dirs and libraries
|
||||
#
|
||||
# ----------------------------------------
|
||||
#
|
||||
# Use this module by invoking find_package with the form::
|
||||
#
|
||||
# find_package(LibElf [version] [EXACT] # Minimum or EXACT version e.g. 0.173
|
||||
# [REQUIRED] # Fail with error if libelf is not found )
|
||||
#
|
||||
# This module reads hints about search locations from variables::
|
||||
#
|
||||
# LibElf_ROOT_DIR - Base directory the of libelf installation LibElf_INCLUDEDIR -
|
||||
# Hint directory that contains the libelf headers files LibElf_LIBRARYDIR - Hint
|
||||
# directory that contains the libelf library files
|
||||
#
|
||||
# and saves search results persistently in CMake cache entries::
|
||||
#
|
||||
# LibElf_FOUND - True if headers and requested libraries were found
|
||||
# LibElf_INCLUDE_DIRS - libelf include directories LibElf_LIBRARY_DIRS - Link
|
||||
# directories for libelf libraries LibElf_LIBRARIES - libelf library files
|
||||
#
|
||||
# Based on the version by Bernhard Walle <bernhard.walle@gmx.de> Copyright (c) 2008
|
||||
#
|
||||
# ========================================================================================
|
||||
|
||||
# Non-standard subdirectories to search
|
||||
set(_path_suffixes libelf libelfls elfutils)
|
||||
|
||||
find_path(
|
||||
LibElf_INCLUDE_DIR
|
||||
NAMES libelf.h
|
||||
HINTS ${LibElf_ROOT_DIR}/include ${LibElf_ROOT_DIR} ${LibElf_INCLUDEDIR}
|
||||
PATHS ${DYNINST_SYSTEM_INCLUDE_PATHS}
|
||||
PATH_SUFFIXES ${_path_suffixes}
|
||||
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})
|
||||
|
||||
# Find the library with the highest version
|
||||
set(_max_ver 0.0)
|
||||
set(_max_ver_lib)
|
||||
foreach(l ${LibElf_LIBRARIES})
|
||||
get_filename_component(_elf_realpath ${LibElf_LIBRARIES} REALPATH)
|
||||
string(REGEX MATCH "libelf\\-(.+)\\.so\\.*$" res ${_elf_realpath})
|
||||
|
||||
# The library version number is stored in CMAKE_MATCH_1
|
||||
set(_cur_ver ${CMAKE_MATCH_1})
|
||||
|
||||
if(${_cur_ver} VERSION_GREATER ${_max_ver})
|
||||
set(_max_ver ${_cur_ver})
|
||||
set(_max_ver_lib ${l})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Set the exported variables to the best match
|
||||
set(LibElf_LIBRARIES ${_max_ver_lib})
|
||||
set(LibElf_VERSION ${_max_ver})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
LibElf
|
||||
FOUND_VAR LibElf_FOUND
|
||||
REQUIRED_VARS LibElf_LIBRARIES LibElf_INCLUDE_DIR
|
||||
VERSION_VAR LibElf_VERSION)
|
||||
|
||||
# Export cache variables
|
||||
if(LibElf_FOUND)
|
||||
set(LibElf_INCLUDE_DIRS ${LibElf_INCLUDE_DIR})
|
||||
set(LibElf_LIBRARIES ${LibElf_LIBRARIES})
|
||||
|
||||
# Because we only report the library with the largest version, we are guaranteed there
|
||||
# is only one file in LibElf_LIBRARIES
|
||||
get_filename_component(_elf_dir ${LibElf_LIBRARIES} DIRECTORY)
|
||||
set(LibElf_LIBRARY_DIRS ${_elf_dir} "${_elf_dir}/elfutils")
|
||||
|
||||
add_library(LibElf::LibElf INTERFACE IMPORTED)
|
||||
target_include_directories(LibElf::LibElf INTERFACE ${LibElf_INCLUDE_DIR})
|
||||
target_link_directories(LibElf::LibElf INTERFACE ${LibElf_LIBRARY_DIRS})
|
||||
target_link_libraries(LibElf::LibElf INTERFACE ${LibElf_LIBRARIES})
|
||||
endif()
|
||||
@@ -0,0 +1,80 @@
|
||||
# ========================================================================================
|
||||
# FindLibIberty.cmake
|
||||
#
|
||||
# Find LibIberty include dirs and libraries
|
||||
#
|
||||
# ----------------------------------------
|
||||
#
|
||||
# Use this module by invoking find_package with the form::
|
||||
#
|
||||
# find_package(LibIberty [REQUIRED] # Fail with error if LibIberty is not
|
||||
# found )
|
||||
#
|
||||
# This module reads hints about search locations from variables::
|
||||
#
|
||||
# LibIberty_ROOT_DIR - Base directory the of LibIberty installation
|
||||
# LibIberty_LIBRARYDIR - Hint directory that contains the LibIberty library files
|
||||
# IBERTY_LIBRARIES - Alias for LibIberty_LIBRARIES (backwards compatibility only)
|
||||
# LibIberty_INCLUDEDIR - Hint directory that contains the libiberty headers files
|
||||
#
|
||||
# and saves search results persistently in CMake cache entries::
|
||||
#
|
||||
# LibIberty_FOUND - True if headers and requested libraries were found
|
||||
# IBERTY_FOUND - Alias for LibIberty_FOUND (backwards compatibility only)
|
||||
# LibIberty_INCLUDE_DIRS - libiberty include directories LibIberty_LIBRARY_DIRS - Link
|
||||
# directories for LibIberty libraries LibIberty_LIBRARIES - LibIberty library files
|
||||
# IBERTY_LIBRARIES - Alias for LibIberty_LIBRARIES (backwards compatibility only)
|
||||
#
|
||||
# ========================================================================================
|
||||
|
||||
cmake_minimum_required(VERSION 3.13.0 FATAL_ERROR)
|
||||
|
||||
# Keep the semantics of IBERTY_LIBRARIES for backward compatibility NB: If both are
|
||||
# specified, LibIberty_LIBRARIES is ignored
|
||||
if(NOT "${IBERTY_LIBRARIES}" STREQUAL "")
|
||||
set(LibIberty_LIBRARIES ${IBERTY_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# Non-standard subdirectories to search
|
||||
set(_path_suffixes libiberty iberty)
|
||||
|
||||
find_path(
|
||||
LibIberty_INCLUDE_DIRS
|
||||
NAMES libiberty.h
|
||||
HINTS ${LibIberty_ROOT_DIR} ${LibIberty_ROOT_DIR}/include ${LibIberty_INCLUDEDIR}
|
||||
PATHS ${DYNINST_SYSTEM_INCLUDE_PATHS}
|
||||
PATH_SUFFIXES ${_path_suffixes}
|
||||
DOC "LibIberty include directories")
|
||||
|
||||
# iberty_pic is for Debian <= wheezy
|
||||
find_library(
|
||||
LibIberty_LIBRARIES
|
||||
NAMES iberty_pic iberty
|
||||
HINTS ${LibIberty_ROOT_DIR} ${LibIberty_LIBRARYDIR} ${IBERTY_LIBRARIES}
|
||||
PATHS ${DYNINST_SYSTEM_LIBRARY_PATHS}
|
||||
PATH_SUFFIXES ${_path_suffixes})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
LibIberty
|
||||
FOUND_VAR LibIberty_FOUND
|
||||
REQUIRED_VARS LibIberty_INCLUDE_DIRS LibIberty_LIBRARIES)
|
||||
|
||||
# For backwards compatibility only
|
||||
set(IBERTY_FOUND ${LibIberty_FOUND})
|
||||
|
||||
if(LibIberty_FOUND)
|
||||
foreach(l ${LibIberty_LIBRARIES})
|
||||
get_filename_component(_dir ${l} DIRECTORY)
|
||||
if(NOT "${_dir}" IN_LIST LibIberty_LIBRARY_DIRS)
|
||||
list(APPEND LibIberty_LIBRARY_DIRS ${_dir})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
add_library(LibIberty::LibIberty INTERFACE IMPORTED)
|
||||
target_include_directories(LibIberty::LibIberty INTERFACE ${LibIberty_INCLUDE_DIRS})
|
||||
target_link_libraries(LibIberty::LibIberty INTERFACE ${LibIberty_LIBRARIES})
|
||||
|
||||
# For backwards compatibility only
|
||||
set(IBERTY_LIBRARIES ${LibIberty_LIBRARIES})
|
||||
endif()
|
||||
@@ -0,0 +1,268 @@
|
||||
# ======================================================================================================
|
||||
# FindTBB.cmake
|
||||
#
|
||||
# Find TBB include directories and libraries.
|
||||
#
|
||||
# ----------------------------------------
|
||||
#
|
||||
# Use this module by invoking find_package with the form::
|
||||
#
|
||||
# find_package(TBB [major[.minor]] [EXACT] [QUIET] # Minimum or EXACT version e.g.
|
||||
# 2018.6 [REQUIRED] # Fail with error if TBB is not found
|
||||
# [[COMPONENTS] [components...]] # Required components [OPTIONAL_COMPONENTS
|
||||
# components...] # Optional components )
|
||||
#
|
||||
# This module reads hints about search locations from variables::
|
||||
#
|
||||
# TBB_ROOT_DIR - The base directory the of TBB installation. TBB_INCLUDE_DIR -
|
||||
# The directory that contains the TBB headers files. TBB_LIBRARY - The directory
|
||||
# that contains the TBB library files. TBB_<library>_LIBRARY - The path of the TBB the
|
||||
# corresponding TBB library. These libraries override the corresponding library search
|
||||
# results. TBB_USE_DEBUG_BUILD - Use the debug version of tbb libraries
|
||||
#
|
||||
# Environment variable aliases for TBB_ROOT_DIR:
|
||||
#
|
||||
# TBB_INSTALL_DIR TBBROOT LIBRARY_PATH
|
||||
#
|
||||
# This module will set the following variables:
|
||||
#
|
||||
# TBB_FOUND - If false, or undefined, TBB not found, or don’t want to
|
||||
# use TBB. TBB_<component>_FOUND - If False, optional <component> part of TBB
|
||||
# sytem is not available. TBB_VERSION - The full version string TBB_VERSION_MAJOR - The
|
||||
# major version TBB_VERSION_MINOR - The minor version TBB_INTERFACE_VERSION - The
|
||||
# interface version number defined in tbb/tbb_stddef.h. TBB_<library>_LIBRARY_RELEASE -
|
||||
# The path of the TBB release version of <library>. TBB_<library>_LIBRARY_DEBUG - The
|
||||
# path of the TBB debug version of <library>.
|
||||
#
|
||||
# The following varibles should be used to build and link with TBB:
|
||||
#
|
||||
# TBB_INCLUDE_DIRS - The include directory for TBB. TBB_LIBRARY_DIRS - The library
|
||||
# directory for TBB. TBB_LIBRARIES - The libraries to link against to use TBB.
|
||||
# TBB_LIBRARIES_RELEASE - The release libraries to link against to use TBB.
|
||||
# TBB_LIBRARIES_DEBUG - The debug libraries to link against to use TBB.
|
||||
# TBB_DEFINITIONS - Definitions to use when compiling code that uses TBB.
|
||||
# TBB_DEFINITIONS_RELEASE - Definitions to use when compiling release code that uses TBB.
|
||||
# TBB_DEFINITIONS_DEBUG - Definitions to use when compiling debug code that uses TBB.
|
||||
#
|
||||
# This module will also create the "TBB" target that may be used when building executables
|
||||
# and libraries.
|
||||
#
|
||||
# Based on the version by Justus Calvin - Copyright (c) 2015
|
||||
#
|
||||
# ======================================================================================================
|
||||
|
||||
if(TBB_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
#
|
||||
# Check the build type
|
||||
#
|
||||
if(NOT DEFINED TBB_USE_DEBUG_BUILD)
|
||||
if(CMAKE_BUILD_TYPE MATCHES "(Debug|DEBUG|debug)")
|
||||
set(TBB_BUILD_TYPE DEBUG)
|
||||
else()
|
||||
set(TBB_BUILD_TYPE RELEASE)
|
||||
endif()
|
||||
elseif(TBB_USE_DEBUG_BUILD)
|
||||
set(TBB_BUILD_TYPE DEBUG)
|
||||
else()
|
||||
set(TBB_BUILD_TYPE RELEASE)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Set the TBB search directories
|
||||
#
|
||||
|
||||
# Define search paths based on user input and environment variables
|
||||
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 the target architecture
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(TBB_ARCHITECTURE "intel64")
|
||||
else()
|
||||
set(TBB_ARCHITECTURE "ia32")
|
||||
endif()
|
||||
|
||||
# Set the TBB search library path search suffix based on the version of VC
|
||||
if(WINDOWS_STORE)
|
||||
set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11_ui")
|
||||
elseif(MSVC14)
|
||||
set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc14")
|
||||
elseif(MSVC12)
|
||||
set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc12")
|
||||
elseif(MSVC11)
|
||||
set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11")
|
||||
elseif(MSVC10)
|
||||
set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc10")
|
||||
endif()
|
||||
|
||||
# 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")
|
||||
|
||||
# TODO: Check to see which C++ library is being used by the compiler.
|
||||
if(NOT ${CMAKE_SYSTEM_VERSION} VERSION_LESS 13.0)
|
||||
# The default C++ library on OS X 10.9 and later is libc++
|
||||
set(TBB_LIB_PATH_SUFFIX "lib/libc++" "lib")
|
||||
else()
|
||||
set(TBB_LIB_PATH_SUFFIX "lib")
|
||||
endif()
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
# Linux
|
||||
set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb")
|
||||
|
||||
# TODO: Check compiler version to see the suffix should be <arch>/gcc4.1 or
|
||||
# <arch>/gcc4.1. For now, assume that the compiler is more recent than gcc 4.4.x or
|
||||
# later.
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
set(TBB_LIB_PATH_SUFFIX "lib/intel64/gcc4.4")
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
|
||||
set(TBB_LIB_PATH_SUFFIX "lib/ia32/gcc4.4")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#
|
||||
# Find the TBB include dir
|
||||
#
|
||||
find_path(
|
||||
TBB_INCLUDE_DIRS tbb/tbb.h
|
||||
HINTS ${TBB_INCLUDE_DIRS} ${TBB_SEARCH_DIR}
|
||||
PATHS ${TBB_DEFAULT_SEARCH_DIR}
|
||||
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")
|
||||
foreach(f IN ITEMS ${_version_files})
|
||||
if(EXISTS ${f})
|
||||
set(_version_file ${f})
|
||||
endif()
|
||||
endforeach()
|
||||
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}")
|
||||
|
||||
# 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")
|
||||
endif()
|
||||
set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}")
|
||||
endif()
|
||||
|
||||
#
|
||||
# Find TBB components
|
||||
#
|
||||
if(TBB_VERSION VERSION_LESS 4.3)
|
||||
set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc tbb)
|
||||
else()
|
||||
set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc_proxy tbbmalloc tbb)
|
||||
endif()
|
||||
|
||||
set(TBB_LIBRARY_DIRS)
|
||||
|
||||
# Find each component
|
||||
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}
|
||||
HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
|
||||
PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
|
||||
PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX} lib_release)
|
||||
|
||||
find_library(
|
||||
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)
|
||||
|
||||
if(TBB_${_comp}_LIBRARY_DEBUG)
|
||||
list(APPEND TBB_LIBRARIES_DEBUG "${TBB_${_comp}_LIBRARY_DEBUG}")
|
||||
# message(STATUS "Found ${TBB_${_comp}_LIBRARY_DEBUG}")
|
||||
endif()
|
||||
if(TBB_${_comp}_LIBRARY_RELEASE)
|
||||
list(APPEND TBB_LIBRARIES_RELEASE "${TBB_${_comp}_LIBRARY_RELEASE}")
|
||||
# message(STATUS "Found ${TBB_${_comp}_LIBRARY_RELEASE}")
|
||||
endif()
|
||||
if(TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE} AND NOT TBB_${_comp}_LIBRARY)
|
||||
set(TBB_${_comp}_LIBRARY "${TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE}}")
|
||||
endif()
|
||||
|
||||
if(TBB_${_comp}_LIBRARY AND EXISTS "${TBB_${_comp}_LIBRARY}")
|
||||
set(TBB_${_comp}_FOUND TRUE)
|
||||
else()
|
||||
set(TBB_${_comp}_FOUND FALSE)
|
||||
endif()
|
||||
|
||||
# Mark internal variables as advanced
|
||||
mark_as_advanced(TBB_${_comp}_LIBRARY_RELEASE)
|
||||
mark_as_advanced(TBB_${_comp}_LIBRARY_DEBUG)
|
||||
mark_as_advanced(TBB_${_comp}_LIBRARY)
|
||||
|
||||
# Save the directory names for each library component
|
||||
if(TBB_USE_DEBUG_BUILD)
|
||||
get_filename_component(_dir ${TBB_${_comp}_LIBRARY_DEBUG} DIRECTORY)
|
||||
else()
|
||||
get_filename_component(_dir ${TBB_${_comp}_LIBRARY_RELEASE} DIRECTORY)
|
||||
endif()
|
||||
list(APPEND TBB_LIBRARY_DIRS ${_dir})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
#
|
||||
# Set compile flags and libraries
|
||||
#
|
||||
set(TBB_DEFINITIONS_RELEASE "")
|
||||
set(TBB_DEFINITIONS_DEBUG "-DTBB_USE_DEBUG=1")
|
||||
|
||||
if(TBB_LIBRARIES_${TBB_BUILD_TYPE})
|
||||
set(TBB_DEFINITIONS "${TBB_DEFINITIONS_${TBB_BUILD_TYPE}}")
|
||||
set(TBB_LIBRARIES "${TBB_LIBRARIES_${TBB_BUILD_TYPE}}")
|
||||
elseif(TBB_LIBRARIES_RELEASE)
|
||||
set(TBB_DEFINITIONS "${TBB_DEFINITIONS_RELEASE}")
|
||||
set(TBB_LIBRARIES "${TBB_LIBRARIES_RELEASE}")
|
||||
elseif(TBB_LIBRARIES_DEBUG)
|
||||
set(TBB_DEFINITIONS "${TBB_DEFINITIONS_DEBUG}")
|
||||
set(TBB_LIBRARIES "${TBB_LIBRARIES_DEBUG}")
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(
|
||||
TBB
|
||||
REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARIES
|
||||
HANDLE_COMPONENTS
|
||||
VERSION_VAR TBB_VERSION)
|
||||
|
||||
mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES TBB_LIBRARY_DIRS)
|
||||
|
||||
unset(TBB_ARCHITECTURE)
|
||||
unset(TBB_BUILD_TYPE)
|
||||
unset(TBB_LIB_PATH_SUFFIX)
|
||||
unset(TBB_DEFAULT_SEARCH_DIR)
|
||||
@@ -230,13 +230,13 @@ target_link_libraries(rocprofiler-systems-elfutils INTERFACE ${ElfUtils_LIBRARIE
|
||||
# Dyninst
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
include(DyninstExternals)
|
||||
if(ROCPROFSYS_BUILD_DYNINST)
|
||||
rocprofiler_systems_checkout_git_submodule(
|
||||
RELATIVE_PATH external/dyninst
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
REPO_URL https://github.com/jrmadsen/dyninst.git
|
||||
REPO_BRANCH omnitrace)
|
||||
REPO_URL https://github.com/ROCm/dyninst.git
|
||||
REPO_BRANCH dyninst_13)
|
||||
|
||||
set(DYNINST_OPTION_PREFIX ON)
|
||||
set(DYNINST_BUILD_DOCS OFF)
|
||||
@@ -279,6 +279,7 @@ if(ROCPROFSYS_BUILD_DYNINST)
|
||||
set(DYNINST_TPL_INSTALL_LIB_DIR
|
||||
"${PROJECT_NAME}"
|
||||
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
|
||||
@@ -311,17 +312,37 @@ if(ROCPROFSYS_BUILD_DYNINST)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# for packaging
|
||||
install(
|
||||
DIRECTORY ${DYNINST_TPL_STAGING_PREFIX}/lib/
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
|
||||
COMPONENT dyninst
|
||||
FILES_MATCHING
|
||||
PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*")
|
||||
foreach(
|
||||
_LIB
|
||||
common
|
||||
dynDwarf
|
||||
dynElf
|
||||
dyninstAPI
|
||||
instructionAPI
|
||||
parseAPI
|
||||
patchAPI
|
||||
pcontrol
|
||||
stackwalk
|
||||
symtabAPI)
|
||||
if(TARGET ${_LIB})
|
||||
add_dependencies(${_LIB} external-prebuild)
|
||||
if(NOT TARGET Dyninst::${_LIB})
|
||||
add_library(Dyninst::${_LIB} ALIAS ${_LIB})
|
||||
endif()
|
||||
endif()
|
||||
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})
|
||||
endif()
|
||||
|
||||
find_package(Dyninst ${rocprofiler_systems_FIND_QUIETLY} REQUIRED
|
||||
COMPONENTS dyninstAPI parseAPI instructionAPI symtabAPI)
|
||||
|
||||
|
||||
@@ -163,10 +163,10 @@ while Dyninst requires TBB), and the CMake option to build the package alongside
|
||||
|
||||
"Dyninst", "12.0", "ROCm Systems Profiler", "``ROCPROFSYS_BUILD_DYNINST`` (default: OFF)"
|
||||
"Libunwind", "", "ROCm Systems Profiler", "``ROCPROFSYS_BUILD_LIBUNWIND`` (default: ON)"
|
||||
"TBB", "2018.6", "Dyninst", "``DYNINST_BUILD_TBB`` (default: OFF)"
|
||||
"ElfUtils", "0.178", "Dyninst", "``DYNINST_BUILD_ELFUTILS`` (default: OFF)"
|
||||
"LibIberty", "", "Dyninst", "``DYNINST_BUILD_LIBIBERTY`` (default: OFF)"
|
||||
"Boost", "1.67.0", "Dyninst", "``DYNINST_BUILD_BOOST`` (default: OFF)"
|
||||
"TBB", "2018.6", "Dyninst", "``ROCPROFSYS_BUILD_TBB`` (default: OFF)"
|
||||
"ElfUtils", "0.178", "Dyninst", "``ROCPROFSYS_BUILD_ELFUTILS`` (default: OFF)"
|
||||
"LibIberty", "", "Dyninst", "``ROCPROFSYS_BUILD_LIBIBERTY`` (default: OFF)"
|
||||
"Boost", "1.67.0", "Dyninst", "``ROCPROFSYS_BUILD_BOOST`` (default: OFF)"
|
||||
"OpenMP", "4.x", "Dyninst", ""
|
||||
|
||||
Optional third-party packages
|
||||
@@ -209,16 +209,16 @@ To install Dyninst alongside ROCm Systems Profiler, configure ROCm Systems Profi
|
||||
Depending on the version of Ubuntu, the ``apt`` package manager might have current enough
|
||||
versions of the Dyninst Boost, TBB, and LibIberty dependencies
|
||||
(use ``apt-get install libtbb-dev libiberty-dev libboost-dev``).
|
||||
However, it is possible to request Dyninst to install
|
||||
its dependencies via ``DYNINST_BUILD_<DEP>=ON``, as follows:
|
||||
However, it is possible to request Dyninst to build and install
|
||||
its dependencies via ``ROCPROFSYS_BUILD_<DEP>=ON``, as follows:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
git clone https://github.com/ROCm/rocprofiler-systems.git rocprof-sys-source
|
||||
cmake -B rocprof-sys-build -DROCPROFSYS_BUILD_DYNINST=ON -DDYNINST_BUILD_{TBB,ELFUTILS,BOOST,LIBIBERTY}=ON rocprof-sys-source
|
||||
cmake -B rocprof-sys-build -DROCPROFSYS_BUILD_DYNINST=ON -DROCPROFSYS_BUILD_{TBB,ELFUTILS,BOOST,LIBIBERTY}=ON rocprof-sys-source
|
||||
|
||||
where ``-DDYNINST_BUILD_{TBB,BOOST,ELFUTILS,LIBIBERTY}=ON`` is expanded by
|
||||
the shell to ``-DDYNINST_BUILD_TBB=ON -DDYNINST_BUILD_BOOST=ON ...``
|
||||
where ``-DROCPROFSYS_BUILD_{TBB,BOOST,ELFUTILS,LIBIBERTY}=ON`` is expanded by
|
||||
the shell to ``-DROCPROFSYS_BUILD_TBB=ON -DROCPROFSYS_BUILD_BOOST=ON ...``
|
||||
|
||||
Installing Dyninst via Spack
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@@ -266,10 +266,10 @@ in `the Perfetto UI <https://ui.perfetto.dev>`_.
|
||||
-D ROCPROFSYS_BUILD_PAPI=ON \
|
||||
-D ROCPROFSYS_BUILD_LIBUNWIND=ON \
|
||||
-D ROCPROFSYS_BUILD_DYNINST=ON \
|
||||
-D DYNINST_BUILD_TBB=ON \
|
||||
-D DYNINST_BUILD_BOOST=ON \
|
||||
-D DYNINST_BUILD_ELFUTILS=ON \
|
||||
-D DYNINST_BUILD_LIBIBERTY=ON \
|
||||
-D ROCPROFSYS_BUILD_TBB=ON \
|
||||
-D ROCPROFSYS_BUILD_BOOST=ON \
|
||||
-D ROCPROFSYS_BUILD_ELFUTILS=ON \
|
||||
-D ROCPROFSYS_BUILD_LIBIBERTY=ON \
|
||||
rocprof-sys-source
|
||||
cmake --build rocprof-sys-build --target all --parallel 8
|
||||
cmake --build rocprof-sys-build --target install
|
||||
|
||||
+1
-1
Submodule projects/rocprofiler-systems/external/dyninst updated: 09e781d414...b4350c3c14
@@ -222,7 +222,7 @@ ROCPROFSYS_GENERAL_ARGS="-DROCPROFSYS_CPACK_SYSTEM_NAME=${DISTRO} -DROCPROFSYS_R
|
||||
ROCPROFSYS_BUILD_ARGS="-DROCPROFSYS_BUILD_TESTING=OFF -DROCPROFSYS_BUILD_EXAMPLES=OFF -DROCPROFSYS_BUILD_PAPI=ON -DROCPROFSYS_BUILD_LTO=${LTO} -DROCPROFSYS_BUILD_HIDDEN_VISIBILITY=${HIDDEN_VIZ} -DROCPROFSYS_BUILD_STATIC_LIBGCC=${LIBGCC} -DROCPROFSYS_BUILD_STATIC_LIBSTDCXX=${LIBSTDCXX} -DROCPROFSYS_BUILD_RELEASE=ON"
|
||||
ROCPROFSYS_USE_ARGS="-DROCPROFSYS_USE_MPI_HEADERS=ON -DROCPROFSYS_USE_OMPT=ON -DROCPROFSYS_USE_PAPI=ON"
|
||||
TIMEMORY_ARGS="-DTIMEMORY_USE_LIBUNWIND=ON -DTIMEMORY_BUILD_LIBUNWIND=ON -DTIMEMORY_BUILD_PORTABLE=ON"
|
||||
DYNINST_ARGS="-DROCPROFSYS_BUILD_DYNINST=ON -DDYNINST_USE_OpenMP=ON $(echo -DDYNINST_BUILD_{TBB,BOOST,ELFUTILS,LIBIBERTY}=ON) -DDYNINST_BOOST_DOWNLOAD_VERSION=${BOOST_VERSION}"
|
||||
DYNINST_ARGS="-DROCPROFSYS_BUILD_DYNINST=ON $(echo -DROCPROFSYS_BUILD_{TBB,BOOST,ELFUTILS,LIBIBERTY}=ON) -DROCPROFSYS_BOOST_DOWNLOAD_VERSION=${BOOST_VERSION}"
|
||||
STANDARD_ARGS="${CMAKE_ARGS} ${ROCPROFSYS_GENERAL_ARGS} ${ROCPROFSYS_USE_ARGS} ${ROCPROFSYS_BUILD_ARGS} ${TIMEMORY_ARGS} ${DYNINST_ARGS} ${EXTRA_ARGS}"
|
||||
|
||||
SCRIPT_DIR=$(realpath $(dirname ${BASH_SOURCE[0]}))
|
||||
|
||||
@@ -817,7 +817,7 @@ process_modules(const std::vector<module_t*>& _app_modules)
|
||||
}
|
||||
|
||||
symtab_data.functions.emplace(itr, std::vector<symtab_func_t*>{});
|
||||
if(!itr->getAllFunctions(symtab_data.functions.at(itr))) continue;
|
||||
if(itr->getAllFunctions().empty()) continue;
|
||||
_erase_nullptrs(symtab_data.functions.at(itr));
|
||||
|
||||
for(auto* fitr : symtab_data.functions.at(itr))
|
||||
|
||||
@@ -486,8 +486,7 @@ get_internal_libs_data_impl()
|
||||
_data[itr.first].emplace(_mpath, func_set_t{});
|
||||
_data[itr.first].emplace(_mname, func_set_t{});
|
||||
|
||||
auto _funcs = std::vector<symtab_func_t*>{};
|
||||
mitr->getAllFunctions(_funcs);
|
||||
auto _funcs = mitr->getAllFunctions();
|
||||
|
||||
for(const auto& fitr : _funcs)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user