Files
rocm-systems/tests/bin/CMakeLists.txt
T
Madsen, Jonathan cb1b430251 Logging updates (#7)
* General logging updates

* ROCm 6.1.x fatal defect: unconditional abort if tool found but rocprofiler-sdk missing

- Adding rocprofiler-sdk support breaks backwards compatibility in ROCm 6.1.x because `rocprofiler_configure` symbol triggers looking for rocprofiler-sdk library (which was not released until ROCm 6.2)
- Bump version to 0.5.0

* revert to using fatal error

* Include header updates

* Fix CodeQL suggestions

* CMake and CI updates

- minimum cmake version is 3.22.0
- added requirements.txt
- improved rocprofiler_register_{formatting,linting}.cmake

* Disable deprecated declarations warnings

* Use "overwrite" instead of "override"

- override is a keyword in C++

* Disable REQUIRED for formatting and linting when BUILD_DEVELOPER=ON

---------

Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
2025-03-21 01:23:45 -05:00

109 lines
2.8 KiB
CMake

#
#
#
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Threads REQUIRED)
find_package(
hip
HINTS
${ROCM_PATH}
ENV
ROCM_PATH
/opt/rocm
PATHS
${ROCM_PATH}
ENV
ROCM_PATH
/opt/rocm)
if(hip_FOUND)
add_executable(simple-hip)
target_sources(simple-hip PRIVATE simple-hip.cpp)
target_compile_options(simple-hip PRIVATE -W -Wall -Wextra -Werror)
target_link_libraries(simple-hip PRIVATE Threads::Threads hip::host)
set(PRELOAD_TESTS_DISABLED OFF)
else()
add_executable(simple-hip EXCLUDE_FROM_ALL)
target_sources(simple-hip PRIVATE simple-hip.cpp)
target_link_libraries(simple-hip PRIVATE Threads::Threads)
set(PRELOAD_TESTS_DISABLED ON)
endif()
#
# INSTALL
#
set(TEST_DESTDIR "${CMAKE_BINARY_DIR}/tests/install")
set(simple-hip-install-env "DESTDIR=${TEST_DESTDIR}")
add_test(
NAME test-simple-hip-install
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target install --parallel 4
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
set_tests_properties(
test-simple-hip-install
PROPERTIES TIMEOUT
120
LABELS
"integration-test"
ENVIRONMENT
"${simple-hip-install-env}"
DISABLED
${PRELOAD_TESTS_DISABLED}
FIXTURES_SETUP
"simple-hip-install")
#
# NORMAL (no profiling library)
#
string(REPLACE "//" "/" TEST_INSTALL_PREFIX "${TEST_DESTDIR}/${CMAKE_INSTALL_PREFIX}")
set(simple-hip-normal-env
"LD_LIBRARY_PATH=${TEST_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}:${ROCM_PATH}/${CMAKE_INSTALL_LIBDIR}"
)
add_test(NAME test-simple-hip-normal COMMAND $<TARGET_FILE:simple-hip>)
set_tests_properties(
test-simple-hip-normal
PROPERTIES TIMEOUT
120
LABELS
"integration-test"
ENVIRONMENT
"${simple-hip-normal-env}"
DEPENDS
test-simple-hip-install
DISABLED
${PRELOAD_TESTS_DISABLED}
FIXTURES_SETUP
"simple-hip-works"
FIXTURES_REQUIRED
"simple-hip-install")
#
# PRELOAD
#
set(simple-hip-preload-env ${simple-hip-normal-env}
"LD_PRELOAD=$<TARGET_FILE:generic-tool::generic-tool>")
add_test(NAME test-simple-hip-preload COMMAND $<TARGET_FILE:simple-hip>)
set_tests_properties(
test-simple-hip-preload
PROPERTIES TIMEOUT
120
LABELS
"integration-test"
ENVIRONMENT
"${simple-hip-preload-env}"
DEPENDS
test-simple-hip-install
DISABLED
${PRELOAD_TESTS_DISABLED}
FIXTURES_REQUIRED
"simple-hip-install;simple-hip-works")