Skip to content

Commit

Permalink
Migrate to rocprofiler-sdk:: namespace in CMake everywhere (#892)
Browse files Browse the repository at this point in the history
- remove all usage/support for rocprofiler:: namespace
  • Loading branch information
jrmadsen authored May 30, 2024
1 parent 5525b40 commit a76f61a
Show file tree
Hide file tree
Showing 41 changed files with 179 additions and 169 deletions.
4 changes: 2 additions & 2 deletions cmake/Templates/rocprofiler-sdk/build-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

if(@PACKAGE_NAME@_FIND_COMPONENTS)
foreach(COMP ${@PACKAGE_NAME@_FIND_COMPONENTS})
set(TARG @PROJECT_NAME@::@PROJECT_NAME@-${COMP})
set(TARG @PACKAGE_NAME@::@PROJECT_NAME@-${COMP})
if(TARGET ${TARG})
set(@PACKAGE_NAME@_${COMP}_FOUND 1)
list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG})
Expand All @@ -17,7 +17,7 @@ else()
endif()

foreach(COMP @PROJECT_BUILD_TREE_TARGETS@)
set(TARG @PROJECT_NAME@::@PROJECT_NAME@-${COMP})
set(TARG @PACKAGE_NAME@::@PROJECT_NAME@-${COMP})
if(TARGET ${TARG})
list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG})
target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE ${TARG})
Expand Down
7 changes: 2 additions & 5 deletions cmake/Templates/rocprofiler-sdk/config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ set(@PACKAGE_NAME@_LIBRARIES)

# add interface library
add_library(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE IMPORTED)
if(NOT TARGET @PROJECT_NAME@::@PROJECT_NAME@)
add_library(@PROJECT_NAME@::@PROJECT_NAME@ ALIAS @PACKAGE_NAME@::@PACKAGE_NAME@)
endif()

target_include_directories(@PACKAGE_NAME@::@PACKAGE_NAME@
INTERFACE "${@PACKAGE_NAME@_INCLUDE_DIR}")
Expand Down Expand Up @@ -110,7 +107,7 @@ else()

# Library dependencies
foreach(TARG @PROJECT_BUILD_TARGETS@)
set(TARG @PROJECT_NAME@::@PROJECT_NAME@-${TARG})
set(TARG @PACKAGE_NAME@::@PROJECT_NAME@-${TARG})
if(NOT @PACKAGE_NAME@_FIND_COMPONENTS)
list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG})
target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE ${TARG})
Expand All @@ -119,7 +116,7 @@ else()

if(@PACKAGE_NAME@_FIND_COMPONENTS)
foreach(COMP ${@PACKAGE_NAME@_FIND_COMPONENTS})
set(TARG @PROJECT_NAME@::${COMP})
set(TARG @PACKAGE_NAME@::${COMP})
if(TARGET ${TARG})
set(@PACKAGE_NAME@_${COMP}_FOUND 1)
list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG})
Expand Down
14 changes: 7 additions & 7 deletions cmake/rocprofiler_build_settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ foreach(_TYPE dl rt)
endif()
endforeach()

target_link_libraries(rocprofiler-build-flags INTERFACE rocprofiler::rocprofiler-dl)
target_link_libraries(rocprofiler-build-flags INTERFACE rocprofiler-sdk::rocprofiler-dl)

# ----------------------------------------------------------------------------------------#
# set the compiler flags
Expand Down Expand Up @@ -94,7 +94,7 @@ endif()

if(ROCPROFILER_BUILD_DEBUG)
target_link_libraries(rocprofiler-build-flags
INTERFACE rocprofiler::rocprofiler-debug-flags)
INTERFACE rocprofiler-sdk::rocprofiler-debug-flags)
endif()

# ----------------------------------------------------------------------------------------#
Expand All @@ -115,7 +115,7 @@ rocprofiler_target_compile_options(

if(ROCPROFILER_BUILD_STACK_PROTECTOR)
target_link_libraries(rocprofiler-build-flags
INTERFACE rocprofiler::rocprofiler-stack-protector)
INTERFACE rocprofiler-sdk::rocprofiler-stack-protector)
endif()

