File Modify-CMakeLists.txt-files-to-allow-to-build-modules-independently.patch of Package rocblas

From: Egbert Eich <eich@suse.com>
Date: Wed Apr 30 16:18:49 2025 +0200
Subject: Modify CMakeLists.txt files to allow to build modules independently
Patch-mainline: Not yet
Git-commit: f4724507a2770b2ed5ecc633aa406ad70a675e6f
References: 

Signed-off-by: Egbert Eich <eich@suse.com>
Signed-off-by: Egbert Eich <eich@suse.de>
---
 library/src/CMakeLists.txt                | 24 +++++-------------------
 library/src/TensileInstall/CMakeLists.txt | 19 +++++++++++++++++++
 2 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/library/src/CMakeLists.txt b/library/src/CMakeLists.txt
index 35342e1..efa732c 100644
--- a/library/src/CMakeLists.txt
+++ b/library/src/CMakeLists.txt
@@ -97,7 +97,9 @@ if( BUILD_WITH_TENSILE )
   set_target_properties( TensileHost PROPERTIES OUTPUT_NAME rocblas-tensile CXX_EXTENSIONS NO )
 
   # Tensile host depends on libs build target
-  add_dependencies( TensileHost TENSILE_LIBRARY_TARGET )
+  if(NOT DEFINED ENV{TENSILE_SKIP_LIBRARY} OR NOT $ENV{TENSILE_SKIP_LIBRARY})
+    add_dependencies( TensileHost TENSILE_LIBRARY_TARGET )
+  endif()
 
   if( ROCBLAS_SHARED_LIBS )
     set( BUILD_SHARED_LIBS ON )
@@ -823,24 +825,8 @@ rocm_install_targets(
     ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}
 )
 
-if( BUILD_WITH_TENSILE )
-  if (WIN32)
-    set( ROCBLAS_TENSILE_LIBRARY_DIR "\${CPACK_PACKAGING_INSTALL_PREFIX}/bin/rocblas" CACHE PATH "path to tensile library" )
-  else()
-    set( ROCBLAS_TENSILE_LIBRARY_DIR "${CMAKE_INSTALL_LIBDIR}/rocblas" CACHE PATH "path to tensile library" )
-  endif()
-  # For ASAN package, Tensile library files(which are not shared libraries) are not required
-  if( NOT ENABLE_ASAN_PACKAGING )
-    if( BUILD_SHARED_LIBS )
-      set( TENSILE_DATA_COMPONENT_NAME ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} )
-    else()
-      set( TENSILE_DATA_COMPONENT_NAME devel )
-    endif()
-    rocm_install(
-      DIRECTORY ${CMAKE_BINARY_DIR}/Tensile/library
-      DESTINATION ${ROCBLAS_TENSILE_LIBRARY_DIR}
-      COMPONENT ${TENSILE_DATA_COMPONENT_NAME}) # Use this cmake variable to be compatible with rocm-cmake 0.6 and 0.7
-  endif()
+if(NOT DEFINED ENV{TENSILE_SKIP_LIBRARY} OR NOT $ENV{TENSILE_SKIP_LIBRARY})
+  add_subdirectory( TensileInstall )
 endif()
 
 if(NOT WIN32)
diff --git a/library/src/TensileInstall/CMakeLists.txt b/library/src/TensileInstall/CMakeLists.txt
new file mode 100644
index 0000000..fa39e9f
--- /dev/null
+++ b/library/src/TensileInstall/CMakeLists.txt
@@ -0,0 +1,19 @@
+if( BUILD_WITH_TENSILE )
+  if (WIN32)
+    set( ROCBLAS_TENSILE_LIBRARY_DIR "\${CPACK_PACKAGING_INSTALL_PREFIX}/bin/rocblas" CACHE PATH "path to tensile library" )
+  else()
+    set( ROCBLAS_TENSILE_LIBRARY_DIR "${CMAKE_INSTALL_LIBDIR}/rocblas" CACHE PATH "path to tensile library" )
+  endif()
+  # For ASAN package, Tensile library files(which are not shared libraries) are not required
+  if( NOT ENABLE_ASAN_PACKAGING )
+    if( BUILD_SHARED_LIBS )
+      set( TENSILE_DATA_COMPONENT_NAME ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} )
+    else()
+      set( TENSILE_DATA_COMPONENT_NAME devel )
+    endif()
+    rocm_install(
+      DIRECTORY ${CMAKE_BINARY_DIR}/Tensile/library
+      DESTINATION ${ROCBLAS_TENSILE_LIBRARY_DIR}
+      COMPONENT ${TENSILE_DATA_COMPONENT_NAME}) # Use this cmake variable to be compatible with rocm-cmake 0.6 and 0.7
+  endif()
+endif()
openSUSE Build Service is sponsored by