dyninst submodule + non-papi build fix (#8)

* dyninst submodule + non-papi build fix
* Fix to checkout_git_submodule
* Append CMAKE_PREFIX_PATH with /opt/rocm
Этот коммит содержится в:
Jonathan R. Madsen
2021-09-09 15:51:07 -05:00
коммит произвёл GitHub
родитель f23bc8fc19
Коммит d2d1a80255
5 изменённых файлов: 115 добавлений и 69 удалений
+3
Просмотреть файл
@@ -7,3 +7,6 @@
[submodule "external/elfio"]
path = external/elfio
url = https://github.com/jrmadsen/ELFIO.git
[submodule "external/dyninst"]
path = external/dyninst
url = https://github.com/jrmadsen/dyninst.git
+1
Просмотреть файл
@@ -34,6 +34,7 @@ add_option(HOSTTRACE_USE_CLANG_TIDY "Enable clang-tidy" OFF)
add_option(HOSTTRACE_USE_MPI "Enable MPI support" OFF)
add_option(HOSTTRACE_CUSTOM_DATA_SOURCE "Enable custom data source" OFF)
add_option(HOSTTRACE_USE_ROCTRACER "Enable roctracer support" ON)
add_option(HOSTTRACE_BUILD_DYNINST "Build dyninst from submodule" OFF)
# ensure synced
set(TIMEMORY_USE_MPI ${HOSTTRACE_USE_MPI} CACHE BOOL "Enable MPI support" FORCE)
+109 -69
Просмотреть файл
@@ -50,6 +50,7 @@ endif()
#----------------------------------------------------------------------------------------#
if(HOSTTRACE_USE_ROCTRACER)
list(APPEND CMAKE_PREFIX_PATH /opt/rocm)
find_package(roctracer ${hosttrace_FIND_QUIETLY} REQUIRED)
find_package(hip ${hosttrace_FIND_QUIETLY} REQUIRED)
target_compile_definitions(hosttrace-roctracer INTERFACE HOSTTRACE_USE_ROCTRACER)
@@ -63,86 +64,125 @@ endif()
#
#----------------------------------------------------------------------------------------#
find_package(Dyninst ${hosttrace_FIND_QUIETLY} REQUIRED
COMPONENTS dyninstAPI parseAPI instructionAPI symtabAPI)
set(_BOOST_COMPONENTS atomic system thread date_time)
set(hosttrace_BOOST_COMPONENTS "${_BOOST_COMPONENTS}" CACHE STRING
"Boost components used by Dyninst in hosttrace")
set(Boost_NO_BOOST_CMAKE ON)
find_package(Boost QUIET REQUIRED
COMPONENTS ${hosttrace_BOOST_COMPONENTS})
if(HOSTTRACE_BUILD_DYNINST)
if(CMAKE_GENERATOR MATCHES "Ninja")
message(FATAL_ERROR "Building dyninst submodule requires the cmake generator to be Unix Makefiles")
endif()
checkout_git_submodule(
RELATIVE_PATH external/dyninst
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
REPO_URL https://github.com/jrmadsen/dyninst.git
REPO_BRANCH hosttrace-submodule)
add_subdirectory(external/dyninst)
target_link_libraries(hosttrace-dyninst INTERFACE
${DYNINST_LIBRARIES} ${Boost_LIBRARIES})
foreach(_TARG dyninst dyninstAPI instructionAPI symtabAPI parseAPI headers atomic system thread date_time TBB)
if(TARGET Dyninst::${_TARG})
target_link_libraries(hosttrace-dyninst INTERFACE Dyninst::${_TARG})
elseif(TARGET Boost::${_TARG})
target_link_libraries(hosttrace-dyninst INTERFACE Boost::${_TARG})
elseif(TARGET ${_TARG})
target_link_libraries(hosttrace-dyninst INTERFACE ${_TARG})
endif()
endforeach()
target_include_directories(hosttrace-dyninst SYSTEM INTERFACE
${TBB_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/dyninst/dyninstAPI/h>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/dyninst/instructionAPI/h>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/dyninst/proccontrol/h>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/dyninst/dataflowAPI/h>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/dyninst/symtabAPI/h>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/dyninst/parseAPI/h>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/dyninst/common/h>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/dyninst/common/h>)
target_compile_definitions(hosttrace-dyninst INTERFACE hosttrace_USE_DYNINST)
# some installs of dyninst don't set this properly
if(EXISTS "${DYNINST_INCLUDE_DIR}" AND NOT DYNINST_HEADER_DIR)
get_filename_component(DYNINST_HEADER_DIR "${DYNINST_INCLUDE_DIR}" REALPATH CACHE)
else()
find_path(DYNINST_HEADER_DIR
NAMES BPatch.h dyninstAPI_RT.h
HINTS ${Dyninst_ROOT_DIR} ${Dyninst_DIR} ${Dyninst_DIR}/../../..
PATHS ${Dyninst_ROOT_DIR} ${Dyninst_DIR} ${Dyninst_DIR}/../../..
PATH_SUFFIXES include)
endif()
find_package(Dyninst ${hosttrace_FIND_QUIETLY} REQUIRED
COMPONENTS dyninstAPI parseAPI instructionAPI symtabAPI)
set(_BOOST_COMPONENTS atomic system thread date_time)
set(hosttrace_BOOST_COMPONENTS "${_BOOST_COMPONENTS}" CACHE STRING
"Boost components used by Dyninst in hosttrace")
set(Boost_NO_BOOST_CMAKE ON)
find_package(Boost QUIET REQUIRED
COMPONENTS ${hosttrace_BOOST_COMPONENTS})
# useful for defining the location of the runtime API
find_library(DYNINST_API_RT dyninstAPI_RT
HINTS ${Dyninst_ROOT_DIR} ${Dyninst_DIR}
PATHS ${Dyninst_ROOT_DIR} ${Dyninst_DIR}
PATH_SUFFIXES lib)
# some installs of dyninst don't set this properly
if(EXISTS "${DYNINST_INCLUDE_DIR}" AND NOT DYNINST_HEADER_DIR)
get_filename_component(DYNINST_HEADER_DIR "${DYNINST_INCLUDE_DIR}" REALPATH CACHE)
else()
find_path(DYNINST_HEADER_DIR
NAMES BPatch.h dyninstAPI_RT.h
HINTS ${Dyninst_ROOT_DIR} ${Dyninst_DIR} ${Dyninst_DIR}/../../..
PATHS ${Dyninst_ROOT_DIR} ${Dyninst_DIR} ${Dyninst_DIR}/../../..
PATH_SUFFIXES include)
endif()
# try to find TBB
find_package(TBB QUIET)
# useful for defining the location of the runtime API
find_library(DYNINST_API_RT dyninstAPI_RT
HINTS ${Dyninst_ROOT_DIR} ${Dyninst_DIR}
PATHS ${Dyninst_ROOT_DIR} ${Dyninst_DIR}
PATH_SUFFIXES lib)
# if fail try to use the Dyninst installed FindTBB.cmake
if(NOT TBB_FOUND)
list(APPEND CMAKE_MODULE_PATH ${Dyninst_DIR}/Modules)
# try to find TBB
find_package(TBB QUIET)
endif()
if(NOT TBB_FOUND)
find_path(TBB_INCLUDE_DIR
NAMES tbb/tbb.h
PATH_SUFFIXES include)
endif()
if(TBB_INCLUDE_DIR AND NOT TBB_INCLUDE_DIRS)
set(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR})
endif()
if(DYNINST_API_RT)
target_compile_definitions(hosttrace-dyninst INTERFACE
DYNINST_API_RT="${DYNINST_API_RT}")
endif()
if(Boost_DIR)
get_filename_component(Boost_RPATH_DIR "${Boost_DIR}" DIRECTORY)
get_filename_component(Boost_RPATH_DIR "${Boost_RPATH_DIR}" DIRECTORY)
if(EXISTS "${Boost_RPATH_DIR}" AND IS_DIRECTORY "${Boost_RPATH_DIR}")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${Boost_RPATH_DIR}")
# if fail try to use the Dyninst installed FindTBB.cmake
if(NOT TBB_FOUND)
list(APPEND CMAKE_MODULE_PATH ${Dyninst_DIR}/Modules)
find_package(TBB QUIET)
endif()
endif()
add_rpath(${DYNINST_LIBRARIES} ${Boost_LIBRARIES})
target_link_libraries(hosttrace-dyninst INTERFACE
${DYNINST_LIBRARIES} ${Boost_LIBRARIES})
foreach(_TARG dyninst dyninstAPI instructionAPI symtabAPI parseAPI headers atomic system thread date_time TBB)
if(TARGET Dyninst::${_TARG})
target_link_libraries(hosttrace-dyninst INTERFACE Dyninst::${_TARG})
elseif(TARGET Boost::${_TARG})
target_link_libraries(hosttrace-dyninst INTERFACE Boost::${_TARG})
elseif(TARGET ${_TARG})
target_link_libraries(hosttrace-dyninst INTERFACE ${_TARG})
if(NOT TBB_FOUND)
find_path(TBB_INCLUDE_DIR
NAMES tbb/tbb.h
PATH_SUFFIXES include)
endif()
endforeach()
target_include_directories(hosttrace-dyninst SYSTEM INTERFACE
${TBB_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${DYNINST_HEADER_DIR})
target_compile_definitions(hosttrace-dyninst INTERFACE hosttrace_USE_DYNINST)
if(DYNINST_API_RT)
add_cmake_defines(DYNINST_API_RT VALUE QUOTE DEFAULT)
else()
add_cmake_defines(DYNINST_API_RT VALUE QUOTE)
if(TBB_INCLUDE_DIR AND NOT TBB_INCLUDE_DIRS)
set(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR})
endif()
if(DYNINST_API_RT)
target_compile_definitions(hosttrace-dyninst INTERFACE
DYNINST_API_RT="${DYNINST_API_RT}")
endif()
if(Boost_DIR)
get_filename_component(Boost_RPATH_DIR "${Boost_DIR}" DIRECTORY)
get_filename_component(Boost_RPATH_DIR "${Boost_RPATH_DIR}" DIRECTORY)
if(EXISTS "${Boost_RPATH_DIR}" AND IS_DIRECTORY "${Boost_RPATH_DIR}")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${Boost_RPATH_DIR}")
endif()
endif()
add_rpath(${DYNINST_LIBRARIES} ${Boost_LIBRARIES})
target_link_libraries(hosttrace-dyninst INTERFACE
${DYNINST_LIBRARIES} ${Boost_LIBRARIES})
foreach(_TARG dyninst dyninstAPI instructionAPI symtabAPI parseAPI headers atomic system thread date_time TBB)
if(TARGET Dyninst::${_TARG})
target_link_libraries(hosttrace-dyninst INTERFACE Dyninst::${_TARG})
elseif(TARGET Boost::${_TARG})
target_link_libraries(hosttrace-dyninst INTERFACE Boost::${_TARG})
elseif(TARGET ${_TARG})
target_link_libraries(hosttrace-dyninst INTERFACE ${_TARG})
endif()
endforeach()
target_include_directories(hosttrace-dyninst SYSTEM INTERFACE
${TBB_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${DYNINST_HEADER_DIR})
target_compile_definitions(hosttrace-dyninst INTERFACE hosttrace_USE_DYNINST)
if(DYNINST_API_RT)
add_cmake_defines(DYNINST_API_RT VALUE QUOTE DEFAULT)
else()
add_cmake_defines(DYNINST_API_RT VALUE QUOTE)
endif()
endif()
#----------------------------------------------------------------------------------------#
поставляемый Подмодуль
+1
Submodule external/dyninst added at 5c2f6fb25a
+1
Просмотреть файл
@@ -34,6 +34,7 @@ perfetto::Category("timemory")
#include "timemory/backends/threading.hpp"
#include "timemory/components.hpp"
#include "timemory/components/gotcha/mpip.hpp"
#include "timemory/components/papi/papi_tuple.hpp"
#include "timemory/config.hpp"
#include "timemory/environment.hpp"
#include "timemory/manager.hpp"