# ----------------------------------------------------------------------------------------#
Expand All @@ -128,7 +128,7 @@ rocprofiler_target_compile_options(

if(ROCPROFILER_BUILD_DEVELOPER)
target_link_libraries(rocprofiler-build-flags
INTERFACE rocprofiler::rocprofiler-developer-flags)
INTERFACE rocprofiler-sdk::rocprofiler-developer-flags)
endif()

# ----------------------------------------------------------------------------------------#
Expand All @@ -142,7 +142,7 @@ rocprofiler_target_compile_options(

if(ROCPROFILER_BUILD_RELEASE)
target_link_libraries(rocprofiler-build-flags
INTERFACE rocprofiler::rocprofiler-release-flags)
INTERFACE rocprofiler-sdk::rocprofiler-release-flags)
endif()

# ----------------------------------------------------------------------------------------#
Expand All @@ -166,12 +166,12 @@ target_link_options(

if(ROCPROFILER_BUILD_STATIC_LIBGCC)
target_link_libraries(rocprofiler-build-flags
INTERFACE rocprofiler::rocprofiler-static-libgcc)
INTERFACE rocprofiler-sdk::rocprofiler-static-libgcc)
endif()

if(ROCPROFILER_BUILD_STATIC_LIBSTDCXX)
target_link_libraries(rocprofiler-build-flags
INTERFACE rocprofiler::rocprofiler-static-libstdcxx)
INTERFACE rocprofiler-sdk::rocprofiler-static-libstdcxx)
endif()

if(ROCPROFILER_UNSAFE_NO_VERSION_CHECK)
Expand Down
4 changes: 2 additions & 2 deletions cmake/rocprofiler_config_install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ install(
install(
EXPORT ${PACKAGE_NAME}-targets
FILE ${PACKAGE_NAME}-targets.cmake
NAMESPACE ${PROJECT_NAME}::
NAMESPACE ${PACKAGE_NAME}::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}
COMPONENT development)

Expand Down Expand Up @@ -112,7 +112,7 @@ endif()

export(
EXPORT ${PACKAGE_NAME}-targets
NAMESPACE ${PROJECT_NAME}::
NAMESPACE ${PACKAGE_NAME}::
FILE "${_BUILDTREE_EXPORT_DIR}/${PACKAGE_NAME}-targets.cmake")

set(${PACKAGE_NAME}_DIR
Expand Down
8 changes: 5 additions & 3 deletions cmake/rocprofiler_config_install_roctx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ include_guard(GLOBAL)
include(CMakePackageConfigHelpers)

set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME roctx)
set(SDK_PACKAGE_NAME "${PROJECT_NAME}-sdk")
set(PACKAGE_NAME "rocprofiler-sdk-roctx")

install(
Expand Down Expand Up @@ -57,9 +58,10 @@ set(${PACKAGE_NAME}_BUILD_TREE
CACHE BOOL "" FORCE)

set(PROJECT_BUILD_TREE_TARGETS
${PROJECT_NAME}::${PACKAGE_NAME}-shared-library
${PROJECT_NAME}::${PROJECT_NAME}-headers ${PROJECT_NAME}::${PROJECT_NAME}-build-flags
${PROJECT_NAME}::${PROJECT_NAME}-stack-protector)
${SDK_PACKAGE_NAME}::${PACKAGE_NAME}-shared-library
${SDK_PACKAGE_NAME}::${PROJECT_NAME}-headers
${SDK_PACKAGE_NAME}::${PROJECT_NAME}-build-flags
${SDK_PACKAGE_NAME}::${PROJECT_NAME}-stack-protector)

