From 7ee9ec4c2636cca833761d3466df27edc4e3f952 Mon Sep 17 00:00:00 2001 From: Nicolas Graves Date: Tue, 30 Jul 2024 14:13:09 +0200 Subject: [PATCH] Add CUTLASS_BUILD_STATIC_LIBRARY option --- tools/library/CMakeLists.txt | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tools/library/CMakeLists.txt b/tools/library/CMakeLists.txt index a11ebcf6..79f7ccd1 100644 --- a/tools/library/CMakeLists.txt +++ b/tools/library/CMakeLists.txt @@ -34,6 +34,7 @@ include(GNUInstallDirs) set(CUTLASS_BUILD_MONO_LIBRARY OFF CACHE BOOL "Determines whether the cutlass library is generated as a single file or multiple files.") +option(CUTLASS_BUILD_STATIC_LIBRARY "Build static libary for CUTLASS" ON) ################################################################################ @@ -126,7 +127,9 @@ function(cutlass_add_cutlass_library) # simply link the generated object files to the default library. target_link_libraries(${DEFAULT_NAME} PRIVATE $) - target_link_libraries(${DEFAULT_NAME}_static PRIVATE $) + if (CUTLASS_BUILD_STATIC_LIBRARY) + target_link_libraries(${DEFAULT_NAME}_static PRIVATE $) + endif() else() @@ -152,7 +155,7 @@ function(cutlass_add_cutlass_library) ) set_target_properties(${__NAME} PROPERTIES DEBUG_POSTFIX "${CUTLASS_LIBRARY_DEBUG_POSTFIX}") - + if (CUTLASS_BUILD_STATIC_LIBRARY) cutlass_add_library( ${__NAME}_static STATIC @@ -189,6 +192,15 @@ function(cutlass_add_cutlass_library) LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) + else() + install( + TARGETS ${__NAME} + EXPORT NvidiaCutlass + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + endif() if (__SUFFIX) @@ -197,8 +209,10 @@ function(cutlass_add_cutlass_library) # commands to pull in all kernels by default. target_link_libraries(${DEFAULT_NAME} INTERFACE ${__NAME}) - target_link_libraries(${DEFAULT_NAME}_static INTERFACE ${__NAME}_static) - + if (CUTLASS_BUILD_STATIC_LIBRARY) + target_link_libraries(${DEFAULT_NAME}_static INTERFACE ${__NAME}_static) + endif() + endif() endif() -- 2.45.2