Support use of external/system GTest installation (#1469)

* Support use of system/external GTest installation

* Create working directory for tests explicitly
This commit is contained in:
Daniel Richard G 2024-07-10 11:07:57 -04:00 committed by GitHub
parent 81b06ee0e0
commit d6580c3dc0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View File

@ -133,6 +133,7 @@ set(CUTLASS_ENABLE_PERFORMANCE ${CUTLASS_ENABLE_PROFILER} CACHE BOOL "Enable CUT
set(CUTLASS_ENABLE_TESTS ${CUTLASS_ENABLE_TESTS_INIT} CACHE BOOL "Enable CUTLASS Tests") set(CUTLASS_ENABLE_TESTS ${CUTLASS_ENABLE_TESTS_INIT} CACHE BOOL "Enable CUTLASS Tests")
set(CUTLASS_ENABLE_GTEST_UNIT_TESTS ${CUTLASS_ENABLE_TESTS} CACHE BOOL "Enable CUTLASS GTest-based Unit Tests") set(CUTLASS_ENABLE_GTEST_UNIT_TESTS ${CUTLASS_ENABLE_TESTS} CACHE BOOL "Enable CUTLASS GTest-based Unit Tests")
set(CUTLASS_USE_SYSTEM_GOOGLETEST OFF CACHE BOOL "Use system/external installation of GTest")
################################################################################ ################################################################################
set(CUTLASS_NVCC_ARCHS_SUPPORTED "") set(CUTLASS_NVCC_ARCHS_SUPPORTED "")
@ -702,7 +703,11 @@ include(CTest)
enable_testing() enable_testing()
if (CUTLASS_ENABLE_GTEST_UNIT_TESTS) if (CUTLASS_ENABLE_GTEST_UNIT_TESTS)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/googletest.cmake) if (CUTLASS_USE_SYSTEM_GOOGLETEST)
find_package(GTest REQUIRED)
else()
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/googletest.cmake)
endif()
endif() endif()
if (NOT TARGET test_all) if (NOT TARGET test_all)
@ -747,6 +752,7 @@ set(CUTLASS_DEFAULT_ACTIVE_TEST_SETS "default" CACHE STRING "Default
with CUTLASS_TEST_SETS environment variable when running the ctest with CUTLASS_TEST_SETS environment variable when running the ctest
executable.") executable.")
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
set(CUTLASS_CTEST_TEMPLATE_FILE ${CMAKE_CURRENT_LIST_DIR}/cmake/CTestTestfile.configure.cmake) set(CUTLASS_CTEST_TEMPLATE_FILE ${CMAKE_CURRENT_LIST_DIR}/cmake/CTestTestfile.configure.cmake)
set(CUTLASS_CTEST_GENERATED_FILES "" CACHE INTERNAL "") set(CUTLASS_CTEST_GENERATED_FILES "" CACHE INTERNAL "")

View File

@ -42,7 +42,7 @@ target_link_libraries(
CUTLASS CUTLASS
cutlass_tools_util_includes cutlass_tools_util_includes
$<$<BOOL:${CUTLASS_ENABLE_CUBLAS}>:nvidia::cublas> $<$<BOOL:${CUTLASS_ENABLE_CUBLAS}>:nvidia::cublas>
gtest GTest::gtest
cudart cudart
cuda_driver cuda_driver
) )
@ -84,7 +84,7 @@ function(cutlass_test_unit_add_executable NAME)
target_link_libraries( target_link_libraries(
${NAME} ${NAME}
PUBLIC PUBLIC
gtest GTest::gtest
) )
else() else()
target_link_libraries( target_link_libraries(