Skip to content

Commit

Permalink
Support use of external/system GTest installation (#1469)
Browse files Browse the repository at this point in the history
* Support use of system/external GTest installation

* Create working directory for tests explicitly
  • Loading branch information
iskunk authored Jul 10, 2024
1 parent 81b06ee commit d6580c3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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_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 "")
Expand Down Expand Up @@ -702,7 +703,11 @@ include(CTest)
enable_testing()

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()

if (NOT TARGET test_all)
Expand Down Expand Up @@ -747,6 +752,7 @@ set(CUTLASS_DEFAULT_ACTIVE_TEST_SETS "default" CACHE STRING "Default
with CUTLASS_TEST_SETS environment variable when running the ctest
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_GENERATED_FILES "" CACHE INTERNAL "")

Expand Down
4 changes: 2 additions & 2 deletions test/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ target_link_libraries(
CUTLASS
cutlass_tools_util_includes
$<$<BOOL:${CUTLASS_ENABLE_CUBLAS}>:nvidia::cublas>
gtest
GTest::gtest
cudart
cuda_driver
)
Expand Down Expand Up @@ -84,7 +84,7 @@ function(cutlass_test_unit_add_executable NAME)
target_link_libraries(
${NAME}
PUBLIC
gtest
GTest::gtest
)
else()
target_link_libraries(
Expand Down

0 comments on commit d6580c3

Please sign in to comment.