Files
rocm-systems/tests/amd_smi_test/CMakeLists.txt
T

82 lines
2.3 KiB
CMake
Raw Normal View History

2022-08-02 15:55:17 -04:00
# Required Defines first:
2022-11-03 13:30:16 -05:00
option(INSTALL_GTEST "Install GTest (only useful if GTest is not already installed)" OFF)
2022-12-12 14:07:44 -06:00
# Help tests find libraries at runtime
2023-01-03 16:24:49 -06:00
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--enable-new-dtags")
2022-12-12 14:07:44 -06:00
set(CMAKE_INSTALL_RPATH
"\$ORIGIN:\$ORIGIN/../../../lib"
CACHE STRING "RUNPATH for tests. Helps find libgtest.so and libamd_smi.so")
2023-09-27 17:58:50 -05:00
# Download and compile googletest
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.14.0)
FetchContent_MakeAvailable(googletest)
2022-08-02 15:55:17 -04:00
2022-11-03 13:30:16 -05:00
enable_testing()
2022-08-02 15:55:17 -04:00
2022-11-03 13:30:16 -05:00
if(WIN32)
message("amd_smi library test suite is not supported on Windows platform")
2022-08-02 15:55:17 -04:00
return()
endif()
#
# Print out the build configuration being used:
#
# Build Src directory
# Build Binary directory
# Build Type: Debug Vs Release
2022-08-02 15:55:17 -04:00
# Compiler Version, etc
#
message("")
message("Build Configuration:")
message("-----------BuildType: " ${CMAKE_BUILD_TYPE})
2022-08-02 15:55:17 -04:00
message("------------Compiler: " ${CMAKE_CXX_COMPILER})
message("-------------Version: " ${CMAKE_CXX_COMPILER_VERSION})
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)
message("")
# Other source directories
2022-11-03 13:30:16 -05:00
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/functional functionalSources)
2022-08-02 15:55:17 -04:00
set(TEST "amdsmitst")
2022-08-02 15:55:17 -04:00
2022-11-03 13:30:16 -05:00
# Source files
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} tstSources)
2022-08-02 15:55:17 -04:00
# Header file include path
2024-01-11 01:38:15 -06:00
include_directories(${TEST} ${CMAKE_CURRENT_SOURCE_DIR}/.. ${ROCM_INC_DIR}/..)
2022-08-02 15:55:17 -04:00
# Build rules
2022-11-03 13:30:16 -05:00
add_executable(${TEST} ${tstSources} ${functionalSources})
2022-08-02 15:55:17 -04:00
2023-07-24 17:18:17 -05:00
#AMD_SMI_TARGET?
target_link_libraries(${TEST}
${AMD_SMI_TARGET}
GTest::gtest_main
c
stdc++
pthread)
2022-08-02 15:55:17 -04:00
2023-09-27 17:58:50 -05:00
# Install tests
2022-11-03 13:30:16 -05:00
install(
2023-09-27 17:58:50 -05:00
TARGETS ${TEST}
DESTINATION ${SHARE_INSTALL_PREFIX}/tests
2023-07-24 17:18:17 -05:00
COMPONENT ${TESTS_COMPONENT})
2023-04-05 20:18:43 -05:00
install(
FILES amdsmitst.exclude
DESTINATION ${SHARE_INSTALL_PREFIX}/tests
2023-07-24 17:18:17 -05:00
COMPONENT ${TESTS_COMPONENT})
2023-09-27 17:58:50 -05:00
# Install googletest libraries with tests
install(TARGETS gtest gtest_main
DESTINATION ${SHARE_INSTALL_PREFIX}/tests
COMPONENT ${TESTS_COMPONENT})