Use gersemi for CMake formatting (#257)
* Replace `cmake-format` with `gersemi`
Signed-off-by: David Galiffi <David.Galiffi@amd.com>
* Remove .cmake-format.yaml
Signed-off-by: David Galiffi <David.Galiffi@amd.com>
* Update workflow to use gersemi
Signed-off-by: David Galiffi <David.Galiffi@amd.com>
* Update CONTRIBUTING.md
* Update helper scripts
* Don't include `*/external/*` in workflows
---------
Signed-off-by: David Galiffi <David.Galiffi@amd.com>
[ROCm/rocprofiler-systems commit: 122623a929]
This commit is contained in:
@@ -19,8 +19,13 @@ endif()
|
||||
|
||||
if(ROCPROFSYS_BUILD_DEVELOPER)
|
||||
add_custom_target(rocprofiler-systems-precommit)
|
||||
foreach(_TARGET format-rocprofiler-systems-source format-rocprofiler-systems-cmake
|
||||
format-timemory-source format-timemory-cmake)
|
||||
foreach(
|
||||
_TARGET
|
||||
format-rocprofiler-systems-source
|
||||
format-rocprofiler-systems-cmake
|
||||
format-timemory-source
|
||||
format-timemory-cmake
|
||||
)
|
||||
if(TARGET ${_TARGET})
|
||||
add_dependencies(rocprofiler-systems-precommit ${_TARGET})
|
||||
endif()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
set(ROCPROFSYS_EXE_INSTALL_RPATH
|
||||
"\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}"
|
||||
)
|
||||
)
|
||||
|
||||
# executables
|
||||
add_subdirectory(rocprof-sys-avail)
|
||||
|
||||
@@ -8,37 +8,42 @@ add_executable(rocprofiler-systems-avail)
|
||||
|
||||
target_sources(
|
||||
rocprofiler-systems-avail
|
||||
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/avail.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/avail.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/common.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/common.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/component_categories.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/defines.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/enumerated_list.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/generate_config.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/generate_config.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/get_availability.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/get_categories.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/info_type.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/info_type.hpp)
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_LIST_DIR}/avail.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/avail.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/common.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/common.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/component_categories.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/defines.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/enumerated_list.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/generate_config.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/generate_config.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/get_availability.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/get_categories.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/info_type.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/info_type.hpp
|
||||
)
|
||||
|
||||
target_include_directories(rocprofiler-systems-avail PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||
target_compile_definitions(rocprofiler-systems-avail
|
||||
PRIVATE ROCPROFSYS_EXTERN_COMPONENTS=0)
|
||||
target_compile_definitions(
|
||||
rocprofiler-systems-avail
|
||||
PRIVATE ROCPROFSYS_EXTERN_COMPONENTS=0
|
||||
)
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-avail
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-compile-definitions
|
||||
rocprofiler-systems::rocprofiler-systems-interface-library
|
||||
rocprofiler-systems::librocprofiler-systems-static)
|
||||
PRIVATE
|
||||
rocprofiler-systems::rocprofiler-systems-compile-definitions
|
||||
rocprofiler-systems::rocprofiler-systems-interface-library
|
||||
rocprofiler-systems::librocprofiler-systems-static
|
||||
)
|
||||
set_target_properties(
|
||||
rocprofiler-systems-avail
|
||||
PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
|
||||
OUTPUT_NAME ${BINARY_NAME_PREFIX}-avail)
|
||||
PROPERTIES
|
||||
BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
|
||||
OUTPUT_NAME ${BINARY_NAME_PREFIX}-avail
|
||||
)
|
||||
|
||||
rocprofiler_systems_strip_target(rocprofiler-systems-avail)
|
||||
|
||||
install(
|
||||
TARGETS rocprofiler-systems-avail
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
OPTIONAL)
|
||||
install(TARGETS rocprofiler-systems-avail DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
|
||||
|
||||
@@ -7,25 +7,28 @@
|
||||
add_executable(
|
||||
rocprofiler-systems-causal
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-causal.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-causal.hpp ${CMAKE_CURRENT_LIST_DIR}/impl.cpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-causal.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/impl.cpp
|
||||
)
|
||||
|
||||
target_compile_definitions(rocprofiler-systems-causal PRIVATE TIMEMORY_CMAKE=1)
|
||||
target_include_directories(rocprofiler-systems-causal PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-causal
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-compile-definitions
|
||||
rocprofiler-systems::rocprofiler-systems-headers
|
||||
rocprofiler-systems::rocprofiler-systems-common-library
|
||||
rocprofiler-systems::rocprofiler-systems-core)
|
||||
PRIVATE
|
||||
rocprofiler-systems::rocprofiler-systems-compile-definitions
|
||||
rocprofiler-systems::rocprofiler-systems-headers
|
||||
rocprofiler-systems::rocprofiler-systems-common-library
|
||||
rocprofiler-systems::rocprofiler-systems-core
|
||||
)
|
||||
set_target_properties(
|
||||
rocprofiler-systems-causal
|
||||
PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
|
||||
OUTPUT_NAME ${BINARY_NAME_PREFIX}-causal)
|
||||
PROPERTIES
|
||||
BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
|
||||
OUTPUT_NAME ${BINARY_NAME_PREFIX}-causal
|
||||
)
|
||||
|
||||
rocprofiler_systems_strip_target(rocprofiler-systems-causal)
|
||||
|
||||
install(
|
||||
TARGETS rocprofiler-systems-causal
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
OPTIONAL)
|
||||
install(TARGETS rocprofiler-systems-causal DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
|
||||
|
||||
@@ -7,19 +7,20 @@
|
||||
|
||||
add_executable(rocprofiler-systems-exe ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys.cpp)
|
||||
|
||||
target_link_libraries(rocprofiler-systems-exe
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-threading)
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-exe
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-threading
|
||||
)
|
||||
|
||||
set_target_properties(
|
||||
rocprofiler-systems-exe
|
||||
PROPERTIES OUTPUT_NAME rocprof-sys
|
||||
BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
|
||||
INSTALL_RPATH_USE_LINK_PATH ON)
|
||||
PROPERTIES
|
||||
OUTPUT_NAME rocprof-sys
|
||||
BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
|
||||
INSTALL_RPATH_USE_LINK_PATH ON
|
||||
)
|
||||
|
||||
rocprofiler_systems_strip_target(rocprofiler-systems-exe)
|
||||
|
||||
install(
|
||||
TARGETS rocprofiler-systems-exe
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
OPTIONAL)
|
||||
install(TARGETS rocprofiler-systems-exe DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
|
||||
|
||||
@@ -10,43 +10,51 @@ add_executable(rocprofiler-systems-instrument)
|
||||
|
||||
target_sources(
|
||||
rocprofiler-systems-instrument
|
||||
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/details.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/function_signature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/function_signature.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/fwd.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/info.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal_libs.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal_libs.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/log.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/log.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/module_function.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/module_function.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-instrument.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-instrument.hpp)
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_LIST_DIR}/details.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/function_signature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/function_signature.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/fwd.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/info.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal_libs.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal_libs.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/log.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/log.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/module_function.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/module_function.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-instrument.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-instrument.hpp
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-instrument
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-headers
|
||||
rocprofiler-systems::rocprofiler-systems-dyninst
|
||||
rocprofiler-systems::rocprofiler-systems-compile-options
|
||||
rocprofiler-systems::rocprofiler-systems-compile-definitions
|
||||
rocprofiler-systems::rocprofiler-systems-sanitizer
|
||||
timemory::timemory-headers
|
||||
timemory::timemory-extensions
|
||||
timemory::timemory-core)
|
||||
PRIVATE
|
||||
rocprofiler-systems::rocprofiler-systems-headers
|
||||
rocprofiler-systems::rocprofiler-systems-dyninst
|
||||
rocprofiler-systems::rocprofiler-systems-compile-options
|
||||
rocprofiler-systems::rocprofiler-systems-compile-definitions
|
||||
rocprofiler-systems::rocprofiler-systems-sanitizer
|
||||
timemory::timemory-headers
|
||||
timemory::timemory-extensions
|
||||
timemory::timemory-core
|
||||
)
|
||||
|
||||
add_target_flag_if_avail(rocprofiler-systems-instrument "-Wno-deprecated-declarations")
|
||||
|
||||
set_target_properties(
|
||||
rocprofiler-systems-instrument
|
||||
PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
|
||||
INSTALL_RPATH_USE_LINK_PATH ON
|
||||
OUTPUT_NAME ${BINARY_NAME_PREFIX}-instrument)
|
||||
PROPERTIES
|
||||
BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
|
||||
INSTALL_RPATH_USE_LINK_PATH ON
|
||||
OUTPUT_NAME ${BINARY_NAME_PREFIX}-instrument
|
||||
)
|
||||
|
||||
if(ROCPROFSYS_BUILD_DYNINST)
|
||||
target_compile_definitions(rocprofiler-systems-instrument
|
||||
PRIVATE ROCPROFSYS_BUILD_DYNINST=1)
|
||||
target_compile_definitions(
|
||||
rocprofiler-systems-instrument
|
||||
PRIVATE ROCPROFSYS_BUILD_DYNINST=1
|
||||
)
|
||||
endif()
|
||||
|
||||
add_target_flag_if_avail(rocprofiler-systems-instrument "-Wno-deprecated-declarations")
|
||||
@@ -61,4 +69,5 @@ endif()
|
||||
install(
|
||||
TARGETS rocprofiler-systems-instrument
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
OPTIONAL)
|
||||
OPTIONAL
|
||||
)
|
||||
|
||||
@@ -7,26 +7,29 @@
|
||||
add_executable(
|
||||
rocprofiler-systems-run
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-run.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-run.hpp ${CMAKE_CURRENT_LIST_DIR}/impl.cpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-run.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/impl.cpp
|
||||
)
|
||||
|
||||
target_compile_definitions(rocprofiler-systems-run PRIVATE TIMEMORY_CMAKE=1)
|
||||
target_include_directories(rocprofiler-systems-run PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-run
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-compile-definitions
|
||||
rocprofiler-systems::rocprofiler-systems-headers
|
||||
rocprofiler-systems::rocprofiler-systems-common-library
|
||||
rocprofiler-systems::rocprofiler-systems-core
|
||||
rocprofiler-systems::rocprofiler-systems-sanitizer)
|
||||
PRIVATE
|
||||
rocprofiler-systems::rocprofiler-systems-compile-definitions
|
||||
rocprofiler-systems::rocprofiler-systems-headers
|
||||
rocprofiler-systems::rocprofiler-systems-common-library
|
||||
rocprofiler-systems::rocprofiler-systems-core
|
||||
rocprofiler-systems::rocprofiler-systems-sanitizer
|
||||
)
|
||||
set_target_properties(
|
||||
rocprofiler-systems-run
|
||||
PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
|
||||
OUTPUT_NAME ${BINARY_NAME_PREFIX}-run)
|
||||
PROPERTIES
|
||||
BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
|
||||
OUTPUT_NAME ${BINARY_NAME_PREFIX}-run
|
||||
)
|
||||
|
||||
rocprofiler_systems_strip_target(rocprofiler-systems-run)
|
||||
|
||||
install(
|
||||
TARGETS rocprofiler-systems-run
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
OPTIONAL)
|
||||
install(TARGETS rocprofiler-systems-run DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
|
||||
|
||||
@@ -4,25 +4,29 @@
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_executable(rocprofiler-systems-sample ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-sample.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/impl.cpp)
|
||||
add_executable(
|
||||
rocprofiler-systems-sample
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-sample.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/impl.cpp
|
||||
)
|
||||
|
||||
target_compile_definitions(rocprofiler-systems-sample PRIVATE TIMEMORY_CMAKE=1)
|
||||
target_include_directories(rocprofiler-systems-sample PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-sample
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-compile-definitions
|
||||
rocprofiler-systems::rocprofiler-systems-headers
|
||||
rocprofiler-systems::rocprofiler-systems-common-library)
|
||||
PRIVATE
|
||||
rocprofiler-systems::rocprofiler-systems-compile-definitions
|
||||
rocprofiler-systems::rocprofiler-systems-headers
|
||||
rocprofiler-systems::rocprofiler-systems-common-library
|
||||
)
|
||||
set_target_properties(
|
||||
rocprofiler-systems-sample
|
||||
PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
|
||||
OUTPUT_NAME ${BINARY_NAME_PREFIX}-sample)
|
||||
PROPERTIES
|
||||
BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
|
||||
OUTPUT_NAME ${BINARY_NAME_PREFIX}-sample
|
||||
)
|
||||
|
||||
rocprofiler_systems_strip_target(rocprofiler-systems-sample)
|
||||
|
||||
install(
|
||||
TARGETS rocprofiler-systems-sample
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
OPTIONAL)
|
||||
install(TARGETS rocprofiler-systems-sample DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
set(ROCPROFSYS_ABORT_FAIL_REGEX
|
||||
"### ERROR ###|unknown-hash=|address of faulting memory reference|exiting with non-zero exit code|terminate called after throwing an instance|calling abort.. in |Exit code: [1-9]"
|
||||
CACHE INTERNAL "Regex to catch abnormal exits when a PASS_REGULAR_EXPRESSION is set"
|
||||
FORCE)
|
||||
CACHE INTERNAL
|
||||
"Regex to catch abnormal exits when a PASS_REGULAR_EXPRESSION is set"
|
||||
FORCE
|
||||
)
|
||||
|
||||
# adds a ctest for executable
|
||||
function(ROCPROFILER_SYSTEMS_ADD_BIN_TEST)
|
||||
@@ -11,7 +13,8 @@ function(ROCPROFILER_SYSTEMS_ADD_BIN_TEST)
|
||||
"NAME;TARGET;TIMEOUT;WORKING_DIRECTORY" # single value args
|
||||
"ARGS;ENVIRONMENT;LABELS;PROPERTIES;PASS_REGEX;FAIL_REGEX;SKIP_REGEX;DEPENDS;COMMAND" # multiple
|
||||
# value args
|
||||
${ARGN})
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
if(NOT TEST_WORKING_DIRECTORY)
|
||||
set(TEST_WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||
@@ -24,7 +27,7 @@ function(ROCPROFILER_SYSTEMS_ADD_BIN_TEST)
|
||||
"ROCPROFSYS_USE_SAMPLING=ON"
|
||||
"ROCPROFSYS_TIME_OUTPUT=OFF"
|
||||
"LD_LIBRARY_PATH=${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}:$ENV{LD_LIBRARY_PATH}"
|
||||
)
|
||||
)
|
||||
endif()
|
||||
|
||||
# common
|
||||
@@ -35,7 +38,8 @@ function(ROCPROFILER_SYSTEMS_ADD_BIN_TEST)
|
||||
"ROCPROFSYS_CI_TIMEOUT=${TEST_TIMEOUT}"
|
||||
"ROCPROFSYS_CONFIG_FILE="
|
||||
"ROCPROFSYS_OUTPUT_PATH=${PROJECT_BINARY_DIR}/rocprof-sys-tests-output"
|
||||
"TWD=${TEST_WORKING_DIRECTORY}")
|
||||
"TWD=${TEST_WORKING_DIRECTORY}"
|
||||
)
|
||||
# copy for inverse
|
||||
set(TEST_ENVIRONMENT_INV "${TEST_ENVIRONMENT}")
|
||||
|
||||
@@ -43,68 +47,67 @@ function(ROCPROFILER_SYSTEMS_ADD_BIN_TEST)
|
||||
list(APPEND TEST_ENVIRONMENT "ROCPROFSYS_OUTPUT_PREFIX=${TEST_NAME}/")
|
||||
list(APPEND TEST_ENVIRONMENT_INV "ROCPROFSYS_OUTPUT_PREFIX=${TEST_NAME}-inverse/")
|
||||
|
||||
if(NOT "${TEST_PASS_REGEX}" STREQUAL ""
|
||||
AND NOT "${TEST_FAIL_REGEX}" STREQUAL ""
|
||||
AND NOT "${TEST_FAIL_REGEX}" MATCHES "\\|ROCPROFSYS_ABORT_FAIL_REGEX")
|
||||
if(
|
||||
NOT "${TEST_PASS_REGEX}" STREQUAL ""
|
||||
AND NOT "${TEST_FAIL_REGEX}" STREQUAL ""
|
||||
AND NOT "${TEST_FAIL_REGEX}" MATCHES "\\|ROCPROFSYS_ABORT_FAIL_REGEX"
|
||||
)
|
||||
rocprofiler_systems_message(
|
||||
FATAL_ERROR
|
||||
"${TEST_NAME} has set pass and fail regexes but fail regex does not include '|ROCPROFSYS_ABORT_FAIL_REGEX'"
|
||||
)
|
||||
)
|
||||
endif()
|
||||
|
||||
if("${TEST_FAIL_REGEX}" STREQUAL "")
|
||||
set(TEST_FAIL_REGEX "(${ROCPROFSYS_ABORT_FAIL_REGEX})")
|
||||
else()
|
||||
string(REPLACE "|ROCPROFSYS_ABORT_FAIL_REGEX" "|${ROCPROFSYS_ABORT_FAIL_REGEX}"
|
||||
TEST_FAIL_REGEX "${TEST_FAIL_REGEX}")
|
||||
string(
|
||||
REPLACE
|
||||
"|ROCPROFSYS_ABORT_FAIL_REGEX"
|
||||
"|${ROCPROFSYS_ABORT_FAIL_REGEX}"
|
||||
TEST_FAIL_REGEX
|
||||
"${TEST_FAIL_REGEX}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TEST_COMMAND)
|
||||
add_test(
|
||||
NAME ${TEST_NAME}
|
||||
COMMAND ${TEST_COMMAND} ${TEST_ARGS}
|
||||
WORKING_DIRECTORY ${TEST_WORKING_DIRECTORY})
|
||||
WORKING_DIRECTORY ${TEST_WORKING_DIRECTORY}
|
||||
)
|
||||
|
||||
set_tests_properties(
|
||||
${TEST_NAME}
|
||||
PROPERTIES ENVIRONMENT
|
||||
"${TEST_ENVIRONMENT}"
|
||||
TIMEOUT
|
||||
${TEST_TIMEOUT}
|
||||
DEPENDS
|
||||
"${TEST_DEPENDS}"
|
||||
LABELS
|
||||
"rocprofiler-systems-bin;${TEST_LABELS}"
|
||||
PASS_REGULAR_EXPRESSION
|
||||
"${TEST_PASS_REGEX}"
|
||||
FAIL_REGULAR_EXPRESSION
|
||||
"${TEST_FAIL_REGEX}"
|
||||
SKIP_REGULAR_EXPRESSION
|
||||
"${TEST_SKIP_REGEX}"
|
||||
${TEST_PROPERTIES})
|
||||
PROPERTIES
|
||||
ENVIRONMENT "${TEST_ENVIRONMENT}"
|
||||
TIMEOUT ${TEST_TIMEOUT}
|
||||
DEPENDS "${TEST_DEPENDS}"
|
||||
LABELS "rocprofiler-systems-bin;${TEST_LABELS}"
|
||||
PASS_REGULAR_EXPRESSION "${TEST_PASS_REGEX}"
|
||||
FAIL_REGULAR_EXPRESSION "${TEST_FAIL_REGEX}"
|
||||
SKIP_REGULAR_EXPRESSION "${TEST_SKIP_REGEX}"
|
||||
${TEST_PROPERTIES}
|
||||
)
|
||||
elseif(TARGET ${TEST_TARGET})
|
||||
add_test(
|
||||
NAME ${TEST_NAME}
|
||||
COMMAND $<TARGET_FILE:${TEST_TARGET}> ${TEST_ARGS}
|
||||
WORKING_DIRECTORY ${TEST_WORKING_DIRECTORY})
|
||||
WORKING_DIRECTORY ${TEST_WORKING_DIRECTORY}
|
||||
)
|
||||
|
||||
set_tests_properties(
|
||||
${TEST_NAME}
|
||||
PROPERTIES ENVIRONMENT
|
||||
"${TEST_ENVIRONMENT}"
|
||||
TIMEOUT
|
||||
${TEST_TIMEOUT}
|
||||
DEPENDS
|
||||
"${TEST_DEPENDS}"
|
||||
LABELS
|
||||
"rocprofiler-systems-bin;${TEST_LABELS}"
|
||||
PASS_REGULAR_EXPRESSION
|
||||
"${TEST_PASS_REGEX}"
|
||||
FAIL_REGULAR_EXPRESSION
|
||||
"${TEST_FAIL_REGEX}"
|
||||
SKIP_REGULAR_EXPRESSION
|
||||
"${TEST_SKIP_REGEX}"
|
||||
${TEST_PROPERTIES})
|
||||
PROPERTIES
|
||||
ENVIRONMENT "${TEST_ENVIRONMENT}"
|
||||
TIMEOUT ${TEST_TIMEOUT}
|
||||
DEPENDS "${TEST_DEPENDS}"
|
||||
LABELS "rocprofiler-systems-bin;${TEST_LABELS}"
|
||||
PASS_REGULAR_EXPRESSION "${TEST_PASS_REGEX}"
|
||||
FAIL_REGULAR_EXPRESSION "${TEST_FAIL_REGEX}"
|
||||
SKIP_REGULAR_EXPRESSION "${TEST_SKIP_REGEX}"
|
||||
${TEST_PROPERTIES}
|
||||
)
|
||||
elseif(ROCPROFSYS_BUILD_TESTING)
|
||||
message(FATAL_ERROR "Error! ${TEST_TARGET} does not exist")
|
||||
endif()
|
||||
@@ -118,7 +121,7 @@ rocprofiler_systems_add_bin_test(
|
||||
TIMEOUT 45
|
||||
PASS_REGEX
|
||||
".*\\\[rocprof-sys-instrument\\\] Usage:.*\\\[DEBUG OPTIONS\\\].*\\\[MODE OPTIONS\\\].*\\\[LIBRARY OPTIONS\\\].*\\\[SYMBOL SELECTION OPTIONS\\\].*\\\[RUNTIME OPTIONS\\\].*\\\[GRANULARITY OPTIONS\\\].*\\\[DYNINST OPTIONS\\\].*"
|
||||
)
|
||||
)
|
||||
|
||||
# on RedHat, /usr/bin/ls is a script for `coreutils --coreutils-prog=ls`
|
||||
if(EXISTS /usr/bin/coreutils)
|
||||
@@ -144,7 +147,8 @@ rocprofiler_systems_add_bin_test(
|
||||
${LS_NAME}
|
||||
${LS_ARGS}
|
||||
LABELS "simulate"
|
||||
TIMEOUT 240)
|
||||
TIMEOUT 240
|
||||
)
|
||||
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-instrument-simulate-ls-check
|
||||
@@ -155,7 +159,8 @@ rocprofiler_systems_add_bin_test(
|
||||
TIMEOUT 60
|
||||
PASS_REGEX
|
||||
".*available.json.*available.txt.*available.xml.*excluded.json.*excluded.txt.*excluded.xml.*instrumented.json.*instrumented.txt.*instrumented.xml.*overlapping.json.*overlapping.txt.*overlapping.xml.*"
|
||||
FAIL_REGEX "No such file or directory|not found|ROCPROFSYS_ABORT_FAIL_REGEX")
|
||||
FAIL_REGEX "No such file or directory|not found|ROCPROFSYS_ABORT_FAIL_REGEX"
|
||||
)
|
||||
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-instrument-simulate-lib
|
||||
@@ -166,7 +171,7 @@ rocprofiler_systems_add_bin_test(
|
||||
TIMEOUT 120
|
||||
PASS_REGEX
|
||||
"\\\[rocprof-sys\\\]\\\[exe\\\] Runtime instrumentation is not possible!(.*)\n(.*)\\\[rocprof-sys\\\]\\\[exe\\\] Switching to binary rewrite mode and assuming '--simulate --all-functions'"
|
||||
)
|
||||
)
|
||||
|
||||
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/tmp)
|
||||
|
||||
@@ -183,7 +188,8 @@ rocprofiler_systems_add_bin_test(
|
||||
${CMAKE_SHARED_LIBRARY_PREFIX}$<TARGET_FILE_BASE_NAME:rocprofiler-systems-user-library>${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
LABELS "simulate"
|
||||
TIMEOUT 120
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/tmp)
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/tmp
|
||||
)
|
||||
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-instrument-write-log
|
||||
@@ -199,7 +205,8 @@ rocprofiler_systems_add_bin_test(
|
||||
${LS_ARGS}
|
||||
LABELS "log"
|
||||
TIMEOUT 120
|
||||
PASS_REGEX "Opening .*/instrumentation/user.log")
|
||||
PASS_REGEX "Opening .*/instrumentation/user.log"
|
||||
)
|
||||
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-instrument-write-log-check
|
||||
@@ -210,7 +217,8 @@ rocprofiler_systems_add_bin_test(
|
||||
LABELS "log"
|
||||
TIMEOUT 60
|
||||
PASS_REGEX "user.log"
|
||||
FAIL_REGEX "No such file or directory|not found|ROCPROFSYS_ABORT_FAIL_REGEX")
|
||||
FAIL_REGEX "No such file or directory|not found|ROCPROFSYS_ABORT_FAIL_REGEX"
|
||||
)
|
||||
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-help
|
||||
@@ -220,14 +228,15 @@ rocprofiler_systems_add_bin_test(
|
||||
TIMEOUT 45
|
||||
PASS_REGEX
|
||||
".*\\\[rocprof-sys-avail\\\] Usage:.*\\\[DEBUG OPTIONS\\\].*\\\[INFO OPTIONS\\\].*\\\[FILTER OPTIONS\\\].*\\\[COLUMN OPTIONS\\\].*\\\[DISPLAY OPTIONS\\\].*\\\[OUTPUT OPTIONS\\\].*"
|
||||
)
|
||||
)
|
||||
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-all
|
||||
TARGET rocprofiler-systems-avail
|
||||
ARGS --all
|
||||
LABELS "rocprofiler-systems-avail"
|
||||
TIMEOUT 45)
|
||||
TIMEOUT 45
|
||||
)
|
||||
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-all-expand-keys
|
||||
@@ -235,7 +244,8 @@ rocprofiler_systems_add_bin_test(
|
||||
ARGS --all --expand-keys
|
||||
LABELS "rocprofiler-systems-avail"
|
||||
TIMEOUT 45
|
||||
FAIL_REGEX "%[a-zA-Z_]%|ROCPROFSYS_ABORT_FAIL_REGEX")
|
||||
FAIL_REGEX "%[a-zA-Z_]%|ROCPROFSYS_ABORT_FAIL_REGEX"
|
||||
)
|
||||
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-all-only-available-alphabetical
|
||||
@@ -246,7 +256,8 @@ rocprofiler_systems_add_bin_test(
|
||||
TIMEOUT 45
|
||||
PROPERTIES
|
||||
ATTACHED_FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/rocprof-sys-avail-all-only-available-alphabetical.log)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/rocprof-sys-avail-all-only-available-alphabetical.log
|
||||
)
|
||||
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-all-csv
|
||||
@@ -256,7 +267,7 @@ rocprofiler_systems_add_bin_test(
|
||||
TIMEOUT 45
|
||||
PASS_REGEX
|
||||
"COMPONENT#AVAILABLE#VALUE_TYPE#STRING_IDS#FILENAME#DESCRIPTION#CATEGORY#.*ENVIRONMENT VARIABLE#VALUE#DATA TYPE#DESCRIPTION#CATEGORIES#.*HARDWARE COUNTER#DEVICE#AVAILABLE#DESCRIPTION#"
|
||||
)
|
||||
)
|
||||
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-filter-wall-clock-available
|
||||
@@ -266,7 +277,7 @@ rocprofiler_systems_add_bin_test(
|
||||
TIMEOUT 45
|
||||
PASS_REGEX
|
||||
"\\\|[-]+\\\|\n\\\|[ ]+COMPONENT[ ]+\\\|\n\\\|[-]+\\\|\n\\\| (wall_clock)[ ]+\\\|\n\\\|[-]+\\\|"
|
||||
)
|
||||
)
|
||||
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-category-filter-rocprofiler-systems
|
||||
@@ -277,7 +288,7 @@ rocprofiler_systems_add_bin_test(
|
||||
PASS_REGEX "ROCPROFSYS_(SETTINGS_DESC|OUTPUT_FILE|OUTPUT_PREFIX)"
|
||||
FAIL_REGEX
|
||||
"ROCPROFSYS_(ADD_SECONDARY|SCIENTIFIC|PRECISION|MEMORY_PRECISION|TIMING_PRECISION)|ROCPROFSYS_ABORT_FAIL_REGEX"
|
||||
)
|
||||
)
|
||||
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-category-filter-timemory
|
||||
@@ -287,7 +298,8 @@ rocprofiler_systems_add_bin_test(
|
||||
TIMEOUT 45
|
||||
PASS_REGEX
|
||||
"ROCPROFSYS_(ADD_SECONDARY|SCIENTIFIC|PRECISION|MEMORY_PRECISION|TIMING_PRECISION)"
|
||||
FAIL_REGEX "ROCPROFSYS_(SETTINGS_DESC|OUTPUT_FILE)|ROCPROFSYS_ABORT_FAIL_REGEX")
|
||||
FAIL_REGEX "ROCPROFSYS_(SETTINGS_DESC|OUTPUT_FILE)|ROCPROFSYS_ABORT_FAIL_REGEX"
|
||||
)
|
||||
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-regex-negation
|
||||
@@ -307,12 +319,16 @@ rocprofiler_systems_add_bin_test(
|
||||
TIMEOUT 45
|
||||
PASS_REGEX
|
||||
"ENVIRONMENT VARIABLE,[ \n]+ROCPROFSYS_THREAD_POOL_SIZE,[ \n]+ROCPROFSYS_USE_PID,[ \n]+"
|
||||
FAIL_REGEX "ROCPROFSYS_TRACE|ROCPROFSYS_ABORT_FAIL_REGEX")
|
||||
FAIL_REGEX "ROCPROFSYS_TRACE|ROCPROFSYS_ABORT_FAIL_REGEX"
|
||||
)
|
||||
|
||||
string(
|
||||
REPLACE
|
||||
"+" "\\\+" _AVAIL_CFG_PATH
|
||||
"${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/rocprof-sys-avail/rocprof-sys-")
|
||||
"+"
|
||||
"\\\+"
|
||||
_AVAIL_CFG_PATH
|
||||
"${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/rocprof-sys-avail/rocprof-sys-"
|
||||
)
|
||||
# use of TWD == Test Working Directory (added by function)
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-write-config
|
||||
@@ -331,7 +347,7 @@ rocprofiler_systems_add_bin_test(
|
||||
LABELS "rocprofiler-systems-avail"
|
||||
PASS_REGEX
|
||||
"Outputting JSON configuration file '${_AVAIL_CFG_PATH}test\\\.json'(.*)Outputting XML configuration file '${_AVAIL_CFG_PATH}test\\\.xml'(.*)Outputting text configuration file '${_AVAIL_CFG_PATH}test\\\.cfg'(.*)"
|
||||
)
|
||||
)
|
||||
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-write-config-tweak
|
||||
@@ -343,7 +359,7 @@ rocprofiler_systems_add_bin_test(
|
||||
ENVIRONMENT "ROCPROFSYS_TRACE=OFF;ROCPROFSYS_PROFILE=ON"
|
||||
PASS_REGEX
|
||||
"Outputting JSON configuration file '${_AVAIL_CFG_PATH}tweak\\\.json'(.*)Outputting XML configuration file '${_AVAIL_CFG_PATH}tweak\\\.xml'(.*)Outputting text configuration file '${_AVAIL_CFG_PATH}tweak\\\.cfg'(.*)"
|
||||
)
|
||||
)
|
||||
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-list-keys
|
||||
@@ -351,7 +367,8 @@ rocprofiler_systems_add_bin_test(
|
||||
ARGS --list-keys --expand-keys
|
||||
TIMEOUT 45
|
||||
LABELS "rocprofiler-systems-avail"
|
||||
PASS_REGEX "Output Keys:\n(.*)%argv%(.*)%argv_hash%")
|
||||
PASS_REGEX "Output Keys:\n(.*)%argv%(.*)%argv_hash%"
|
||||
)
|
||||
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-list-keys-markdown
|
||||
@@ -359,7 +376,8 @@ rocprofiler_systems_add_bin_test(
|
||||
ARGS --list-keys --expand-keys --markdown
|
||||
TIMEOUT 45
|
||||
LABELS "rocprofiler-systems-avail;markdown"
|
||||
PASS_REGEX "(.*)`%argv%`(.*)`%argv_hash%`")
|
||||
PASS_REGEX "(.*)`%argv%`(.*)`%argv_hash%`"
|
||||
)
|
||||
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-list-categories
|
||||
@@ -367,7 +385,8 @@ rocprofiler_systems_add_bin_test(
|
||||
ARGS --list-categories
|
||||
TIMEOUT 45
|
||||
LABELS "rocprofiler-systems-avail"
|
||||
PASS_REGEX " component::(.*) hw_counters::(.*) settings::")
|
||||
PASS_REGEX " component::(.*) hw_counters::(.*) settings::"
|
||||
)
|
||||
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-core-categories
|
||||
@@ -377,28 +396,34 @@ rocprofiler_systems_add_bin_test(
|
||||
LABELS "rocprofiler-systems-avail"
|
||||
PASS_REGEX
|
||||
"ROCPROFSYS_CONFIG_FILE(.*)ROCPROFSYS_ENABLED(.*)ROCPROFSYS_SUPPRESS_CONFIG(.*)ROCPROFSYS_SUPPRESS_PARSING(.*)ROCPROFSYS_VERBOSE"
|
||||
)
|
||||
)
|
||||
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-run-help
|
||||
TARGET rocprofiler-systems-run
|
||||
ARGS --help
|
||||
TIMEOUT 45
|
||||
LABELS "rocprofiler-systems-run")
|
||||
LABELS "rocprofiler-systems-run"
|
||||
)
|
||||
|
||||
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/rocprof-sys-tests-config")
|
||||
file(
|
||||
WRITE "${PROJECT_BINARY_DIR}/rocprof-sys-tests-config/empty.cfg"
|
||||
WRITE
|
||||
"${PROJECT_BINARY_DIR}/rocprof-sys-tests-config/empty.cfg"
|
||||
"
|
||||
#
|
||||
# empty config file
|
||||
#
|
||||
")
|
||||
"
|
||||
)
|
||||
|
||||
add_executable(sleeper ${CMAKE_CURRENT_SOURCE_DIR}/sleeper.cpp)
|
||||
set_target_properties(
|
||||
sleeper PROPERTIES BUILD_TYPE RelWithDebInfo RUNTIME_OUTPUT_DIRECTORY
|
||||
${PROJECT_BINARY_DIR}/bin/testing)
|
||||
sleeper
|
||||
PROPERTIES
|
||||
BUILD_TYPE RelWithDebInfo
|
||||
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/testing
|
||||
)
|
||||
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-run-args
|
||||
@@ -494,4 +519,5 @@ rocprofiler_systems_add_bin_test(
|
||||
$<TARGET_FILE:sleeper>
|
||||
5
|
||||
TIMEOUT 45
|
||||
LABELS "rocprofiler-systems-run")
|
||||
LABELS "rocprofiler-systems-run"
|
||||
)
|
||||
|
||||
@@ -21,12 +21,15 @@ set(ROCPROFSYS_LIB_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/${PROJECT_NAME}")
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_library(rocprofiler-systems-interface-library INTERFACE)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-interface-library ALIAS
|
||||
rocprofiler-systems-interface-library)
|
||||
add_library(
|
||||
rocprofiler-systems::rocprofiler-systems-interface-library
|
||||
ALIAS rocprofiler-systems-interface-library
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
rocprofiler-systems-interface-library
|
||||
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/rocprof-sys)
|
||||
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/rocprof-sys
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-interface-library
|
||||
@@ -48,7 +51,7 @@ target_link_libraries(
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-static-libstdcxx-optional>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-sanitizer>
|
||||
$<BUILD_INTERFACE:$<IF:$<BOOL:${ROCPROFSYS_BUILD_LTO}>,rocprofiler-systems::rocprofiler-systems-lto,>>
|
||||
)
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
|
||||
@@ -5,7 +5,8 @@ set(binary_sources
|
||||
${CMAKE_CURRENT_LIST_DIR}/dwarf_entry.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/link_map.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/scope_filter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/symbol.cpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/symbol.cpp
|
||||
)
|
||||
|
||||
set(binary_headers
|
||||
${CMAKE_CURRENT_LIST_DIR}/address_multirange.hpp
|
||||
@@ -14,19 +15,28 @@ set(binary_headers
|
||||
${CMAKE_CURRENT_LIST_DIR}/binary_info.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/link_map.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/scope_filter.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/symbol.hpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/symbol.hpp
|
||||
)
|
||||
|
||||
add_library(rocprofiler-systems-binary-library STATIC)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-binary ALIAS
|
||||
rocprofiler-systems-binary-library)
|
||||
add_library(
|
||||
rocprofiler-systems::rocprofiler-systems-binary
|
||||
ALIAS rocprofiler-systems-binary-library
|
||||
)
|
||||
|
||||
target_sources(rocprofiler-systems-binary-library PRIVATE ${binary_sources}
|
||||
${binary_headers})
|
||||
target_sources(
|
||||
rocprofiler-systems-binary-library
|
||||
PRIVATE ${binary_sources} ${binary_headers}
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-binary-library
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library
|
||||
rocprofiler-systems::rocprofiler-systems-core)
|
||||
PRIVATE
|
||||
rocprofiler-systems::rocprofiler-systems-interface-library
|
||||
rocprofiler-systems::rocprofiler-systems-core
|
||||
)
|
||||
|
||||
set_target_properties(rocprofiler-systems-binary-library
|
||||
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-binary)
|
||||
set_target_properties(
|
||||
rocprofiler-systems-binary-library
|
||||
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-binary
|
||||
)
|
||||
|
||||
@@ -6,32 +6,43 @@
|
||||
|
||||
add_library(rocprofiler-systems-common-library INTERFACE)
|
||||
add_library(rocprofiler-systems::common-library ALIAS rocprofiler-systems-common-library)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-common-library ALIAS
|
||||
rocprofiler-systems-common-library)
|
||||
add_library(
|
||||
rocprofiler-systems::rocprofiler-systems-common-library
|
||||
ALIAS rocprofiler-systems-common-library
|
||||
)
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/defines.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/defines.h @ONLY)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/defines.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/defines.h
|
||||
@ONLY
|
||||
)
|
||||
|
||||
target_sources(
|
||||
rocprofiler-systems-common-library
|
||||
INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/defines.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/delimit.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/environment.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/invoke.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/join.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/setup.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/static_object.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/synchronized.hpp)
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_BINARY_DIR}/defines.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/delimit.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/environment.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/invoke.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/join.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/setup.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/static_object.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/synchronized.hpp
|
||||
)
|
||||
|
||||
get_filename_component(COMMON_SOURCE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" DIRECTORY)
|
||||
get_filename_component(COMMON_BINARY_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}" DIRECTORY)
|
||||
|
||||
target_include_directories(
|
||||
rocprofiler-systems-common-library
|
||||
INTERFACE $<BUILD_INTERFACE:${COMMON_SOURCE_INCLUDE_DIR}>
|
||||
$<BUILD_INTERFACE:${COMMON_BINARY_INCLUDE_DIR}>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/timemory/source>
|
||||
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/timemory/source>)
|
||||
INTERFACE
|
||||
$<BUILD_INTERFACE:${COMMON_SOURCE_INCLUDE_DIR}>
|
||||
$<BUILD_INTERFACE:${COMMON_BINARY_INCLUDE_DIR}>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/timemory/source>
|
||||
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/timemory/source>
|
||||
)
|
||||
|
||||
target_compile_definitions(rocprofiler-systems-common-library
|
||||
INTERFACE $<BUILD_INTERFACE:ROCPROFSYS_INTERNAL_BUILD=1>)
|
||||
target_compile_definitions(
|
||||
rocprofiler-systems-common-library
|
||||
INTERFACE $<BUILD_INTERFACE:ROCPROFSYS_INTERNAL_BUILD=1>
|
||||
)
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/defines.hpp.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/defines.hpp @ONLY)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/defines.hpp.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/defines.hpp
|
||||
@ONLY
|
||||
)
|
||||
|
||||
set(core_sources
|
||||
${CMAKE_CURRENT_LIST_DIR}/argparse.cpp
|
||||
@@ -18,7 +21,8 @@ set(core_sources
|
||||
${CMAKE_CURRENT_LIST_DIR}/amd_smi.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/state.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/timemory.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/utility.cpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/utility.cpp
|
||||
)
|
||||
|
||||
set(core_headers
|
||||
${CMAKE_CURRENT_LIST_DIR}/argparse.hpp
|
||||
@@ -41,28 +45,38 @@ set(core_headers
|
||||
${CMAKE_CURRENT_LIST_DIR}/amd_smi.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/state.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/timemory.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/utility.hpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/utility.hpp
|
||||
)
|
||||
|
||||
add_library(rocprofiler-systems-core-library STATIC)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-core ALIAS
|
||||
rocprofiler-systems-core-library)
|
||||
add_library(
|
||||
rocprofiler-systems::rocprofiler-systems-core
|
||||
ALIAS rocprofiler-systems-core-library
|
||||
)
|
||||
|
||||
target_sources(
|
||||
rocprofiler-systems-core-library PRIVATE ${core_sources} ${core_headers}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/defines.hpp)
|
||||
rocprofiler-systems-core-library
|
||||
PRIVATE ${core_sources} ${core_headers} ${CMAKE_CURRENT_BINARY_DIR}/defines.hpp
|
||||
)
|
||||
add_subdirectory(binary)
|
||||
add_subdirectory(components)
|
||||
add_subdirectory(containers)
|
||||
|
||||
target_include_directories(rocprofiler-systems-core-library BEFORE
|
||||
PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||
target_include_directories(
|
||||
rocprofiler-systems-core-library
|
||||
BEFORE
|
||||
PRIVATE ${CMAKE_CURRENT_LIST_DIR}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
rocprofiler-systems-core-library
|
||||
PRIVATE ${PROJECT_SOURCE_DIR}/external/timemory/source/timemory/tpls/cereal)
|
||||
PRIVATE ${PROJECT_SOURCE_DIR}/external/timemory/source/timemory/tpls/cereal
|
||||
)
|
||||
|
||||
target_link_libraries(rocprofiler-systems-core-library
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library)
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-core-library
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library
|
||||
)
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-core-library
|
||||
PRIVATE
|
||||
@@ -79,7 +93,9 @@ target_link_libraries(
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-static-libstdcxx-optional>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-sanitizer>
|
||||
$<BUILD_INTERFACE:$<IF:$<BOOL:${ROCPROFSYS_BUILD_LTO}>,rocprofiler-systems::rocprofiler-systems-lto,>>
|
||||
)
|
||||
)
|
||||
|
||||
set_target_properties(rocprofiler-systems-core-library
|
||||
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-core)
|
||||
set_target_properties(
|
||||
rocprofiler-systems-core-library
|
||||
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-core
|
||||
)
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
#
|
||||
set(binary_sources ${CMAKE_CURRENT_LIST_DIR}/address_range.cpp)
|
||||
|
||||
set(binary_headers ${CMAKE_CURRENT_LIST_DIR}/address_range.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/fwd.hpp)
|
||||
set(binary_headers
|
||||
${CMAKE_CURRENT_LIST_DIR}/address_range.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/fwd.hpp
|
||||
)
|
||||
|
||||
target_sources(rocprofiler-systems-core-library PRIVATE ${binary_sources}
|
||||
${binary_headers})
|
||||
target_sources(
|
||||
rocprofiler-systems-core-library
|
||||
PRIVATE ${binary_sources} ${binary_headers}
|
||||
)
|
||||
|
||||
@@ -3,5 +3,7 @@ set(component_sources)
|
||||
|
||||
set(component_headers ${CMAKE_CURRENT_LIST_DIR}/fwd.hpp)
|
||||
|
||||
target_sources(rocprofiler-systems-core-library PRIVATE ${component_sources}
|
||||
${component_headers})
|
||||
target_sources(
|
||||
rocprofiler-systems-core-library
|
||||
PRIVATE ${component_sources} ${component_headers}
|
||||
)
|
||||
|
||||
@@ -6,7 +6,10 @@ set(containers_headers
|
||||
${CMAKE_CURRENT_LIST_DIR}/c_array.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/operators.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/stable_vector.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/static_vector.hpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/static_vector.hpp
|
||||
)
|
||||
|
||||
target_sources(rocprofiler-systems-core-library PRIVATE ${containers_sources}
|
||||
${containers_headers})
|
||||
target_sources(
|
||||
rocprofiler-systems-core-library
|
||||
PRIVATE ${containers_sources} ${containers_headers}
|
||||
)
|
||||
|
||||
@@ -13,41 +13,54 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
add_library(rocprofiler-systems-dl-library SHARED)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-dl-library ALIAS
|
||||
rocprofiler-systems-dl-library)
|
||||
add_library(
|
||||
rocprofiler-systems::rocprofiler-systems-dl-library
|
||||
ALIAS rocprofiler-systems-dl-library
|
||||
)
|
||||
|
||||
target_sources(
|
||||
rocprofiler-systems-dl-library
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/dl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/main.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dl/dl.hpp)
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dl.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/main.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dl/dl.hpp
|
||||
)
|
||||
target_include_directories(
|
||||
rocprofiler-systems-dl-library
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../rocprof-sys-user>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../rocprof-sys>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
PRIVATE ${rocprofiler-sdk_INCLUDE_DIR})
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../rocprof-sys-user>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../rocprof-sys>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
PRIVATE ${rocprofiler-sdk_INCLUDE_DIR}
|
||||
)
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-dl-library
|
||||
PUBLIC $<BUILD_INTERFACE:${dl_LIBRARY}>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::common-library>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-compile-definitions>
|
||||
$<BUILD_INTERFACE:Threads::Threads>)
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${dl_LIBRARY}>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::common-library>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-compile-definitions>
|
||||
$<BUILD_INTERFACE:Threads::Threads>
|
||||
)
|
||||
|
||||
add_target_cxx_flag_if_avail(rocprofiler-systems-dl-library "-ftls-model=global-dynamic")
|
||||
add_target_cxx_flag_if_avail(rocprofiler-systems-dl-library "-g3")
|
||||
|
||||
set_target_properties(
|
||||
rocprofiler-systems-dl-library
|
||||
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-dl
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
BUILD_RPATH "\$ORIGIN"
|
||||
INSTALL_RPATH "\$ORIGIN")
|
||||
PROPERTIES
|
||||
OUTPUT_NAME ${BINARY_NAME_PREFIX}-dl
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
BUILD_RPATH "\$ORIGIN"
|
||||
INSTALL_RPATH "\$ORIGIN"
|
||||
)
|
||||
|
||||
rocprofiler_systems_strip_target(rocprofiler-systems-dl-library)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dl/dl.hpp
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/dl)
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_SOURCE_DIR}/dl/dl.hpp
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/dl
|
||||
)
|
||||
|
||||
install(TARGETS rocprofiler-systems-dl-library DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
@@ -23,7 +23,8 @@ if(PLATFORM MATCHES freebsd)
|
||||
src/RTheap-freebsd.c
|
||||
src/RTthread.c
|
||||
src/RTspace.S
|
||||
src/RTsignal.c)
|
||||
src/RTsignal.c
|
||||
)
|
||||
elseif(PLATFORM MATCHES linux)
|
||||
list(
|
||||
APPEND
|
||||
@@ -34,12 +35,24 @@ elseif(PLATFORM MATCHES linux)
|
||||
src/RTheap-linux.c
|
||||
src/RTthread.c
|
||||
src/RTspace.S
|
||||
src/RTsignal.c)
|
||||
list(APPEND RT_STATIC_ONLY_SRC_LIST src/RTstatic_ctors_dtors_begin.c
|
||||
src/RTstatic_ctors_dtors_end.c)
|
||||
src/RTsignal.c
|
||||
)
|
||||
list(
|
||||
APPEND
|
||||
RT_STATIC_ONLY_SRC_LIST
|
||||
src/RTstatic_ctors_dtors_begin.c
|
||||
src/RTstatic_ctors_dtors_end.c
|
||||
)
|
||||
elseif(PLATFORM MATCHES nt OR PLATFORM MATCHES windows)
|
||||
list(APPEND SRC_LIST src/RTheap.c src/RTheap-win.c src/RTwinnt.c src/RTthread.c
|
||||
src/RTthread-x86.c)
|
||||
list(
|
||||
APPEND
|
||||
SRC_LIST
|
||||
src/RTheap.c
|
||||
src/RTheap-win.c
|
||||
src/RTwinnt.c
|
||||
src/RTthread.c
|
||||
src/RTthread-x86.c
|
||||
)
|
||||
endif()
|
||||
|
||||
set(SRC_LIST_i386 src/RTthread-x86.c src/RTtlsgetaddr-x86.S)
|
||||
@@ -50,9 +63,10 @@ set(SRC_LIST_ppc32 src/RTthread-powerpc.c src/RTthread-powerpc-asm.S)
|
||||
set(RT_STATIC_ONLY_SRC_LIST_ppc32 src/RTstatic_ctors_dtors-ppc32.c)
|
||||
set(SRC_LIST_ppc64 src/RTthread-powerpc.c src/RTthread-powerpc-asm.S)
|
||||
set(RT_STATIC_ONLY_SRC_LIST_ppc64 src/RTstatic_ctors_dtors-ppc64.c)
|
||||
set(SRC_LIST_aarch64 src/RTthread-aarch64.c
|
||||
# src/RTthread-aarch64-asm.S
|
||||
)
|
||||
set(SRC_LIST_aarch64
|
||||
src/RTthread-aarch64.c
|
||||
# src/RTthread-aarch64-asm.S
|
||||
)
|
||||
set(RT_STATIC_ONLY_SRC_LIST_aarch64 src/RTstatic_ctors_dtors-aarch64.c)
|
||||
|
||||
# We use gcc to compile the various assembly files, but cmake doesn't default to knowing
|
||||
@@ -69,14 +83,18 @@ endif()
|
||||
if(UNIX)
|
||||
if(PLATFORM MATCHES amd64 OR PLATFORM MATCHES x86_64)
|
||||
set(SRC_LIST_mabi ${SRC_LIST} ${SRC_LIST_i386})
|
||||
set(RT_STATIC_ONLY_SRC_LIST_mabi ${RT_STATIC_ONLY_SRC_LIST}
|
||||
${RT_STATIC_ONLY_SRC_LIST_i386})
|
||||
set(RT_STATIC_ONLY_SRC_LIST_mabi
|
||||
${RT_STATIC_ONLY_SRC_LIST}
|
||||
${RT_STATIC_ONLY_SRC_LIST_i386}
|
||||
)
|
||||
list(APPEND SRC_LIST ${SRC_LIST_x86_64})
|
||||
list(APPEND RT_STATIC_ONLY_SRC_LIST ${RT_STATIC_ONLY_SRC_LIST_x86_64})
|
||||
elseif(PLATFORM MATCHES ppc64)
|
||||
set(SRC_LIST_mabi ${SRC_LIST} ${SRC_LIST_ppc32})
|
||||
set(RT_STATIC_ONLY_SRC_LIST_mabi ${RT_STATIC_ONLY_SRC_LIST}
|
||||
${RT_STATIC_ONLY_SRC_LIST_ppc32})
|
||||
set(RT_STATIC_ONLY_SRC_LIST_mabi
|
||||
${RT_STATIC_ONLY_SRC_LIST}
|
||||
${RT_STATIC_ONLY_SRC_LIST_ppc32}
|
||||
)
|
||||
list(APPEND SRC_LIST ${SRC_LIST_ppc64})
|
||||
list(APPEND RT_STATIC_ONLY_SRC_LIST ${RT_STATIC_ONLY_SRC_LIST_ppc64})
|
||||
elseif(PLATFORM MATCHES i386)
|
||||
@@ -92,29 +110,36 @@ if(UNIX)
|
||||
endif()
|
||||
|
||||
add_library(rocprofiler-systems-rt-library SHARED)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-rt-library ALIAS
|
||||
rocprofiler-systems-rt-library)
|
||||
add_library(
|
||||
rocprofiler-systems::rocprofiler-systems-rt-library
|
||||
ALIAS rocprofiler-systems-rt-library
|
||||
)
|
||||
|
||||
target_sources(rocprofiler-systems-rt-library PRIVATE ${SRC_LIST})
|
||||
target_include_directories(
|
||||
rocprofiler-systems-rt-library
|
||||
PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/h>)
|
||||
PRIVATE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/h>
|
||||
)
|
||||
target_compile_definitions(rocprofiler-systems-rt-library PRIVATE ${UNIFIED_DEFINES})
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-rt-library
|
||||
PUBLIC $<BUILD_INTERFACE:${dl_LIBRARY}>
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-threading)
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-threading
|
||||
)
|
||||
|
||||
add_target_cxx_flag_if_avail(rocprofiler-systems-rt-library "-g3")
|
||||
|
||||
set_target_properties(
|
||||
rocprofiler-systems-rt-library
|
||||
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-rt
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
BUILD_RPATH "\$ORIGIN"
|
||||
INSTALL_RPATH "\$ORIGIN")
|
||||
PROPERTIES
|
||||
OUTPUT_NAME ${BINARY_NAME_PREFIX}-rt
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
BUILD_RPATH "\$ORIGIN"
|
||||
INSTALL_RPATH "\$ORIGIN"
|
||||
)
|
||||
|
||||
rocprofiler_systems_strip_target(rocprofiler-systems-rt-library)
|
||||
|
||||
@@ -125,7 +150,8 @@ if(NOT EXISTS ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME})
|
||||
endif()
|
||||
|
||||
add_custom_target(
|
||||
rocprofiler-systems-rt-library-dyninstAPI_RT-symlink ALL
|
||||
rocprofiler-systems-rt-library-dyninstAPI_RT-symlink
|
||||
ALL
|
||||
${CMAKE_COMMAND} -E create_symlink
|
||||
../$<TARGET_FILE_NAME:rocprofiler-systems-rt-library>
|
||||
${CMAKE_SHARED_LIBRARY_PREFIX}dyninstAPI_RT${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
@@ -133,9 +159,10 @@ add_custom_target(
|
||||
DEPENDS rocprofiler-systems-rt-library
|
||||
COMMENT
|
||||
"Creating ${CMAKE_SHARED_LIBRARY_PREFIX}dyninstAPI_RT${CMAKE_SHARED_LIBRARY_SUFFIX} to rocprof-sys-rt..."
|
||||
)
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/${CMAKE_SHARED_LIBRARY_PREFIX}dyninstAPI_RT${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME})
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
|
||||
)
|
||||
|
||||
@@ -4,8 +4,14 @@
|
||||
set(PLATFORM $ENV{PLATFORM})
|
||||
|
||||
set(VALID_PLATFORMS
|
||||
amd64-unknown-freebsd7.2 i386-unknown-freebsd7.2 i386-unknown-linux2.4 ppc32_linux
|
||||
ppc64_linux x86_64-unknown-linux2.4 aarch64-unknown-linux)
|
||||
amd64-unknown-freebsd7.2
|
||||
i386-unknown-freebsd7.2
|
||||
i386-unknown-linux2.4
|
||||
ppc32_linux
|
||||
ppc64_linux
|
||||
x86_64-unknown-linux2.4
|
||||
aarch64-unknown-linux
|
||||
)
|
||||
|
||||
if(NOT PLATFORM)
|
||||
set(INVALID_PLATFORM true)
|
||||
@@ -19,7 +25,8 @@ endif()
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_CURRENT_LIST_DIR}/sysname
|
||||
OUTPUT_VARIABLE SYSNAME_OUT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
string(REPLACE "\n" "" SYSPLATFORM ${SYSNAME_OUT})
|
||||
|
||||
if(INVALID_PLATFORM)
|
||||
@@ -27,10 +34,12 @@ if(INVALID_PLATFORM)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_CURRENT_LIST_DIR}/dynsysname ${SYSNAME_OUT}
|
||||
OUTPUT_VARIABLE DYNSYSNAME_OUT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
string(REPLACE "\n" "" PLATFORM ${DYNSYSNAME_OUT})
|
||||
rocprofiler_systems_message(
|
||||
STATUS "-- Attempting to automatically identify platform: ${PLATFORM}")
|
||||
STATUS "-- Attempting to automatically identify platform: ${PLATFORM}"
|
||||
)
|
||||
endif()
|
||||
|
||||
list(FIND VALID_PLATFORMS ${PLATFORM} PLATFORM_FOUND)
|
||||
@@ -39,13 +48,21 @@ if(PLATFORM_FOUND EQUAL -1)
|
||||
rocprofiler_systems_message(
|
||||
FATAL_ERROR
|
||||
"Error: unknown platform ${PLATFORM}; please set the PLATFORM environment variable to one of the following options: ${VALID_PLATFORMS}"
|
||||
)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(PLATFORM MATCHES i386)
|
||||
set(ARCH_DEFINES arch_x86)
|
||||
list(APPEND CAP_DEFINES cap_fixpoint_gen cap_noaddr_gen cap_stripped_binaries
|
||||
cap_tramp_liveness cap_virtual_registers cap_stack_mods)
|
||||
list(
|
||||
APPEND
|
||||
CAP_DEFINES
|
||||
cap_fixpoint_gen
|
||||
cap_noaddr_gen
|
||||
cap_stripped_binaries
|
||||
cap_tramp_liveness
|
||||
cap_virtual_registers
|
||||
cap_stack_mods
|
||||
)
|
||||
elseif(PLATFORM MATCHES x86_64 OR PLATFORM MATCHES amd64)
|
||||
set(ARCH_DEFINES arch_x86_64 arch_64bit)
|
||||
list(
|
||||
@@ -57,7 +74,8 @@ elseif(PLATFORM MATCHES x86_64 OR PLATFORM MATCHES amd64)
|
||||
cap_registers
|
||||
cap_stripped_binaries
|
||||
cap_tramp_liveness
|
||||
cap_stack_mods)
|
||||
cap_stack_mods
|
||||
)
|
||||
elseif(PLATFORM MATCHES ppc32)
|
||||
set(ARCH_DEFINES arch_power)
|
||||
list(APPEND CAP_DEFINES cap_registers)
|
||||
@@ -78,20 +96,38 @@ endif()
|
||||
|
||||
if(PLATFORM MATCHES linux)
|
||||
set(OS_DEFINES os_linux)
|
||||
list(APPEND CAP_DEFINES cap_async_events cap_binary_rewriter cap_dwarf
|
||||
cap_mutatee_traps cap_ptrace)
|
||||
list(
|
||||
APPEND
|
||||
CAP_DEFINES
|
||||
cap_async_events
|
||||
cap_binary_rewriter
|
||||
cap_dwarf
|
||||
cap_mutatee_traps
|
||||
cap_ptrace
|
||||
)
|
||||
set(BUG_DEFINES bug_syscall_changepc_rewind bug_force_terminate_failure)
|
||||
elseif(PLATFORM MATCHES cnl)
|
||||
set(OS_DEFINES os_linux os_cnl)
|
||||
list(APPEND CAP_DEFINES cap_async_events cap_binary_rewriter cap_dwarf
|
||||
cap_mutatee_traps cap_ptrace)
|
||||
list(
|
||||
APPEND
|
||||
CAP_DEFINES
|
||||
cap_async_events
|
||||
cap_binary_rewriter
|
||||
cap_dwarf
|
||||
cap_mutatee_traps
|
||||
cap_ptrace
|
||||
)
|
||||
set(BUG_DEFINES bug_syscall_changepc_rewind)
|
||||
elseif(PLATFORM MATCHES freebsd)
|
||||
set(OS_DEFINES os_freebsd)
|
||||
list(APPEND CAP_DEFINES cap_binary_rewriter cap_dwarf cap_mutatee_traps)
|
||||
set(BUG_DEFINES
|
||||
bug_freebsd_missing_sigstop bug_freebsd_mt_suspend bug_freebsd_change_pc
|
||||
bug_phdrs_first_page bug_syscall_changepc_rewind)
|
||||
bug_freebsd_missing_sigstop
|
||||
bug_freebsd_mt_suspend
|
||||
bug_freebsd_change_pc
|
||||
bug_phdrs_first_page
|
||||
bug_syscall_changepc_rewind
|
||||
)
|
||||
elseif(PLATFORM STREQUAL i386-unknown-nt4.0)
|
||||
set(OS_DEFINES os_windows)
|
||||
list(APPEND CAP_DEFINES cap_mem_emulation cap_mutatee_traps)
|
||||
@@ -126,7 +162,12 @@ if(Thread_DB_FOUND)
|
||||
list(APPEND CAP_DEFINES cap_thread_db)
|
||||
endif()
|
||||
|
||||
set(UNIFIED_DEFINES ${CAP_DEFINES} ${BUG_DEFINES} ${ARCH_DEFINES} ${OS_DEFINES}
|
||||
${OLD_DEFINES})
|
||||
set(UNIFIED_DEFINES
|
||||
${CAP_DEFINES}
|
||||
${BUG_DEFINES}
|
||||
${ARCH_DEFINES}
|
||||
${OS_DEFINES}
|
||||
${OLD_DEFINES}
|
||||
)
|
||||
|
||||
list(REMOVE_DUPLICATES UNIFIED_DEFINES)
|
||||
|
||||
@@ -11,43 +11,61 @@ set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
|
||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
|
||||
|
||||
add_library(rocprofiler-systems-user-library SHARED)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-user-library ALIAS
|
||||
rocprofiler-systems-user-library)
|
||||
add_library(
|
||||
rocprofiler-systems::rocprofiler-systems-user-library
|
||||
ALIAS rocprofiler-systems-user-library
|
||||
)
|
||||
|
||||
set(_user_headers
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/user.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/types.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/causal.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/categories.h)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/categories.h
|
||||
)
|
||||
|
||||
set(_user_sources ${CMAKE_CURRENT_SOURCE_DIR}/user.cpp)
|
||||
|
||||
target_sources(rocprofiler-systems-user-library PRIVATE ${_user_sources} ${_user_headers})
|
||||
target_include_directories(
|
||||
rocprofiler-systems-user-library
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-user-library
|
||||
PRIVATE
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-compile-definitions>)
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-compile-definitions>
|
||||
)
|
||||
|
||||
set_target_properties(
|
||||
rocprofiler-systems-user-library
|
||||
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-user
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
BUILD_RPATH "\$ORIGIN"
|
||||
INSTALL_RPATH "\$ORIGIN")
|
||||
PROPERTIES
|
||||
OUTPUT_NAME ${BINARY_NAME_PREFIX}-user
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
BUILD_RPATH "\$ORIGIN"
|
||||
INSTALL_RPATH "\$ORIGIN"
|
||||
)
|
||||
|
||||
rocprofiler_systems_strip_target(rocprofiler-systems-user-library)
|
||||
|
||||
foreach(_HEADER ${_user_headers})
|
||||
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/" _DEST ${_HEADER})
|
||||
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/"
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" _DEST "${_DEST}")
|
||||
string(
|
||||
REPLACE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/"
|
||||
_DEST
|
||||
${_HEADER}
|
||||
)
|
||||
string(
|
||||
REPLACE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/"
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/"
|
||||
_DEST
|
||||
"${_DEST}"
|
||||
)
|
||||
|
||||
configure_file(${_HEADER} ${_DEST} COPYONLY)
|
||||
endforeach()
|
||||
@@ -57,4 +75,5 @@ install(FILES ${_user_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT
|
||||
install(
|
||||
TARGETS rocprofiler-systems-user-library
|
||||
EXPORT rocprofiler-systems-library-targets
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
|
||||
@@ -5,19 +5,28 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_library(rocprofiler-systems-object-library OBJECT)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-object-library ALIAS
|
||||
rocprofiler-systems-object-library)
|
||||
add_library(
|
||||
rocprofiler-systems::rocprofiler-systems-object-library
|
||||
ALIAS rocprofiler-systems-object-library
|
||||
)
|
||||
|
||||
target_sources(
|
||||
rocprofiler-systems-object-library
|
||||
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/library.cpp ${CMAKE_CURRENT_LIST_DIR}/regions.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/progress.cpp ${CMAKE_CURRENT_LIST_DIR}/api.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/timeout.cpp ${CMAKE_CURRENT_LIST_DIR}/api.hpp)
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_LIST_DIR}/library.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/regions.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/progress.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/api.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/timeout.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/api.hpp
|
||||
)
|
||||
|
||||
add_subdirectory(library)
|
||||
|
||||
target_link_libraries(rocprofiler-systems-object-library
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library)
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-object-library
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
@@ -25,19 +34,28 @@ target_link_libraries(rocprofiler-systems-object-library
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_library(rocprofiler-systems-static-library STATIC
|
||||
$<TARGET_OBJECTS:rocprofiler-systems-object-library>)
|
||||
add_library(rocprofiler-systems::librocprofiler-systems-static ALIAS
|
||||
rocprofiler-systems-static-library)
|
||||
add_library(
|
||||
rocprofiler-systems-static-library
|
||||
STATIC
|
||||
$<TARGET_OBJECTS:rocprofiler-systems-object-library>
|
||||
)
|
||||
add_library(
|
||||
rocprofiler-systems::librocprofiler-systems-static
|
||||
ALIAS rocprofiler-systems-static-library
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-static-library
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library
|
||||
rocprofiler-systems::rocprofiler-systems-core
|
||||
rocprofiler-systems::rocprofiler-systems-binary)
|
||||
PRIVATE
|
||||
rocprofiler-systems::rocprofiler-systems-interface-library
|
||||
rocprofiler-systems::rocprofiler-systems-core
|
||||
rocprofiler-systems::rocprofiler-systems-binary
|
||||
)
|
||||
|
||||
set_target_properties(rocprofiler-systems-static-library PROPERTIES OUTPUT_NAME
|
||||
${BINARY_NAME_PREFIX})
|
||||
set_target_properties(
|
||||
rocprofiler-systems-static-library
|
||||
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
@@ -45,29 +63,41 @@ set_target_properties(rocprofiler-systems-static-library PROPERTIES OUTPUT_NAME
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_library(rocprofiler-systems-shared-library SHARED
|
||||
$<TARGET_OBJECTS:rocprofiler-systems-object-library>)
|
||||
add_library(rocprofiler-systems::librocprofiler-systems-shared ALIAS
|
||||
rocprofiler-systems-shared-library)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-library ALIAS
|
||||
rocprofiler-systems-shared-library)
|
||||
add_library(
|
||||
rocprofiler-systems-shared-library
|
||||
SHARED
|
||||
$<TARGET_OBJECTS:rocprofiler-systems-object-library>
|
||||
)
|
||||
add_library(
|
||||
rocprofiler-systems::librocprofiler-systems-shared
|
||||
ALIAS rocprofiler-systems-shared-library
|
||||
)
|
||||
add_library(
|
||||
rocprofiler-systems::rocprofiler-systems-library
|
||||
ALIAS rocprofiler-systems-shared-library
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-shared-library
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library
|
||||
rocprofiler-systems::rocprofiler-systems-core
|
||||
rocprofiler-systems::rocprofiler-systems-binary)
|
||||
PRIVATE
|
||||
rocprofiler-systems::rocprofiler-systems-interface-library
|
||||
rocprofiler-systems::rocprofiler-systems-core
|
||||
rocprofiler-systems::rocprofiler-systems-binary
|
||||
)
|
||||
|
||||
set_target_properties(
|
||||
rocprofiler-systems-shared-library
|
||||
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
INSTALL_RPATH "${ROCPROFSYS_LIB_INSTALL_RPATH}")
|
||||
PROPERTIES
|
||||
OUTPUT_NAME ${BINARY_NAME_PREFIX}
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
INSTALL_RPATH "${ROCPROFSYS_LIB_INSTALL_RPATH}"
|
||||
)
|
||||
|
||||
rocprofiler_systems_strip_target(rocprofiler-systems-shared-library)
|
||||
|
||||
install(
|
||||
TARGETS rocprofiler-systems-shared-library
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
OPTIONAL)
|
||||
OPTIONAL
|
||||
)
|
||||
|
||||
@@ -11,7 +11,8 @@ set(library_sources
|
||||
${CMAKE_CURRENT_LIST_DIR}/sampling.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/thread_deleter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/thread_info.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/tracing.cpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/tracing.cpp
|
||||
)
|
||||
|
||||
set(library_headers
|
||||
${CMAKE_CURRENT_LIST_DIR}/coverage.hpp
|
||||
@@ -28,17 +29,22 @@ set(library_headers
|
||||
${CMAKE_CURRENT_LIST_DIR}/thread_data.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/thread_deleter.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/thread_info.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/tracing.hpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/tracing.hpp
|
||||
)
|
||||
|
||||
target_sources(rocprofiler-systems-object-library PRIVATE ${library_sources}
|
||||
${library_headers})
|
||||
target_sources(
|
||||
rocprofiler-systems-object-library
|
||||
PRIVATE ${library_sources} ${library_headers}
|
||||
)
|
||||
|
||||
if(ROCPROFSYS_USE_ROCM)
|
||||
target_sources(
|
||||
rocprofiler-systems-object-library
|
||||
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rocm.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocprofiler-sdk.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/amd_smi.cpp)
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocm.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocprofiler-sdk.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/amd_smi.cpp
|
||||
)
|
||||
add_subdirectory(rocprofiler-sdk)
|
||||
endif()
|
||||
|
||||
@@ -52,8 +58,11 @@ set(ndebug_sources
|
||||
${CMAKE_CURRENT_LIST_DIR}/components/backtrace_metrics.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/kokkosp.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/amd_smi.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/ompt.cpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/ompt.cpp
|
||||
)
|
||||
|
||||
set_source_files_properties(
|
||||
${ndebug_sources} DIRECTORY ${PROJECT_SOURCE_DIR}/source/lib/rocprof-sys
|
||||
PROPERTIES COMPILE_DEFINITIONS NDEBUG COMPILE_OPTIONS "-g0;-O3")
|
||||
${ndebug_sources}
|
||||
DIRECTORY ${PROJECT_SOURCE_DIR}/source/lib/rocprof-sys
|
||||
PROPERTIES COMPILE_DEFINITIONS NDEBUG COMPILE_OPTIONS "-g0;-O3"
|
||||
)
|
||||
|
||||
@@ -1,15 +1,25 @@
|
||||
#
|
||||
set(causal_sources
|
||||
${CMAKE_CURRENT_LIST_DIR}/data.cpp ${CMAKE_CURRENT_LIST_DIR}/delay.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/experiment.cpp ${CMAKE_CURRENT_LIST_DIR}/sample_data.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/sampling.cpp ${CMAKE_CURRENT_LIST_DIR}/selected_entry.cpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/data.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/delay.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/experiment.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/sample_data.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/sampling.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/selected_entry.cpp
|
||||
)
|
||||
|
||||
set(causal_headers
|
||||
${CMAKE_CURRENT_LIST_DIR}/data.hpp ${CMAKE_CURRENT_LIST_DIR}/delay.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/experiment.hpp ${CMAKE_CURRENT_LIST_DIR}/sample_data.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/sampling.hpp ${CMAKE_CURRENT_LIST_DIR}/selected_entry.hpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/data.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/delay.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/experiment.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/sample_data.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/sampling.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/selected_entry.hpp
|
||||
)
|
||||
|
||||
target_sources(rocprofiler-systems-object-library PRIVATE ${causal_sources}
|
||||
${causal_headers})
|
||||
target_sources(
|
||||
rocprofiler-systems-object-library
|
||||
PRIVATE ${causal_sources} ${causal_headers}
|
||||
)
|
||||
|
||||
add_subdirectory(components)
|
||||
|
||||
+8
-4
@@ -4,14 +4,18 @@ set(component_sources
|
||||
${CMAKE_CURRENT_LIST_DIR}/blocking_gotcha.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/causal_gotcha.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/progress_point.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/unblocking_gotcha.cpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/unblocking_gotcha.cpp
|
||||
)
|
||||
|
||||
set(component_headers
|
||||
${CMAKE_CURRENT_LIST_DIR}/backtrace.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/blocking_gotcha.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/causal_gotcha.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/progress_point.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/unblocking_gotcha.hpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/unblocking_gotcha.hpp
|
||||
)
|
||||
|
||||
target_sources(rocprofiler-systems-object-library PRIVATE ${component_sources}
|
||||
${component_headers})
|
||||
target_sources(
|
||||
rocprofiler-systems-object-library
|
||||
PRIVATE ${component_sources} ${component_headers}
|
||||
)
|
||||
|
||||
+8
-4
@@ -13,7 +13,8 @@ set(component_sources
|
||||
${CMAKE_CURRENT_LIST_DIR}/vaapi_gotcha.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/pthread_gotcha.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/pthread_create_gotcha.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/pthread_mutex_gotcha.cpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/pthread_mutex_gotcha.cpp
|
||||
)
|
||||
|
||||
set(component_headers
|
||||
${CMAKE_CURRENT_LIST_DIR}/backtrace.hpp
|
||||
@@ -32,7 +33,10 @@ set(component_headers
|
||||
${CMAKE_CURRENT_LIST_DIR}/vaapi_gotcha.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/pthread_gotcha.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/pthread_create_gotcha.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/pthread_mutex_gotcha.hpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/pthread_mutex_gotcha.hpp
|
||||
)
|
||||
|
||||
target_sources(rocprofiler-systems-object-library PRIVATE ${component_sources}
|
||||
${component_headers})
|
||||
target_sources(
|
||||
rocprofiler-systems-object-library
|
||||
PRIVATE ${component_sources} ${component_headers}
|
||||
)
|
||||
|
||||
@@ -2,5 +2,7 @@
|
||||
set(coverage_sources)
|
||||
set(coverage_headers ${CMAKE_CURRENT_LIST_DIR}/impl.hpp)
|
||||
|
||||
target_sources(rocprofiler-systems-object-library PRIVATE ${coverage_sources}
|
||||
${coverage_headers})
|
||||
target_sources(
|
||||
rocprofiler-systems-object-library
|
||||
PRIVATE ${coverage_sources} ${coverage_headers}
|
||||
)
|
||||
|
||||
+12
-6
@@ -1,11 +1,17 @@
|
||||
#
|
||||
set(rocprofiler_sdk_sources
|
||||
${CMAKE_CURRENT_LIST_DIR}/counters.cpp ${CMAKE_CURRENT_LIST_DIR}/fwd.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/rccl.cpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/counters.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/fwd.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/rccl.cpp
|
||||
)
|
||||
|
||||
set(rocprofiler_sdk_headers
|
||||
${CMAKE_CURRENT_LIST_DIR}/counters.hpp ${CMAKE_CURRENT_LIST_DIR}/fwd.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/rccl.hpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/counters.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/fwd.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/rccl.hpp
|
||||
)
|
||||
|
||||
target_sources(rocprofiler-systems-object-library PRIVATE ${rocprofiler_sdk_sources}
|
||||
${rocprofiler_sdk_headers})
|
||||
target_sources(
|
||||
rocprofiler-systems-object-library
|
||||
PRIVATE ${rocprofiler_sdk_sources} ${rocprofiler_sdk_headers}
|
||||
)
|
||||
|
||||
@@ -2,5 +2,7 @@
|
||||
set(tracing_sources ${CMAKE_CURRENT_LIST_DIR}/annotation.cpp)
|
||||
set(tracing_headers ${CMAKE_CURRENT_LIST_DIR}/annotation.hpp)
|
||||
|
||||
target_sources(rocprofiler-systems-object-library PRIVATE ${tracing_sources}
|
||||
${tracing_headers})
|
||||
target_sources(
|
||||
rocprofiler-systems-object-library
|
||||
PRIVATE ${tracing_sources} ${tracing_headers}
|
||||
)
|
||||
|
||||
@@ -18,24 +18,25 @@ set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME python)
|
||||
# ########################################################################################
|
||||
|
||||
function(ROCPROFILER_SYSTEMS_CONFIGURE_PYTARGET _TARGET _VERSION)
|
||||
|
||||
add_library(rocprofiler-systems::${_TARGET} ALIAS ${_TARGET})
|
||||
target_link_libraries(${_TARGET} PRIVATE libpyrocprofiler-systems-interface)
|
||||
add_dependencies(libpyrocprofsys ${_TARGET})
|
||||
|
||||
set_target_properties(
|
||||
${_TARGET}
|
||||
PROPERTIES PREFIX ""
|
||||
OUTPUT_NAME libpyrocprofsys
|
||||
LIBRARY_OUTPUT_DIRECTORY
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
|
||||
ARCHIVE_OUTPUT_DIRECTORY
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
|
||||
RUNTIME_OUTPUT_DIRECTORY
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
|
||||
PDB_OUTPUT_DIRECTORY
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
|
||||
${EXTRA_PROPERTIES})
|
||||
PROPERTIES
|
||||
PREFIX ""
|
||||
OUTPUT_NAME libpyrocprofsys
|
||||
LIBRARY_OUTPUT_DIRECTORY
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
|
||||
ARCHIVE_OUTPUT_DIRECTORY
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
|
||||
RUNTIME_OUTPUT_DIRECTORY
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
|
||||
PDB_OUTPUT_DIRECTORY
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
|
||||
${EXTRA_PROPERTIES}
|
||||
)
|
||||
|
||||
set(_PYLIB ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys)
|
||||
if(NOT IS_ABSOLUTE "${_PYLIB}")
|
||||
@@ -45,28 +46,34 @@ function(ROCPROFILER_SYSTEMS_CONFIGURE_PYTARGET _TARGET _VERSION)
|
||||
if(SKBUILD)
|
||||
set(LIB_RELPATH ../../..)
|
||||
else()
|
||||
file(RELATIVE_PATH LIB_RELPATH "${_PYLIB}"
|
||||
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
||||
file(
|
||||
RELATIVE_PATH
|
||||
LIB_RELPATH
|
||||
"${_PYLIB}"
|
||||
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
set_target_properties(${_TARGET} PROPERTIES INSTALL_RPATH
|
||||
"\$ORIGIN:\$ORIGIN/${LIB_RELPATH}")
|
||||
set_target_properties(
|
||||
${_TARGET}
|
||||
PROPERTIES INSTALL_RPATH "\$ORIGIN:\$ORIGIN/${LIB_RELPATH}"
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS ${_TARGET}
|
||||
DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
|
||||
OPTIONAL)
|
||||
install(TARGETS ${_TARGET} DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys OPTIONAL)
|
||||
endfunction()
|
||||
|
||||
# ########################################################################################
|
||||
|
||||
add_library(rocprofiler-systems-python-compile-options INTERFACE)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-python-compile-options ALIAS
|
||||
rocprofiler-systems-python-compile-options)
|
||||
add_library(
|
||||
rocprofiler-systems::rocprofiler-systems-python-compile-options
|
||||
ALIAS rocprofiler-systems-python-compile-options
|
||||
)
|
||||
add_target_cxx_flag_if_avail(
|
||||
rocprofiler-systems-python-compile-options "-Wno-unused-value"
|
||||
"-Wno-range-loop-analysis" "-Wno-deprecated-declarations"
|
||||
"-Wno-unused-but-set-parameter" "-ftls-model=global-dynamic")
|
||||
"-Wno-unused-but-set-parameter" "-ftls-model=global-dynamic"
|
||||
)
|
||||
|
||||
file(GLOB pyheaders ${CMAKE_CURRENT_LIST_DIR}/libpyrocprofsys*.hpp)
|
||||
set(pysources ${CMAKE_CURRENT_LIST_DIR}/libpyrocprofsys.cpp)
|
||||
@@ -76,32 +83,36 @@ set(pybind_libs pybind11::module)
|
||||
add_library(libpyrocprofiler-systems-interface INTERFACE)
|
||||
target_link_libraries(
|
||||
libpyrocprofiler-systems-interface
|
||||
INTERFACE pybind11::module
|
||||
timemory::timemory-headers
|
||||
rocprofiler-systems::rocprofiler-systems-headers
|
||||
rocprofiler-systems::rocprofiler-systems-compile-options
|
||||
rocprofiler-systems::rocprofiler-systems-static-libgcc-optional
|
||||
rocprofiler-systems::rocprofiler-systems-lto
|
||||
rocprofiler-systems::rocprofiler-systems-dl-library
|
||||
rocprofiler-systems::rocprofiler-systems-user-library
|
||||
rocprofiler-systems::rocprofiler-systems-python
|
||||
rocprofiler-systems::rocprofiler-systems-python-compile-options)
|
||||
INTERFACE
|
||||
pybind11::module
|
||||
timemory::timemory-headers
|
||||
rocprofiler-systems::rocprofiler-systems-headers
|
||||
rocprofiler-systems::rocprofiler-systems-compile-options
|
||||
rocprofiler-systems::rocprofiler-systems-static-libgcc-optional
|
||||
rocprofiler-systems::rocprofiler-systems-lto
|
||||
rocprofiler-systems::rocprofiler-systems-dl-library
|
||||
rocprofiler-systems::rocprofiler-systems-user-library
|
||||
rocprofiler-systems::rocprofiler-systems-python
|
||||
rocprofiler-systems::rocprofiler-systems-python-compile-options
|
||||
)
|
||||
|
||||
rocprofiler_systems_target_compile_definitions(libpyrocprofiler-systems-interface
|
||||
INTERFACE ROCPROFSYS_PYBIND11_SOURCE)
|
||||
INTERFACE ROCPROFSYS_PYBIND11_SOURCE
|
||||
)
|
||||
|
||||
add_custom_target(libpyrocprofsys)
|
||||
|
||||
file(GLOB_RECURSE PYTHON_FILES ${CMAKE_CURRENT_SOURCE_DIR}/rocprofsys/*.py)
|
||||
foreach(_IN ${PYTHON_FILES})
|
||||
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/rocprofsys"
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys" _OUT
|
||||
"${_IN}")
|
||||
string(
|
||||
REPLACE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/rocprofsys"
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys"
|
||||
_OUT
|
||||
"${_IN}"
|
||||
)
|
||||
configure_file(${_IN} ${_OUT} @ONLY)
|
||||
install(
|
||||
FILES ${_OUT}
|
||||
DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
|
||||
OPTIONAL)
|
||||
install(FILES ${_OUT} DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys OPTIONAL)
|
||||
endforeach()
|
||||
|
||||
rocprofiler_systems_python_console_script("${BINARY_NAME_PREFIX}-python" "rocprofsys")
|
||||
@@ -113,22 +124,34 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
|
||||
rocprofiler_systems_pybind11_add_module(
|
||||
libpyrocprofiler-systems-${_VERSION} MODULE
|
||||
PYTHON_VERSION ${_VERSION}
|
||||
VISIBILITY "hidden" ${pysources} ${pyheaders})
|
||||
VISIBILITY "hidden" ${pysources} ${pyheaders}
|
||||
)
|
||||
rocprofiler_systems_configure_pytarget(libpyrocprofiler-systems-${_VERSION}
|
||||
${_VERSION})
|
||||
${_VERSION}
|
||||
)
|
||||
|
||||
if(ROCPROFSYS_USE_PYTHON)
|
||||
rocprofiler_systems_python_console_script(
|
||||
"${BINARY_NAME_PREFIX}-python" "rocprofsys"
|
||||
VERSION ${_VERSION}
|
||||
ROOT_DIR "${Python3_ROOT_DIR}")
|
||||
ROOT_DIR "${Python3_ROOT_DIR}"
|
||||
)
|
||||
endif()
|
||||
math(EXPR _INDEX "${_INDEX} + 1")
|
||||
endforeach()
|
||||
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/setup.py.in
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/setup.py @ONLY)
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/setup.cfg.in
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/setup.cfg @ONLY)
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/pyproject.toml
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/pyproject.toml COPYONLY)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/setup.py.in
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/setup.py
|
||||
@ONLY
|
||||
)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/setup.cfg.in
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/setup.cfg
|
||||
@ONLY
|
||||
)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/pyproject.toml
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/pyproject.toml
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
@@ -8,29 +8,37 @@ include_guard(DIRECTORY)
|
||||
set(Python3_FIND_STRATEGY
|
||||
"LOCATION"
|
||||
CACHE STRING
|
||||
"Stops lookup as soon as a version satisfying version constraints is found")
|
||||
"Stops lookup as soon as a version satisfying version constraints is found"
|
||||
)
|
||||
|
||||
# virtual environment is used before any other standard paths to look-up for the
|
||||
# interpreter
|
||||
set(Python3_FIND_VIRTUALENV
|
||||
"FIRST"
|
||||
CACHE STRING "Virtual environment is used before any other standard paths")
|
||||
CACHE STRING
|
||||
"Virtual environment is used before any other standard paths"
|
||||
)
|
||||
set_property(CACHE Python3_FIND_VIRTUALENV PROPERTY STRINGS "FIRST;LAST;NEVER")
|
||||
|
||||
if(APPLE)
|
||||
set(Python3_FIND_FRAMEWORK
|
||||
"LAST"
|
||||
CACHE STRING
|
||||
"Order of preference between Apple-style and unix-style package components")
|
||||
"Order of preference between Apple-style and unix-style package components"
|
||||
)
|
||||
set_property(CACHE Python3_FIND_FRAMEWORK PROPERTY STRINGS "FIRST;LAST;NEVER")
|
||||
endif()
|
||||
|
||||
# PyPy does not support embedding the interpreter
|
||||
set(Python3_FIND_IMPLEMENTATIONS
|
||||
"CPython"
|
||||
CACHE STRING "Different implementations which will be searched.")
|
||||
set_property(CACHE Python3_FIND_IMPLEMENTATIONS PROPERTY STRINGS
|
||||
"CPython;IronPython;PyPy")
|
||||
CACHE STRING
|
||||
"Different implementations which will be searched."
|
||||
)
|
||||
set_property(
|
||||
CACHE Python3_FIND_IMPLEMENTATIONS
|
||||
PROPERTY STRINGS "CPython;IronPython;PyPy"
|
||||
)
|
||||
|
||||
# variable is a 3-tuple specifying, in order, pydebug (d), pymalloc (m) and unicode (u)
|
||||
# set(Python3_FIND_ABI "OFF" "OFF" "OFF" CACHE STRING "variable is a 3-tuple specifying
|
||||
@@ -41,20 +49,30 @@ set_property(CACHE Python3_FIND_IMPLEMENTATIONS PROPERTY STRINGS
|
||||
# requirements.
|
||||
set(Python3_ARTIFACTS_INTERACTIVE
|
||||
OFF
|
||||
CACHE BOOL "Create CMake cache entries so that users can edit them interactively"
|
||||
FORCE)
|
||||
CACHE BOOL
|
||||
"Create CMake cache entries so that users can edit them interactively"
|
||||
FORCE
|
||||
)
|
||||
|
||||
# if("${Python3_USE_STATIC_LIBS}" STREQUAL "ANY") set(Python3_USE_STATIC_LIBS "OFF" CACHE
|
||||
# STRING "If ON, only static libs; if OFF, only shared libs; if ANY, shared then static")
|
||||
# set_property(CACHE Python3_USE_STATIC_LIBS PROPERTY STRINGS "ON;OFF;ANY") else()
|
||||
# unset(Python3_USE_STATIC_LIBS) endif()
|
||||
|
||||
foreach(_VAR FIND_STRATEGY FIND_VIRTUALENV FIND_FRAMEWORK FIND_IMPLEMENTATIONS
|
||||
ARTIFACTS_INTERACTIVE)
|
||||
foreach(
|
||||
_VAR
|
||||
FIND_STRATEGY
|
||||
FIND_VIRTUALENV
|
||||
FIND_FRAMEWORK
|
||||
FIND_IMPLEMENTATIONS
|
||||
ARTIFACTS_INTERACTIVE
|
||||
)
|
||||
if(DEFINED Python3_${_VAR})
|
||||
set(Python_${_VAR}
|
||||
"${Python3_${_VAR}}"
|
||||
CACHE STRING "Set via Python3_${_VAR} setting (rocprofsys)")
|
||||
CACHE STRING
|
||||
"Set via Python3_${_VAR} setting (rocprofsys)"
|
||||
)
|
||||
mark_as_advanced(Python_${_VAR})
|
||||
mark_as_advanced(Python3_${_VAR})
|
||||
endif()
|
||||
@@ -62,7 +80,8 @@ endforeach()
|
||||
|
||||
# display version
|
||||
rocprofiler_systems_add_feature(ROCPROFSYS_PYTHON_VERSIONS
|
||||
"Python version for rocprofsys" DOC)
|
||||
"Python version for rocprofsys" DOC
|
||||
)
|
||||
|
||||
option(PYBIND11_INSTALL "Enable Pybind11 installation" OFF)
|
||||
|
||||
@@ -73,7 +92,8 @@ if(ROCPROFSYS_BUILD_PYTHON AND NOT TARGET pybind11)
|
||||
RELATIVE_PATH external/pybind11
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
REPO_URL https://github.com/jrmadsen/pybind11.git
|
||||
REPO_BRANCH omnitrace)
|
||||
REPO_BRANCH omnitrace
|
||||
)
|
||||
|
||||
if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION)
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF)
|
||||
@@ -82,13 +102,17 @@ if(ROCPROFSYS_BUILD_PYTHON AND NOT TARGET pybind11)
|
||||
rocprofiler_systems_save_variables(IPO VARIABLES CMAKE_INTERPROCEDURAL_OPTIMIZATION)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/external/pybind11)
|
||||
rocprofiler_systems_restore_variables(IPO
|
||||
VARIABLES CMAKE_INTERPROCEDURAL_OPTIMIZATION)
|
||||
VARIABLES CMAKE_INTERPROCEDURAL_OPTIMIZATION
|
||||
)
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${PYTHON_EXECUTABLE} -c
|
||||
"import time ; print('{} {}'.format(time.ctime(), time.tzname[0]))"
|
||||
COMMAND
|
||||
${PYTHON_EXECUTABLE} -c
|
||||
"import time ; print('{} {}'.format(time.ctime(), time.tzname[0]))"
|
||||
OUTPUT_VARIABLE ROCPROFSYS_INSTALL_DATE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
|
||||
string(REPLACE " " " " ROCPROFSYS_INSTALL_DATE "${ROCPROFSYS_INSTALL_DATE}")
|
||||
|
||||
@@ -70,8 +70,15 @@ if(NOT PyBind11Python_COMPONENTS)
|
||||
endif()
|
||||
|
||||
# Use the Python interpreter to find the libs.
|
||||
find_package(${PyBind11Python_PYTHON} ${PyBind11Python_FIND_VERSION} ${_find_exact} MODULE
|
||||
${_find_required} ${_find_quiet} COMPONENTS ${PyBind11Python_COMPONENTS})
|
||||
find_package(
|
||||
${PyBind11Python_PYTHON}
|
||||
${PyBind11Python_FIND_VERSION}
|
||||
${_find_exact}
|
||||
MODULE
|
||||
${_find_required}
|
||||
${_find_quiet}
|
||||
COMPONENTS ${PyBind11Python_COMPONENTS}
|
||||
)
|
||||
|
||||
# According to
|
||||
# https://stackoverflow.com/questions/646518/python-how-to-detect-debug-interpreter
|
||||
@@ -110,7 +117,8 @@ print(s.get_config_var('MULTIARCH') or '');
|
||||
"
|
||||
RESULT_VARIABLE _PYTHON_SUCCESS
|
||||
OUTPUT_VARIABLE _PYTHON_VALUES
|
||||
ERROR_VARIABLE _PYTHON_ERROR_VALUE)
|
||||
ERROR_VARIABLE _PYTHON_ERROR_VALUE
|
||||
)
|
||||
|
||||
if(NOT _PYTHON_SUCCESS MATCHES 0)
|
||||
if(PyBind11Python_FIND_REQUIRED)
|
||||
@@ -139,13 +147,18 @@ list(GET _PYTHON_VALUES 9 PYTHON_MULTIARCH)
|
||||
|
||||
# Make sure the Python has the same pointer-size as the chosen compiler Skip if
|
||||
# CMAKE_SIZEOF_VOID_P is not defined
|
||||
if(CMAKE_SIZEOF_VOID_P AND (NOT "${PYTHON_SIZEOF_VOID_P}" STREQUAL
|
||||
"${CMAKE_SIZEOF_VOID_P}"))
|
||||
if(
|
||||
CMAKE_SIZEOF_VOID_P
|
||||
AND (NOT "${PYTHON_SIZEOF_VOID_P}" STREQUAL "${CMAKE_SIZEOF_VOID_P}")
|
||||
)
|
||||
if(PyBind11Python_FIND_REQUIRED)
|
||||
math(EXPR _PYTHON_BITS "${PYTHON_SIZEOF_VOID_P} * 8")
|
||||
math(EXPR _CMAKE_BITS "${CMAKE_SIZEOF_VOID_P} * 8")
|
||||
message(FATAL_ERROR "Python config failure: Python is ${_PYTHON_BITS}-bit, "
|
||||
"chosen compiler is ${_CMAKE_BITS}-bit")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Python config failure: Python is ${_PYTHON_BITS}-bit, "
|
||||
"chosen compiler is ${_CMAKE_BITS}-bit"
|
||||
)
|
||||
endif()
|
||||
set(PyBind11Python_FOUND FALSE)
|
||||
return()
|
||||
@@ -157,7 +170,8 @@ list(GET _PYTHON_VERSION_LIST 0 PYTHON_VERSION_MAJOR)
|
||||
list(GET _PYTHON_VERSION_LIST 1 PYTHON_VERSION_MINOR)
|
||||
list(GET _PYTHON_VERSION_LIST 2 PYTHON_VERSION_PATCH)
|
||||
set(PYTHON_VERSION
|
||||
"${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}")
|
||||
"${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}"
|
||||
)
|
||||
|
||||
# Make sure all directory separators are '/'
|
||||
string(REGEX REPLACE "\\\\" "/" PYTHON_PREFIX "${PYTHON_PREFIX}")
|
||||
|
||||
@@ -26,34 +26,32 @@ function(ROCPROFILER_SYSTEMS_FIND_PYTHON _VAR)
|
||||
set(Python3_FIND_VIRTUALENV "FIRST")
|
||||
set(Python3_ARTIFACTS_INTERACTIVE OFF)
|
||||
|
||||
find_package(Python3 ${ARG_VERSION} ${_EXACT} ${_QUIET} MODULE ${_FIND_REQUIREMENT}
|
||||
COMPONENTS ${ARG_COMPONENTS})
|
||||
find_package(
|
||||
Python3
|
||||
${ARG_VERSION}
|
||||
${_EXACT}
|
||||
${_QUIET}
|
||||
MODULE
|
||||
${_FIND_REQUIREMENT}
|
||||
COMPONENTS ${ARG_COMPONENTS}
|
||||
)
|
||||
|
||||
set(${_VAR}_FOUND
|
||||
"${Python3_FOUND}"
|
||||
PARENT_SCOPE)
|
||||
set(${_VAR}_FOUND "${Python3_FOUND}" PARENT_SCOPE)
|
||||
if(NOT Python3_FOUND)
|
||||
set(${_VAR}_EXECUTABLE
|
||||
""
|
||||
PARENT_SCOPE)
|
||||
set(${_VAR}_ROOT_DIR
|
||||
""
|
||||
PARENT_SCOPE)
|
||||
set(${_VAR}_VERSION
|
||||
""
|
||||
PARENT_SCOPE)
|
||||
set(${_VAR}_EXECUTABLE "" PARENT_SCOPE)
|
||||
set(${_VAR}_ROOT_DIR "" PARENT_SCOPE)
|
||||
set(${_VAR}_VERSION "" PARENT_SCOPE)
|
||||
return()
|
||||
else()
|
||||
set(${_VAR}_EXECUTABLE
|
||||
"${Python3_EXECUTABLE}"
|
||||
PARENT_SCOPE)
|
||||
set(${_VAR}_EXECUTABLE "${Python3_EXECUTABLE}" PARENT_SCOPE)
|
||||
execute_process(
|
||||
COMMAND
|
||||
"${Python3_EXECUTABLE}" "-c"
|
||||
"import sys; print('.'.join(str(v) for v in [sys.version_info[0], sys.version_info[1]])); print(sys.prefix);"
|
||||
RESULT_VARIABLE _PYTHON_SUCCESS
|
||||
OUTPUT_VARIABLE _PYTHON_VALUES
|
||||
ERROR_VARIABLE _PYTHON_ERROR_VALUE)
|
||||
ERROR_VARIABLE _PYTHON_ERROR_VALUE
|
||||
)
|
||||
|
||||
if(_PYTHON_SUCCESS MATCHES 0)
|
||||
# Convert the process output into a list
|
||||
@@ -61,12 +59,8 @@ function(ROCPROFILER_SYSTEMS_FIND_PYTHON _VAR)
|
||||
string(REGEX REPLACE "\n" ";" _PYTHON_VALUES ${_PYTHON_VALUES})
|
||||
list(GET _PYTHON_VALUES 0 _PYTHON_VERSION_LIST)
|
||||
list(GET _PYTHON_VALUES 1 _PYTHON_PREFIX)
|
||||
set(${_VAR}_ROOT_DIR
|
||||
"${_PYTHON_PREFIX}"
|
||||
PARENT_SCOPE)
|
||||
set(${_VAR}_VERSION
|
||||
"${_PYTHON_VERSION_LIST}"
|
||||
PARENT_SCOPE)
|
||||
set(${_VAR}_ROOT_DIR "${_PYTHON_PREFIX}" PARENT_SCOPE)
|
||||
set(${_VAR}_VERSION "${_PYTHON_VERSION_LIST}" PARENT_SCOPE)
|
||||
else()
|
||||
rocprofiler_systems_message(WARNING "${_PYTHON_ERROR_VALUE}")
|
||||
endif()
|
||||
@@ -80,28 +74,26 @@ function(_ROCPROFSYS_PYBIND11_ADD_LTO_FLAGS target_name prefer_thin_lto)
|
||||
# name for each set of flags: the compilation result will be cached base on the result
|
||||
# variable. If the flags work, sets them in cxxflags_out/linkerflags_out internal
|
||||
# cache variables (in addition to ${result}).
|
||||
function(_PYBIND11_RETURN_IF_CXX_AND_LINKER_FLAGS_WORK result cxxflags linkerflags
|
||||
cxxflags_out linkerflags_out)
|
||||
function(
|
||||
_PYBIND11_RETURN_IF_CXX_AND_LINKER_FLAGS_WORK
|
||||
result
|
||||
cxxflags
|
||||
linkerflags
|
||||
cxxflags_out
|
||||
linkerflags_out
|
||||
)
|
||||
include(CheckCXXCompilerFlag)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${linkerflags})
|
||||
check_cxx_compiler_flag("${cxxflags}" ${result})
|
||||
if(${result})
|
||||
set(${cxxflags_out}
|
||||
"${cxxflags}"
|
||||
CACHE INTERNAL "" FORCE)
|
||||
set(${linkerflags_out}
|
||||
"${linkerflags}"
|
||||
CACHE INTERNAL "" FORCE)
|
||||
set(${cxxflags_out} "${cxxflags}" CACHE INTERNAL "" FORCE)
|
||||
set(${linkerflags_out} "${linkerflags}" CACHE INTERNAL "" FORCE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if(NOT DEFINED PYBIND11_LTO_CXX_FLAGS)
|
||||
set(PYBIND11_LTO_CXX_FLAGS
|
||||
""
|
||||
CACHE INTERNAL "")
|
||||
set(PYBIND11_LTO_LINKER_FLAGS
|
||||
""
|
||||
CACHE INTERNAL "")
|
||||
set(PYBIND11_LTO_CXX_FLAGS "" CACHE INTERNAL "")
|
||||
set(PYBIND11_LTO_LINKER_FLAGS "" CACHE INTERNAL "")
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||
set(cxx_append "")
|
||||
@@ -117,19 +109,22 @@ function(_ROCPROFSYS_PYBIND11_ADD_LTO_FLAGS target_name prefer_thin_lto)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND prefer_thin_lto)
|
||||
_pybind11_return_if_cxx_and_linker_flags_work(
|
||||
HAS_FLTO_THIN "-flto=thin${cxx_append}" "-flto=thin${linker_append}"
|
||||
PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS)
|
||||
PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT HAS_FLTO_THIN)
|
||||
_pybind11_return_if_cxx_and_linker_flags_work(
|
||||
HAS_FLTO "-flto${cxx_append}" "-flto${linker_append}"
|
||||
PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS)
|
||||
PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS
|
||||
)
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
||||
# Intel equivalent to LTO is called IPO
|
||||
_pybind11_return_if_cxx_and_linker_flags_work(
|
||||
HAS_INTEL_IPO "-ipo" "-ipo" PYBIND11_LTO_CXX_FLAGS
|
||||
PYBIND11_LTO_LINKER_FLAGS)
|
||||
PYBIND11_LTO_LINKER_FLAGS
|
||||
)
|
||||
elseif(MSVC)
|
||||
# cmake only interprets libraries as linker flags when they start with a -
|
||||
# (otherwise it converts /LTCG to \LTCG as if it was a Windows path). Luckily
|
||||
@@ -137,7 +132,8 @@ function(_ROCPROFSYS_PYBIND11_ADD_LTO_FLAGS target_name prefer_thin_lto)
|
||||
# non-standard:
|
||||
_pybind11_return_if_cxx_and_linker_flags_work(
|
||||
HAS_MSVC_GL_LTCG "/GL" "-LTCG" PYBIND11_LTO_CXX_FLAGS
|
||||
PYBIND11_LTO_LINKER_FLAGS)
|
||||
PYBIND11_LTO_LINKER_FLAGS
|
||||
)
|
||||
endif()
|
||||
|
||||
if(PYBIND11_LTO_CXX_FLAGS)
|
||||
@@ -146,24 +142,35 @@ function(_ROCPROFSYS_PYBIND11_ADD_LTO_FLAGS target_name prefer_thin_lto)
|
||||
rocprofiler_systems_message(
|
||||
STATUS
|
||||
"${target_name} :: LTO disabled (not supported by the compiler and/or linker)"
|
||||
)
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Enable LTO flags if found, except for Debug builds
|
||||
if(PYBIND11_LTO_CXX_FLAGS)
|
||||
target_compile_options(
|
||||
${target_name} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:${PYBIND11_LTO_CXX_FLAGS}>")
|
||||
${target_name}
|
||||
PRIVATE "$<$<NOT:$<CONFIG:Debug>>:${PYBIND11_LTO_CXX_FLAGS}>"
|
||||
)
|
||||
endif()
|
||||
if(PYBIND11_LTO_LINKER_FLAGS)
|
||||
target_link_libraries(
|
||||
${target_name}
|
||||
PRIVATE "$<$<NOT:$<CONFIG:Debug>>:${PYBIND11_LTO_LINKER_FLAGS}>")
|
||||
PRIVATE "$<$<NOT:$<CONFIG:Debug>>:${PYBIND11_LTO_LINKER_FLAGS}>"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
#
|
||||
function(ROCPROFILER_SYSTEMS_PYBIND11_ADD_MODULE target_name)
|
||||
set(options MODULE SHARED EXCLUDE_FROM_ALL NO_EXTRAS SYSTEM THIN_LTO LTO)
|
||||
set(options
|
||||
MODULE
|
||||
SHARED
|
||||
EXCLUDE_FROM_ALL
|
||||
NO_EXTRAS
|
||||
SYSTEM
|
||||
THIN_LTO
|
||||
LTO
|
||||
)
|
||||
set(args PYTHON_VERSION VISIBILITY CXX_STANDARD)
|
||||
set(kwargs)
|
||||
cmake_parse_arguments(ARG "${options}" "${args}" "${kwargs}" ${ARGN})
|
||||
@@ -202,10 +209,14 @@ function(ROCPROFILER_SYSTEMS_PYBIND11_ADD_MODULE target_name)
|
||||
find_package(PyBind11Python ${ARG_PYTHON_VERSION})
|
||||
|
||||
target_include_directories(
|
||||
${target_name} ${inc_isystem}
|
||||
PRIVATE ${PYBIND11_INCLUDE_DIR} # from project CMakeLists.txt
|
||||
PRIVATE ${pybind11_INCLUDE_DIR} # from pybind11Config
|
||||
PRIVATE ${Python3_INCLUDE_DIRS})
|
||||
${target_name}
|
||||
${inc_isystem}
|
||||
PRIVATE
|
||||
${PYBIND11_INCLUDE_DIR} # from project CMakeLists.txt
|
||||
PRIVATE
|
||||
${pybind11_INCLUDE_DIR} # from pybind11Config
|
||||
PRIVATE ${Python3_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
# Python debug libraries expose slightly different objects
|
||||
# https://docs.python.org/3.6/c-api/intro.html#debugging-builds
|
||||
@@ -223,10 +234,14 @@ function(ROCPROFILER_SYSTEMS_PYBIND11_ADD_MODULE target_name)
|
||||
# force it on everything inside the `pybind11` namespace; also turning it on for a
|
||||
# pybind module compilation here avoids potential warnings or issues from having mixed
|
||||
# hidden/non-hidden types.
|
||||
set_target_properties(${target_name} PROPERTIES CXX_VISIBILITY_PRESET
|
||||
"${ARG_VISIBILITY}")
|
||||
set_target_properties(${target_name} PROPERTIES CUDA_VISIBILITY_PRESET
|
||||
"${ARG_VISIBILITY}")
|
||||
set_target_properties(
|
||||
${target_name}
|
||||
PROPERTIES CXX_VISIBILITY_PRESET "${ARG_VISIBILITY}"
|
||||
)
|
||||
set_target_properties(
|
||||
${target_name}
|
||||
PROPERTIES CUDA_VISIBILITY_PRESET "${ARG_VISIBILITY}"
|
||||
)
|
||||
|
||||
if(WIN32 OR CYGWIN)
|
||||
# Link against the Python shared library on Windows
|
||||
@@ -253,8 +268,10 @@ function(ROCPROFILER_SYSTEMS_PYBIND11_ADD_MODULE target_name)
|
||||
endif()
|
||||
|
||||
# Make sure C++11/14 are enabled
|
||||
set_target_properties(${target_name} PROPERTIES CXX_STANDARD ${ARG_CXX_STANDARD}
|
||||
CXX_STANDARD_REQUIRED ON)
|
||||
set_target_properties(
|
||||
${target_name}
|
||||
PROPERTIES CXX_STANDARD ${ARG_CXX_STANDARD} CXX_STANDARD_REQUIRED ON
|
||||
)
|
||||
|
||||
if(ARG_NO_EXTRAS)
|
||||
return()
|
||||
@@ -271,12 +288,14 @@ function(ROCPROFILER_SYSTEMS_PYBIND11_ADD_MODULE target_name)
|
||||
add_custom_command(
|
||||
TARGET ${target_name}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_STRIP} -x $<TARGET_FILE:${target_name}>)
|
||||
COMMAND ${CMAKE_STRIP} -x $<TARGET_FILE:${target_name}>
|
||||
)
|
||||
else()
|
||||
add_custom_command(
|
||||
TARGET ${target_name}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:${target_name}>)
|
||||
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:${target_name}>
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -295,7 +314,8 @@ function(ROCPROFILER_SYSTEMS_PYBIND11_ADD_MODULE target_name)
|
||||
# build to fail.
|
||||
target_compile_options(
|
||||
${target_name}
|
||||
PRIVATE $<$<NOT:$<CONFIG:Debug>>:$<$<COMPILE_LANGUAGE:CXX>:/MP>>)
|
||||
PRIVATE $<$<NOT:$<CONFIG:Debug>>:$<$<COMPILE_LANGUAGE:CXX>:/MP>>
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
Reference in New Issue
Block a user