configure_file(
${PROJECT_SOURCE_DIR}/cmake/Templates/${PACKAGE_NAME}/build-config.cmake.in
Expand Down
7 changes: 6 additions & 1 deletion cmake/rocprofiler_utilities.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,12 @@ function(ROCPROFILER_ADD_INTERFACE_LIBRARY _TARGET _DESCRIPT)
else()
add_library(${_TARGET} INTERFACE)
endif()
add_library(${PROJECT_NAME}::${_TARGET} ALIAS ${_TARGET})

if(NOT PACKAGE_NAME OR "${PACKAGE_NAME}" STREQUAL "")
message(FATAL_ERROR "Set PACKAGE_NAME")
endif()

add_library(${PACKAGE_NAME}::${_TARGET} ALIAS ${_TARGET})
if(NOT "INTERNAL" IN_LIST _ARGS AND NOT "IMPORTED" IN_LIST _ARGS)
install(
TARGETS ${_TARGET}
Expand Down
2 changes: 1 addition & 1 deletion samples/advanced_thread_trace/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ target_sources(advanced-thread-trace PRIVATE main.cpp client.cpp)
target_link_libraries(
advanced-thread-trace
PRIVATE rocprofiler-sdk::rocprofiler-sdk amd_comgr
rocprofiler::samples-common-library rocprofiler::samples-build-flags)
rocprofiler-sdk::samples-common-library rocprofiler-sdk::samples-build-flags)

rocprofiler_samples_get_preload_env(PRELOAD_ENV advanced-thread-trace)

Expand Down
6 changes: 3 additions & 3 deletions samples/api_buffered_tracing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ add_library(buffered-api-tracing-client SHARED)
target_sources(buffered-api-tracing-client PRIVATE client.cpp client.hpp)
target_link_libraries(
buffered-api-tracing-client
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler::samples-build-flags
rocprofiler::samples-common-library)
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::samples-build-flags
rocprofiler-sdk::samples-common-library)

set_source_files_properties(main.cpp PROPERTIES LANGUAGE HIP)
find_package(Threads REQUIRED)
Expand All @@ -41,7 +41,7 @@ add_executable(buffered-api-tracing)
target_sources(buffered-api-tracing PRIVATE main.cpp)
target_link_libraries(
buffered-api-tracing PRIVATE buffered-api-tracing-client Threads::Threads
rocprofiler::samples-build-flags)
rocprofiler-sdk::samples-build-flags)

rocprofiler_samples_get_preload_env(PRELOAD_ENV buffered-api-tracing-client)
rocprofiler_samples_get_ld_library_path_env(LIBRARY_PATH_ENV)
Expand Down
7 changes: 4 additions & 3 deletions samples/api_callback_tracing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ add_library(callback-api-tracing-client SHARED)
target_sources(callback-api-tracing-client PRIVATE client.cpp client.hpp)
target_link_libraries(
callback-api-tracing-client
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler::samples-build-flags
rocprofiler::samples-common-library)
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::samples-build-flags
rocprofiler-sdk::samples-common-library)

set_source_files_properties(main.cpp PROPERTIES LANGUAGE HIP)

Expand All @@ -44,7 +44,8 @@ target_sources(callback-api-tracing PRIVATE main.cpp)
target_link_libraries(
callback-api-tracing
PRIVATE callback-api-tracing-client Threads::Threads
rocprofiler-sdk-roctx::rocprofiler-sdk-roctx rocprofiler::samples-build-flags)
rocprofiler-sdk-roctx::rocprofiler-sdk-roctx
rocprofiler-sdk::samples-build-flags)

rocprofiler_samples_get_preload_env(PRELOAD_ENV callback-api-tracing-client)
rocprofiler_samples_get_ld_library_path_env(
Expand Down
4 changes: 2 additions & 2 deletions samples/code_object_isa_decode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ add_executable(code-object-isa-decode)
target_sources(code-object-isa-decode PRIVATE main.cpp client.cpp)
target_link_libraries(
code-object-isa-decode
PRIVATE rocprofiler::samples-common-library rocprofiler-sdk::rocprofiler-sdk
amd_comgr rocprofiler::samples-build-flags)
PRIVATE rocprofiler-sdk::samples-common-library rocprofiler-sdk::rocprofiler-sdk
amd_comgr rocprofiler-sdk::samples-build-flags)

