CMake: Consistently name CMake Targets (#1082)
* Change all rocprofiler-X target names to rocprofiler-sdk-X
* Update rocprofiler-sdk-config.cmake
- fix install tree target names
- simplify logic for using find w/ components and find w/o components
* Update rocprofiler-sdk-roctx-config.cmake
- simplify logic for using find w/ components and find w/o components
* Update samples/intercept_table/CMakeLists.txt
- demonstrate/test use of `find_package(rocprofiler-sdk ... COMPONENTS ...)`
[ROCm/rocprofiler-sdk commit: 74facf87a6]
此提交包含在:
@@ -65,26 +65,27 @@ set(ROCPROFILER_DEFAULT_FAIL_REGEX
|
||||
CACHE STRING "Default FAIL_REGULAR_EXPRESSION for tests")
|
||||
|
||||
# build flags
|
||||
add_library(rocprofiler-samples-build-flags INTERFACE)
|
||||
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)
|
||||
add_library(rocprofiler-sdk-samples-build-flags INTERFACE)
|
||||
add_library(rocprofiler-sdk::samples-build-flags ALIAS
|
||||
rocprofiler-sdk-samples-build-flags)
|
||||
target_compile_options(rocprofiler-sdk-samples-build-flags INTERFACE -W -Wall -Wextra
|
||||
-Wshadow)
|
||||
target_compile_features(rocprofiler-sdk-samples-build-flags INTERFACE cxx_std_17)
|
||||
|
||||
if(ROCPROFILER_BUILD_CI OR ROCPROFILER_BUILD_WERROR)
|
||||
target_compile_options(rocprofiler-samples-build-flags INTERFACE -Werror)
|
||||
target_compile_options(rocprofiler-sdk-samples-build-flags INTERFACE -Werror)
|
||||
endif()
|
||||
|
||||
# common utilities
|
||||
cmake_path(GET CMAKE_CURRENT_SOURCE_DIR PARENT_PATH COMMON_LIBRARY_INCLUDE_DIR)
|
||||
|
||||
add_library(rocprofiler-samples-common-library INTERFACE)
|
||||
add_library(rocprofiler-sdk-samples-common-library INTERFACE)
|
||||
add_library(rocprofiler-sdk::samples-common-library ALIAS
|
||||
rocprofiler-samples-common-library)
|
||||
target_link_libraries(rocprofiler-samples-common-library
|
||||
rocprofiler-sdk-samples-common-library)
|
||||
target_link_libraries(rocprofiler-sdk-samples-common-library
|
||||
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
|
||||
target_compile_features(rocprofiler-sdk-samples-common-library INTERFACE cxx_std_17)
|
||||
target_include_directories(rocprofiler-sdk-samples-common-library
|
||||
INTERFACE ${COMMON_LIBRARY_INCLUDE_DIR})
|
||||
|
||||
set(EXTERNAL_SUBMODULE_DIR "${PROJECT_SOURCE_DIR}/../external")
|
||||
@@ -92,10 +93,10 @@ cmake_path(ABSOLUTE_PATH EXTERNAL_SUBMODULE_DIR NORMALIZE)
|
||||
|
||||
if(EXISTS ${EXTERNAL_SUBMODULE_DIR}/filesystem/include/ghc/filesystem.hpp)
|
||||
target_compile_definitions(
|
||||
rocprofiler-samples-common-library
|
||||
rocprofiler-sdk-samples-common-library
|
||||
INTERFACE $<BUILD_INTERFACE:ROCPROFILER_SAMPLES_HAS_GHC_LIB_FILESYSTEM=1>)
|
||||
target_include_directories(
|
||||
rocprofiler-samples-common-library SYSTEM
|
||||
rocprofiler-sdk-samples-common-library SYSTEM
|
||||
INTERFACE $<BUILD_INTERFACE:${EXTERNAL_SUBMODULE_DIR}/filesystem/include>)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -25,7 +25,10 @@ foreach(_TYPE DEBUG MINSIZEREL RELEASE RELWITHDEBINFO)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
find_package(rocprofiler-sdk REQUIRED)
|
||||
#
|
||||
# below is equivalent to: ``find_package(rocprofiler-sdk REQUIRED)``. Use COMPONENTS below
|
||||
# to demonstrate/test support for COMPONENTS
|
||||
find_package(rocprofiler-sdk REQUIRED COMPONENTS headers shared-library)
|
||||
|
||||
add_library(intercept-table-client SHARED)
|
||||
target_sources(intercept-table-client PRIVATE client.cpp client.hpp)
|
||||
|
||||
新增問題並參考
封鎖使用者