Files
rocm-systems/projects/rdc/tests/rdc_tests/CMakeLists.txt
T

94 lines
2.6 KiB
CMake
Raw Normal View History

2022-07-06 16:34:48 -05:00
message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
message(" Cmake RDC test ")
message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
2020-01-06 11:15:19 -06:00
if(WIN32)
2022-07-06 16:34:48 -05:00
message("rdc library test suite is not supported on Windows platform")
return()
2020-01-06 11:15:19 -06:00
endif()
# Required Defines first:
2022-07-06 16:34:48 -05:00
option(INSTALL_GTEST "Install GTest (only useful if GTest is not already installed)" OFF)
2020-01-06 11:15:19 -06:00
2023-01-11 17:31:07 -06:00
# Hack to find libraries after installation
# /opt/rocm/share/rdc/rdctst_tests/../../../ = /opt/rocm
2025-05-06 22:22:50 +00:00
set(RDCTST_RPATH "\$ORIGIN" "\$ORIGIN/../../../lib" "\$ORIGIN/../../../lib/rdc")
2023-01-11 17:31:07 -06:00
# combine lists
2025-05-06 22:22:50 +00:00
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${RDCTST_RPATH})
2023-01-11 17:31:07 -06:00
2020-01-06 11:15:19 -06:00
#
# Print out the build configuration being used:
#
# Build Src directory
# Build Binary directory
# Build Type: Debug Vs Release, 32 Vs 64
# Compiler Version, etc
#
message("")
message("Build Configuration:")
message("-----------BuildType: " ${BUILD_TYPE})
message("------------Compiler: " ${CMAKE_CXX_COMPILER})
message("-------------Version: " ${CMAKE_CXX_COMPILER_VERSION})
2020-06-10 18:16:06 -05:00
message("------------ROCM_DIR: " ${ROCM_DIR})
2020-01-06 11:15:19 -06:00
message("--------Proj Src Dir: " ${PROJECT_SOURCE_DIR})
message("--------Proj Bld Dir: " ${PROJECT_BINARY_DIR})
message("--------Proj Lib Dir: " ${PROJECT_BINARY_DIR}/lib)
message("--------Proj Exe Dir: " ${PROJECT_BINARY_DIR}/bin)
2025-01-23 14:20:47 -06:00
message("--------SMI Lib Dir: " ${AMD_SMI_LIB_DIR})
message("--------SMI Inc Dir: " ${AMD_SMI_INCLUDE_DIR})
2020-01-06 11:15:19 -06:00
message("")
2022-07-06 16:34:48 -05:00
set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
2020-01-06 11:15:19 -06:00
2022-07-06 16:34:48 -05:00
set(RDCTST "rdctst")
2020-01-06 11:15:19 -06:00
2023-09-27 18:25:22 -05:00
# Download and compile googletest
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
2025-06-24 17:35:03 -05:00
GIT_TAG v1.14.0
)
2023-09-27 18:25:22 -05:00
FetchContent_MakeAvailable(googletest)
2020-01-06 11:15:19 -06:00
2022-07-06 16:34:48 -05:00
# Source files
aux_source_directory(${SRC_DIR} rdctstSources)
2020-01-27 19:08:09 -06:00
2020-01-06 11:15:19 -06:00
# Other source directories
2022-07-06 16:34:48 -05:00
aux_source_directory(${SRC_DIR}/functional functionalSources)
2020-01-06 11:15:19 -06:00
2025-01-23 14:20:47 -06:00
link_directories(${ROCM_INSTALL_DIR} ${AMD_SMI_LIB_DIR})
2020-01-06 11:15:19 -06:00
# Build rules
add_executable(${RDCTST} ${rdctstSources} ${functionalSources})
# Header file include path
2022-07-06 16:34:48 -05:00
target_include_directories(
${RDCTST}
PUBLIC ${PROJECT_SOURCE_DIR}/include
2025-01-23 14:20:47 -06:00
PUBLIC ${AMD_SMI_INCLUDE_DIR}
2025-06-24 17:35:03 -05:00
PUBLIC ${SRC_DIR}/..
)
2022-07-06 16:34:48 -05:00
2025-05-06 22:22:50 +00:00
target_link_libraries(
${RDCTST}
2022-07-06 16:34:48 -05:00
PUBLIC rdc_bootstrap
PUBLIC rdc
2023-09-27 18:25:22 -05:00
PUBLIC GTest::gtest_main
2022-07-06 16:34:48 -05:00
PUBLIC c
PUBLIC stdc++
2025-06-24 17:35:03 -05:00
PUBLIC pthread
)
2022-07-06 16:34:48 -05:00
2025-05-06 22:22:50 +00:00
install(
TARGETS ${RDCTST} gtest gtest_main
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${RDC}/rdctst_tests
2025-06-24 17:35:03 -05:00
COMPONENT ${TESTS_COMPONENT}
)
2022-07-06 16:34:48 -05:00
2025-05-06 22:22:50 +00:00
install(
FILES ${RDCTST}.exclude
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${RDC}/rdctst_tests
2025-06-24 17:35:03 -05:00
COMPONENT ${TESTS_COMPONENT}
)