rocprofiler_samples_get_preload_env(PRELOAD_ENV code-object-isa-decode)

Expand Down
6 changes: 3 additions & 3 deletions samples/code_object_tracing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ add_library(code-object-tracing-client SHARED)
target_sources(code-object-tracing-client PRIVATE client.cpp)
target_link_libraries(
code-object-tracing-client
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler::samples-build-flags
rocprofiler::samples-common-library)
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::samples-build-flags
rocprofiler-sdk::samples-common-library)

set_source_files_properties(main.cpp PROPERTIES LANGUAGE HIP)
find_package(Threads REQUIRED)
Expand All @@ -41,7 +41,7 @@ add_executable(code-object-tracing)
target_sources(code-object-tracing PRIVATE main.cpp)
target_link_libraries(
code-object-tracing PRIVATE code-object-tracing-client Threads::Threads
rocprofiler::samples-build-flags)
rocprofiler-sdk::samples-build-flags)

add_test(NAME code-object-tracing COMMAND $<TARGET_FILE:code-object-tracing>)

Expand Down
7 changes: 4 additions & 3 deletions samples/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ set(ROCPROFILER_DEFAULT_FAIL_REGEX

# build flags
add_library(rocprofiler-samples-build-flags INTERFACE)
add_library(rocprofiler::samples-build-flags ALIAS rocprofiler-samples-build-flags)
add_library(rocprofiler-sdk::samples-build-flags ALIAS rocprofiler-samples-build-flags)
target_compile_options(rocprofiler-samples-build-flags INTERFACE -W -Wall -Wextra
-Wshadow)
target_compile_features(rocprofiler-samples-build-flags INTERFACE cxx_std_17)
Expand All @@ -79,9 +79,10 @@ endif()
cmake_path(GET CMAKE_CURRENT_SOURCE_DIR PARENT_PATH COMMON_LIBRARY_INCLUDE_DIR)

add_library(rocprofiler-samples-common-library INTERFACE)
add_library(rocprofiler::samples-common-library ALIAS rocprofiler-samples-common-library)
add_library(rocprofiler-sdk::samples-common-library ALIAS
rocprofiler-samples-common-library)
target_link_libraries(rocprofiler-samples-common-library
INTERFACE rocprofiler::samples-build-flags libdw::libdw)
INTERFACE rocprofiler-sdk::samples-build-flags libdw::libdw)
target_compile_features(rocprofiler-samples-common-library INTERFACE cxx_std_17)
target_include_directories(rocprofiler-samples-common-library
INTERFACE ${COMMON_LIBRARY_INCLUDE_DIR})
Expand Down
16 changes: 8 additions & 8 deletions samples/counter_collection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ add_library(counter-collection-buffer-client SHARED)
target_sources(counter-collection-buffer-client PRIVATE client.cpp client.hpp)
target_link_libraries(
counter-collection-buffer-client
PUBLIC rocprofiler::samples-build-flags
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler::samples-common-library)
PUBLIC rocprofiler-sdk::samples-build-flags
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::samples-common-library)

set_source_files_properties(main.cpp PROPERTIES LANGUAGE HIP)
add_executable(counter-collection-buffer)
Expand All @@ -57,8 +57,8 @@ add_library(counter-collection-callback-client SHARED)
target_sources(counter-collection-callback-client PRIVATE callback_client.cpp client.hpp)
target_link_libraries(
counter-collection-callback-client
PUBLIC rocprofiler::samples-build-flags
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler::samples-common-library)
PUBLIC rocprofiler-sdk::samples-build-flags
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::samples-common-library)

set_source_files_properties(main.cpp PROPERTIES LANGUAGE HIP)
add_executable(counter-collection-callback)
Expand All @@ -84,8 +84,8 @@ target_sources(counter-collection-functional-counter-client
PRIVATE print_functional_counters.cpp client.hpp)
target_link_libraries(
counter-collection-functional-counter-client
PUBLIC rocprofiler::samples-build-flags
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler::samples-common-library)
PUBLIC rocprofiler-sdk::samples-build-flags
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::samples-common-library)

