CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
94 lines
3.5 KiB
CMake
94 lines
3.5 KiB
CMake
#
|
|
# common utilities for samples
|
|
#
|
|
|
|
find_package(rocprofiler-sdk REQUIRED)
|
|
|
|
# rocprofiler-sdk provides a Findlibdw.cmake
|
|
find_package(libdw REQUIRED)
|
|
|
|
# default FAIL_REGULAR_EXPRESSION for tests
|
|
set(ROCPROFILER_DEFAULT_FAIL_REGEX
|
|
"threw an exception|Permission denied|Could not create logging file|failed with error code|Subprocess aborted"
|
|
CACHE INTERNAL "Default FAIL_REGULAR_EXPRESSION for tests")
|
|
|
|
# build flags
|
|
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-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-sdk-samples-common-library INTERFACE)
|
|
add_library(rocprofiler-sdk::samples-common-library ALIAS
|
|
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-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")
|
|
cmake_path(ABSOLUTE_PATH EXTERNAL_SUBMODULE_DIR NORMALIZE)
|
|
|
|
if(EXISTS ${EXTERNAL_SUBMODULE_DIR}/filesystem/include/ghc/filesystem.hpp)
|
|
target_compile_definitions(
|
|
rocprofiler-sdk-samples-common-library
|
|
INTERFACE $<BUILD_INTERFACE:ROCPROFILER_SAMPLES_HAS_GHC_LIB_FILESYSTEM=1>)
|
|
target_include_directories(
|
|
rocprofiler-sdk-samples-common-library SYSTEM
|
|
INTERFACE $<BUILD_INTERFACE:${EXTERNAL_SUBMODULE_DIR}/filesystem/include>)
|
|
endif()
|
|
|
|
# function for getting the LD_PRELOAD environment variable
|
|
function(rocprofiler_samples_get_preload_env _VAR)
|
|
set(_PRELOAD_ENV_LIBS ${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE} $ENV{LD_PRELOAD})
|
|
|
|
foreach(_TARG ${ARGN})
|
|
if(NOT TARGET ${_TARG})
|
|
message(
|
|
FATAL_ERROR
|
|
"rocprofiler_samples_get_preload_env: '${_TARG}' is not a valid target"
|
|
)
|
|
endif()
|
|
list(APPEND _PRELOAD_ENV_LIBS $<TARGET_FILE:${_TARG}>)
|
|
endforeach()
|
|
|
|
if(_PRELOAD_ENV_LIBS)
|
|
string(REPLACE ";" ":" _PRELOAD_ENV "LD_PRELOAD=${_PRELOAD_ENV_LIBS}")
|
|
endif()
|
|
|
|
set(${_VAR}
|
|
"${_PRELOAD_ENV}"
|
|
PARENT_SCOPE)
|
|
endfunction()
|
|
|
|
# function for getting the LD_LIBRARY_PATH environment variable
|
|
function(rocprofiler_samples_get_ld_library_path_env _VAR)
|
|
|
|
set(_LDLIB_PATH "LD_LIBRARY_PATH=")
|
|
foreach(_TARG ${ARGN})
|
|
if(NOT TARGET ${_TARG})
|
|
message(
|
|
FATAL_ERROR
|
|
"rocprofiler_samples_get_ld_library_path_env: '${_TARG}' is not a valid target"
|
|
)
|
|
endif()
|
|
string(APPEND _LDLIB_PATH "$<TARGET_FILE_DIR:${_TARG}>:")
|
|
endforeach()
|
|
# append the environments current LD_LIBRARY_PATH
|
|
string(APPEND _LDLIB_PATH "$ENV{LD_LIBRARY_PATH}")
|
|
|
|
set(${_VAR}
|
|
"${_LDLIB_PATH}"
|
|
PARENT_SCOPE)
|
|
endfunction()
|