Files
rocm-systems/samples/api_callback_tracing/CMakeLists.txt
T
Jonathan R. Madsen 5c07deb159 Update build for rocprofiler-library to support unit tests (#76)
* Update build for rocprofiler-library

- Build rocprofiler OBJECT library (rocprofiler-object-library)
- Generate rocprofiler shared library via rocprofiler-object-library
- Generate rocprofiler static library via rocprofiler-object-library
  - this target is excluded from all target and, thus, is only built when another target links to it

* Update lib/rocprofiler/CMakeLists.txt

- tweak order of EXCLUDE_FROM_ALL and STATIC in add_library(rocprofiler-static-library ...)

* Update samples

- link against rocprofiler::rocprofiler instead of rocprofiler::rocprofiler-library following target renaming

* Update cmake

- fix PROJECT_BUILD_TARGETS for rocprofiler::rocprofiler target in rocprofiler-config.cmake
- disable <OS>-<VERSION> in CPack package name
- Add ROCPROFILER_BUILD_CODECOV option
2023-09-21 18:01:20 -05:00

61 行
1.8 KiB
CMake

#
#
#
cmake_minimum_required(VERSION 3.21.0 FATAL_ERROR)
if(NOT CMAKE_HIP_COMPILER)
find_program(
amdclangpp_EXECUTABLE
NAMES amdclang++
HINTS ${ROCM_PATH} ENV ROCM_PATH /opt/rocm
PATHS ${ROCM_PATH} ENV ROCM_PATH /opt/rocm
PATH_SUFFIXES bin llvm/bin NO_CACHE)
mark_as_advanced(amdclangpp_EXECUTABLE)
if(amdclangpp_EXECUTABLE)
set(CMAKE_HIP_COMPILER "${amdclangpp_EXECUTABLE}")
endif()
endif()
project(rocprofiler-samples-callback-api-tracing LANGUAGES CXX HIP)
foreach(_TYPE DEBUG MINSIZEREL RELEASE RELWITHDEBINFO)
if("${CMAKE_HIP_FLAGS_${_TYPE}}" STREQUAL "")
set(CMAKE_HIP_FLAGS_${_TYPE} "${CMAKE_CXX_FLAGS_${_TYPE}}")
endif()
endforeach()
if(NOT TARGET rocprofiler::rocprofiler)
find_package(rocprofiler REQUIRED)
endif()
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::rocprofiler
$<TARGET_NAME_IF_EXISTS:rocprofiler::samples-build-flags>)
set_source_files_properties(main.cpp PROPERTIES LANGUAGE HIP)
find_package(Threads REQUIRED)
add_executable(callback-api-tracing)
target_sources(callback-api-tracing PRIVATE main.cpp)
target_link_libraries(
callback-api-tracing
PRIVATE callback-api-tracing-client Threads::Threads
$<TARGET_NAME_IF_EXISTS:rocprofiler::samples-build-flags>)
add_test(NAME callback-api-tracing COMMAND $<TARGET_FILE:callback-api-tracing>)
set_tests_properties(
callback-api-tracing
PROPERTIES
TIMEOUT
45
LABELS
"samples"
ENVIRONMENT
"${ROCPROFILER_MEMCHECK_PRELOAD_ENV};HSA_TOOLS_LIB=$<TARGET_FILE:rocprofiler::rocprofiler>"
)