add_executable(counter-collection-print-functional-counters)
target_sources(counter-collection-print-functional-counters PRIVATE main.cpp)
Expand All @@ -112,8 +112,8 @@ target_sources(counter-collection-agent-profiling-client PRIVATE agent_profiling
client.hpp)
target_link_libraries(
counter-collection-agent-profiling-client
PUBLIC rocprofiler::samples-build-flags
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler::samples-common-library)
PUBLIC rocprofiler-sdk::samples-build-flags
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::samples-common-library)

add_executable(counter-collection-agent-profiling)
target_sources(counter-collection-agent-profiling PRIVATE main.cpp)
Expand Down
6 changes: 3 additions & 3 deletions samples/external_correlation_id_request/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ add_library(external-correlation-id-request-client SHARED)
target_sources(external-correlation-id-request-client PRIVATE client.cpp client.hpp)
target_link_libraries(
external-correlation-id-request-client
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler::samples-build-flags
rocprofiler::samples-common-library)
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::samples-build-flags
rocprofiler-sdk::samples-common-library)

set_source_files_properties(main.cpp PROPERTIES LANGUAGE HIP)
find_package(Threads REQUIRED)
Expand All @@ -42,7 +42,7 @@ target_sources(external-correlation-id-request PRIVATE main.cpp)
target_link_libraries(
external-correlation-id-request
PRIVATE external-correlation-id-request-client Threads::Threads
rocprofiler::samples-build-flags)
rocprofiler-sdk::samples-build-flags)

rocprofiler_samples_get_preload_env(PRELOAD_ENV external-correlation-id-request-client)
rocprofiler_samples_get_ld_library_path_env(LIBRARY_PATH_ENV)
Expand Down
6 changes: 3 additions & 3 deletions samples/intercept_table/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ add_library(intercept-table-client SHARED)
target_sources(intercept-table-client PRIVATE client.cpp client.hpp)
target_link_libraries(
intercept-table-client
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler::samples-build-flags
rocprofiler::samples-common-library)
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::samples-build-flags
rocprofiler-sdk::samples-common-library)

set_source_files_properties(main.cpp PROPERTIES LANGUAGE HIP)
find_package(Threads REQUIRED)

add_executable(intercept-table)
target_sources(intercept-table PRIVATE main.cpp)
target_link_libraries(intercept-table PRIVATE intercept-table-client Threads::Threads
rocprofiler::samples-build-flags)
rocprofiler-sdk::samples-build-flags)

rocprofiler_samples_get_preload_env(PRELOAD_ENV intercept-table-client)
rocprofiler_samples_get_ld_library_path_env(LIBRARY_PATH_ENV)
Expand Down
6 changes: 3 additions & 3 deletions samples/pc_sampling/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ add_library(pc-sampling-client SHARED)
target_sources(pc-sampling-client PRIVATE client.cpp pcs.hpp pcs.cpp utils.hpp utils.cpp)
target_link_libraries(
pc-sampling-client
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler::samples-build-flags
rocprofiler::samples-common-library)
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::samples-build-flags
rocprofiler-sdk::samples-common-library)

set_source_files_properties(main.cpp PROPERTIES LANGUAGE HIP)
find_package(Threads REQUIRED)

add_executable(pc-sampling)
target_sources(pc-sampling PRIVATE main.cpp)
target_link_libraries(pc-sampling PRIVATE pc-sampling-client Threads::Threads
rocprofiler::samples-build-flags)
rocprofiler-sdk::samples-build-flags)

rocprofiler_samples_get_preload_env(PRELOAD_ENV pc-sampling-client)
rocprofiler_samples_get_ld_library_path_env(LIBRARY_PATH_ENV)
Expand Down
Loading

0 comments on commit a76f61a

Please sign in to comment.