2026-01-15 21:51:16 -05:00
|
|
|
# Copyright (c) Advanced Micro Devices, Inc.
|
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
|
2025-08-21 15:56:47 -04:00
|
|
|
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
|
2022-04-25 17:00:52 -05:00
|
|
|
|
2024-10-15 11:20:40 -04:00
|
|
|
project(rocprofiler-systems-code-coverage-example LANGUAGES CXX)
|
2022-11-01 17:28:12 -05:00
|
|
|
|
2024-10-15 11:20:40 -04:00
|
|
|
if(ROCPROFSYS_DISABLE_EXAMPLES)
|
2022-11-01 17:28:12 -05:00
|
|
|
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
|
|
|
|
|
|
2025-06-22 10:44:33 -04:00
|
|
|
if(
|
|
|
|
|
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
|
|
|
|
|
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
|
|
|
|
|
)
|
2022-11-01 17:28:12 -05:00
|
|
|
return()
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
2022-04-25 17:00:52 -05:00
|
|
|
|
|
|
|
|
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
|
|
|
|
|
string(REPLACE " " ";" _FLAGS "${CMAKE_CXX_FLAGS_DEBUG}")
|
|
|
|
|
|
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
add_executable(code-coverage code-coverage.cpp)
|
2022-05-31 01:51:18 -05:00
|
|
|
target_link_libraries(code-coverage PRIVATE Threads::Threads)
|
2022-04-25 17:00:52 -05:00
|
|
|
target_compile_options(code-coverage PRIVATE ${_FLAGS})
|
|
|
|
|
|
2024-10-15 11:20:40 -04:00
|
|
|
if(ROCPROFSYS_INSTALL_EXAMPLES)
|
2026-01-15 21:51:16 -05:00
|
|
|
install(
|
|
|
|
|
TARGETS code-coverage
|
|
|
|
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/rocprofiler-systems/examples
|
|
|
|
|
COMPONENT rocprofiler-systems-examples
|
|
|
|
|
)
|
2022-04-25 17:00:52 -05:00
|
|
|
endif()
|
2022-10-31 15:39:45 -05:00
|
|
|
|
|
|
|
|
set(PYTHON_FILES code-coverage.py)
|
|
|
|
|
|
|
|
|
|
find_package(Python3 COMPONENTS Interpreter)
|
|
|
|
|
|
|
|
|
|
if(Python3_FOUND)
|
|
|
|
|
set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}")
|
|
|
|
|
|
|
|
|
|
foreach(_FILE ${PYTHON_FILES})
|
2025-06-22 10:44:33 -04:00
|
|
|
configure_file(
|
|
|
|
|
${PROJECT_SOURCE_DIR}/${_FILE}
|
|
|
|
|
${PROJECT_BINARY_DIR}/${_FILE}
|
|
|
|
|
@ONLY
|
|
|
|
|
)
|
2022-10-31 15:39:45 -05:00
|
|
|
|
2024-10-15 11:20:40 -04:00
|
|
|
if(ROCPROFSYS_INSTALL_EXAMPLES)
|
2022-10-31 15:39:45 -05:00
|
|
|
install(
|
|
|
|
|
PROGRAMS ${PROJECT_BINARY_DIR}/${_FILE}
|
2026-01-15 21:51:16 -05:00
|
|
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/rocprofiler-systems/examples
|
2025-06-22 10:44:33 -04:00
|
|
|
COMPONENT rocprofiler-systems-examples
|
|
|
|
|
)
|
2022-10-31 15:39:45 -05:00
|
|
|
endif()
|
|
|
|
|
endforeach()
|
|
|
|
|
endif()
|