openblas: Fix cmake exported targets.
This commit is contained in:
47
mingw-w64-openblas/008-export-only-shared-library.patch
Normal file
47
mingw-w64-openblas/008-export-only-shared-library.patch
Normal file
@@ -0,0 +1,47 @@
|
||||
From 9874cd11cb3c9390ac69f14130a368921d7a37ac Mon Sep 17 00:00:00 2001
|
||||
From: Mehdi Chinoune <mehdi.chinoune@hotmail.com>
|
||||
Date: Fri, 29 Oct 2021 21:28:21 +0100
|
||||
Subject: [PATCH] Fix exported OpenBLASTargets.cmake
|
||||
|
||||
When both BUILD_SHARED_LIBS and BUILD_STATIC_LIBS are enabled,
|
||||
cmake export both of them to OpenBLASTargets under tha same name `OpenBLAS::OpenBLAS`
|
||||
which leads to fatal error about OpenBLAS::OpenBLAS being both static and shared target.
|
||||
This change makes cmake export only the shared library in that case.
|
||||
There is another solution to treat them as components,
|
||||
but I am afraid that will make it backward incompatible.
|
||||
---
|
||||
CMakeLists.txt | 21 ++++++++++++++++-----
|
||||
1 file changed, 16 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 656cc36f0..cdbb8c306 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -386,11 +386,22 @@ endif()
|
||||
# Install project
|
||||
|
||||
# Install libraries
|
||||
-install(TARGETS ${OpenBLAS_LIBS}
|
||||
- EXPORT "OpenBLAS${SUFFIX64}Targets"
|
||||
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )
|
||||
+if(BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
|
||||
+ install(TARGETS ${OpenBLAS_LIBNAME}_shared
|
||||
+ EXPORT "OpenBLAS${SUFFIX64}Targets"
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )
|
||||
+ install(TARGETS ${OpenBLAS_LIBNAME}_static
|
||||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )
|
||||
+else()
|
||||
+ install(TARGETS ${OpenBLAS_LIBS}
|
||||
+ EXPORT "OpenBLAS${SUFFIX64}Targets"
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )
|
||||
+endif()
|
||||
|
||||
# Install headers
|
||||
set(CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}/openblas${SUFFIX64})
|
||||
@@ -5,7 +5,7 @@ _realname=OpenBLAS
|
||||
pkgbase=mingw-w64-openblas
|
||||
pkgname="${MINGW_PACKAGE_PREFIX}-openblas"
|
||||
pkgver=0.3.18
|
||||
pkgrel=2
|
||||
pkgrel=3
|
||||
pkgdesc="An optimized BLAS library based on GotoBLAS2 1.13 BSD, providing optimized blas, lapack, and cblas (mingw-w64)"
|
||||
arch=('any')
|
||||
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
|
||||
@@ -30,7 +30,8 @@ source=(${_realname}-${pkgver}.tar.gz::https://github.com/xianyi/OpenBLAS/archiv
|
||||
004-fix-generate-cmake-config.patch
|
||||
005-fix-clang32-compile-flags.patch
|
||||
006-fix-cmake-detect-clang-64-bits.patch
|
||||
007-support-building-both-static-shared.patch)
|
||||
007-support-building-both-static-shared.patch
|
||||
008-export-only-shared-library.patch)
|
||||
install=${_realname}.install
|
||||
sha256sums=('1632c1e8cca62d8bed064b37747e331a1796fc46f688626337362bf0d16aeadb'
|
||||
'6a73ee677d8d37509cd08f380b0359ee7fac2595fd64695dd054e838380a6a33'
|
||||
@@ -38,7 +39,8 @@ sha256sums=('1632c1e8cca62d8bed064b37747e331a1796fc46f688626337362bf0d16aeadb'
|
||||
'cdef4aa30254b23a682ae90fd6db1e03f77c8f073fc00892371745d07ffc79a2'
|
||||
'7c7910039746b505ae182ef5f0e6f18c7ffdfc47e9d11f529840cda25fefc367'
|
||||
'238c57cd3d72c04d8322ba0e9dd148c68f5665776b3fcd51a047c45573d8baf4'
|
||||
'5db3d553b5cd9539f03b0a5d9820a6da91d4f57e5501ba565741a12a4efeeb8b')
|
||||
'5db3d553b5cd9539f03b0a5d9820a6da91d4f57e5501ba565741a12a4efeeb8b'
|
||||
'0c539cdf9b02f6c3f956e4b1c30b559997322d1aa45b1226ece601fcec07af91')
|
||||
|
||||
# Helper macros to help make tasks easier #
|
||||
apply_patch_with_msg() {
|
||||
@@ -62,6 +64,9 @@ prepare() {
|
||||
# https://github.com/xianyi/OpenBLAS/pull/3411
|
||||
apply_patch_with_msg \
|
||||
007-support-building-both-static-shared.patch
|
||||
# https://github.com/xianyi/OpenBLAS/pull/3431
|
||||
apply_patch_with_msg \
|
||||
008-export-only-shared-library.patch
|
||||
}
|
||||
|
||||
build() {
|
||||
|
||||
Reference in New Issue
Block a user