Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions recipe/bld.bat
Original file line number Diff line number Diff line change
@@ -1,22 +1,41 @@
@echo on

:: add CBLAS_DLL markers to RowMajorStrg/CBLAS_CallFromC in CBLAS/{src,testing}
for %%f in (CBLAS\src\*.c) do (
sed -i.bak "s/extern int RowMajorStrg;/CBLAS_DLL extern int RowMajorStrg;/g" %%f
sed -i.bak "s/extern int CBLAS_CallFromC;/CBLAS_DLL extern int CBLAS_CallFromC;/g" %%f
)
for %%f in (CBLAS\testing\*.c) do (
sed -i.bak "s/extern int RowMajorStrg;/CBLAS_DLL extern int RowMajorStrg;/g" %%f
)

mkdir build
cd build

cmake -G "Ninja" ^
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
-DBUILD_SHARED_LIBS=yes ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_SHARED_LIBRARY_PREFIX=lib ^
-DBUILD_TESTING=ON ^
-DLAPACKE=ON ^
-DCBLAS=ON ^
-DBUILD_DEPRECATED=ON ^
-Wno-dev ..

ninja -j%CPU_COUNT%
if %ERRORLEVEL% NEQ 0 exit 1

ninja install
if %ERRORLEVEL% NEQ 0 exit 1

:: strip "lib" prefix from import libraries, in line with previous naming
move %LIBRARY_LIB%\libblas.lib %LIBRARY_LIB%\blas.lib
move %LIBRARY_LIB%\libcblas.lib %LIBRARY_LIB%\cblas.lib
move %LIBRARY_LIB%\liblapack.lib %LIBRARY_LIB%\lapack.lib
move %LIBRARY_LIB%\liblapacke.lib %LIBRARY_LIB%\lapacke.lib
move %LIBRARY_LIB%\libtmglib.lib %LIBRARY_LIB%\tmglib.lib

:: testing with shared libraries does not work - skip them.
:: This is because: to test that the program exits if wrong parameters are given,
:: the testsuite overrides the symbol xerbla (xerbla logs the error and exits) with
Expand Down
2 changes: 1 addition & 1 deletion recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fi


if [[ "${target_platform}" == osx-* ]]; then
for lib in blas cblas lapack lapacke; do
for lib in blas cblas lapack lapacke tmglib; do
mv $PREFIX/lib/lib$lib.dylib $PREFIX/lib/lib$lib.$PKG_VERSION.dylib
install_name_tool -id $PREFIX/lib/lib$lib.3.dylib $PREFIX/lib/lib$lib.$PKG_VERSION.dylib
ln -s $PREFIX/lib/lib$lib.$PKG_VERSION.dylib $PREFIX/lib/lib$lib.dylib
Expand Down
29 changes: 15 additions & 14 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% set version = "3.11.0" %}
# if build_num is reset to 0 (for new version), update increment for blas_minor below
{% set build_num = 6 %}
{% set build_num = 7 %}
{% set version_major = version.split(".")[0] %}
{% set version_minor = version.split(".")[1] %}
# blas_major denotes major infrastructural change to how blas is managed
Expand All @@ -25,11 +25,11 @@ source:
sha256: 4b9ba79bfd4921ca820e83979db76ab3363155709444a787979e81c22285ffa9
patches:
# Avoid setting current_version and compatibility_version
- patches/0001-Avoid-setting-current_version-and-compatibility_vers.patch # [osx]
# avoid linker errors on windows
- patches/0002-don-t-declare-RowMajorStrg-as-extern-on-windows.patch # [win]
# make xerbla-shenanigans work on windows
- patches/0003-use-__declspec-selectany-for-cblas_xerbla-s-RowMajor.patch # [win]
- patches/0001-Avoid-setting-current_version-and-compatibility_vers.patch
# backport https://github.com/Reference-LAPACK/lapack/pull/810
- patches/0002-cmake-allow-setting-a-prefix-for-the-library-names.patch
# make symbol RowMajorStrg visible through DLL boundary
- patches/0003-add-DLL-import-export-machinery-for-RowMajorStrg.patch

build:
number: {{ build_num }}
Expand All @@ -39,9 +39,10 @@ requirements:
- {{ stdlib("c") }}
- {{ compiler("c") }}
- {{ compiler("fortran") }}
- ninja # [win]
- make # [unix]
- cmake <4
- make # [unix]
- ninja # [win]
- m2-sed # [win]

outputs:
- name: libblas
Expand Down Expand Up @@ -69,7 +70,7 @@ outputs:
- lib/libblas.dylib # [osx]
- lib/libblas.{{ version_major }}.dylib # [osx]
- lib/libblas.{{ version }}.dylib # [osx]
- Library/bin/blas.dll # [win]
- Library/bin/libblas.dll # [win]
- Library/lib/blas.lib # [win]
test:
commands:
Expand Down Expand Up @@ -103,7 +104,7 @@ outputs:
- lib/libtmglib.dylib # [osx]
- lib/libtmglib.{{ version_major }}.dylib # [osx]
- lib/libtmglib.{{ version }}.dylib # [osx]
- Library/bin/tmglib.dll # [win]
- Library/bin/libtmglib.dll # [win]
- Library/lib/tmglib.lib # [win]
test:
commands:
Expand Down Expand Up @@ -136,7 +137,7 @@ outputs:
- lib/libcblas.dylib # [osx]
- lib/libcblas.{{ version_major }}.dylib # [osx]
- lib/libcblas.{{ version }}.dylib # [osx]
- Library/bin/cblas.dll # [win]
- Library/bin/libcblas.dll # [win]
- Library/lib/cblas.lib # [win]
test:
commands:
Expand Down Expand Up @@ -168,7 +169,7 @@ outputs:
- lib/liblapack.dylib # [osx]
- lib/liblapack.{{ version_major }}.dylib # [osx]
- lib/liblapack.{{ version }}.dylib # [osx]
- Library/bin/lapack.dll # [win]
- Library/bin/liblapack.dll # [win]
- Library/lib/lapack.lib # [win]
test:
commands:
Expand Down Expand Up @@ -203,7 +204,7 @@ outputs:
- lib/liblapacke.dylib # [osx]
- lib/liblapacke.{{ version_major }}.dylib # [osx]
- lib/liblapacke.{{ version }}.dylib # [osx]
- Library/bin/lapacke.dll # [win]
- Library/bin/liblapacke.dll # [win]
- Library/lib/lapacke.lib # [win]
test:
commands:
Expand Down Expand Up @@ -252,7 +253,7 @@ outputs:
- test -f $PREFIX/lib/pkgconfig/{{ each_lib }}.pc # [unix]
- if not exist %LIBRARY_LIB%\pkgconfig\{{ each_lib }}.pc exit 1 # [win]
- if not exist %LIBRARY_LIB%\{{ each_lib }}.lib exit 1 # [win]
- if not exist %LIBRARY_BIN%\{{ each_lib }}.dll exit 1 # [win]
- if not exist %LIBRARY_BIN%\lib{{ each_lib }}.dll exit 1 # [win]
{% endfor %}

# For compatiblity (see #33)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,71 +1,125 @@
From fe9cd54aaef1578716b3eadbaf72cc6cf560b68c Mon Sep 17 00:00:00 2001
From 74c8f25b773eb356c54e502175418495b36535b3 Mon Sep 17 00:00:00 2001
From: Isuru Fernando <isuruf@gmail.com>
Date: Thu, 22 Nov 2018 19:39:51 -0600
Subject: [PATCH 1/3] Avoid setting current_version and compatibility_version
on OSX

To facilitate the switching of implementations, avoid these appearing
in libblas.dylib etc., so that downstream consumers don't record them.
---
BLAS/SRC/CMakeLists.txt | 5 -----
CBLAS/src/CMakeLists.txt | 2 --
LAPACKE/CMakeLists.txt | 2 --
SRC/CMakeLists.txt | 5 -----
4 files changed, 14 deletions(-)
BLAS/SRC/CMakeLists.txt | 10 ++++++----
CBLAS/src/CMakeLists.txt | 9 +++++++--
LAPACKE/CMakeLists.txt | 9 +++++++--
SRC/CMakeLists.txt | 10 ++++++----
TESTING/MATGEN/CMakeLists.txt | 12 +++++++-----
5 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/BLAS/SRC/CMakeLists.txt b/BLAS/SRC/CMakeLists.txt
index 4e5894f4d..e89b73495 100644
index 4e5894f4d..ef7f13ca6 100644
--- a/BLAS/SRC/CMakeLists.txt
+++ b/BLAS/SRC/CMakeLists.txt
@@ -110,11 +110,6 @@ endif()
@@ -110,11 +110,13 @@ endif()
list(REMOVE_DUPLICATES SOURCES)

add_library(${BLASLIB} ${SOURCES})
-set_target_properties(
- ${BLASLIB} PROPERTIES
- VERSION ${LAPACK_VERSION}
- SOVERSION ${LAPACK_MAJOR_VERSION}
- )
+if(NOT APPLE)
+ set_target_properties(
+ ${BLASLIB} PROPERTIES
+ VERSION ${LAPACK_VERSION}
+ SOVERSION ${LAPACK_MAJOR_VERSION}
)
+endif()
lapack_install_library(${BLASLIB})

if( TEST_FORTRAN_COMPILER )
diff --git a/CBLAS/src/CMakeLists.txt b/CBLAS/src/CMakeLists.txt
index a8152297a..fc09e98f2 100644
index a8152297a..aded4feec 100644
--- a/CBLAS/src/CMakeLists.txt
+++ b/CBLAS/src/CMakeLists.txt
@@ -121,8 +121,6 @@ add_library(${CBLASLIB} ${SOURCES})
@@ -121,9 +121,14 @@ add_library(${CBLASLIB} ${SOURCES})
set_target_properties(
${CBLASLIB} PROPERTIES
LINKER_LANGUAGE C
- VERSION ${LAPACK_VERSION}
- SOVERSION ${LAPACK_MAJOR_VERSION}
+)
+if(NOT APPLE)
+ set_target_properties(
+ ${CBLASLIB} PROPERTIES
+ VERSION ${LAPACK_VERSION}
+ SOVERSION ${LAPACK_MAJOR_VERSION}
)
+endif()
if(HAS_ATTRIBUTE_WEAK_SUPPORT)
target_compile_definitions(${CBLASLIB} PRIVATE HAS_ATTRIBUTE_WEAK_SUPPORT)
endif()
diff --git a/LAPACKE/CMakeLists.txt b/LAPACKE/CMakeLists.txt
index e78079c0e..3b990fd2a 100644
index e78079c0e..eb3bb4d29 100644
--- a/LAPACKE/CMakeLists.txt
+++ b/LAPACKE/CMakeLists.txt
@@ -92,8 +92,6 @@ add_library(${LAPACKELIB} ${SOURCES})
@@ -92,9 +92,14 @@ add_library(${LAPACKELIB} ${SOURCES})
set_target_properties(
${LAPACKELIB} PROPERTIES
LINKER_LANGUAGE C
- VERSION ${LAPACK_VERSION}
- SOVERSION ${LAPACK_MAJOR_VERSION}
+)
+if(NOT APPLE)
+ set_target_properties(
+ ${LAPACKELIB} PROPERTIES
+ VERSION ${LAPACK_VERSION}
+ SOVERSION ${LAPACK_MAJOR_VERSION}
)
+endif()
target_include_directories(${LAPACKELIB} PUBLIC
$<BUILD_INTERFACE:${LAPACK_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
diff --git a/SRC/CMakeLists.txt b/SRC/CMakeLists.txt
index 5d2e07258..2b5d1f423 100644
index 5d2e07258..c10ba7b9d 100644
--- a/SRC/CMakeLists.txt
+++ b/SRC/CMakeLists.txt
@@ -515,11 +515,6 @@ endif()
@@ -515,11 +515,13 @@ endif()
list(REMOVE_DUPLICATES SOURCES)

add_library(${LAPACKLIB} ${SOURCES})
-set_target_properties(
- ${LAPACKLIB} PROPERTIES
- VERSION ${LAPACK_VERSION}
- SOVERSION ${LAPACK_MAJOR_VERSION}
- )
+if(NOT APPLE)
+ set_target_properties(
+ ${LAPACKLIB} PROPERTIES
+ VERSION ${LAPACK_VERSION}
+ SOVERSION ${LAPACK_MAJOR_VERSION}
)
+endif()

if( TEST_FORTRAN_COMPILER )
add_dependencies( ${LAPACKLIB} run_test_zcomplexabs run_test_zcomplexdiv run_test_zcomplexmult run_test_zminMax )
diff --git a/TESTING/MATGEN/CMakeLists.txt b/TESTING/MATGEN/CMakeLists.txt
index 0b3f89ed2..4a1297a20 100644
--- a/TESTING/MATGEN/CMakeLists.txt
+++ b/TESTING/MATGEN/CMakeLists.txt
@@ -49,11 +49,13 @@ list(REMOVE_DUPLICATES SOURCES)

add_library(${TMGLIB} ${SOURCES})

-set_target_properties(
- ${TMGLIB} PROPERTIES
- VERSION ${LAPACK_VERSION}
- SOVERSION ${LAPACK_MAJOR_VERSION}
-)
+if(NOT APPLE)
+ set_target_properties(
+ ${TMGLIB} PROPERTIES
+ VERSION ${LAPACK_VERSION}
+ SOVERSION ${LAPACK_MAJOR_VERSION}
+ )
+endif()

target_link_libraries(${TMGLIB} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
lapack_install_library(${TMGLIB})
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From 38f4f68a123d443b06951f4b5de4f694ba3f35b7 Mon Sep 17 00:00:00 2001
From: "Jose E. Roman" <jroman@dsic.upv.es>
Date: Sat, 1 Apr 2023 11:07:38 +0200
Subject: [PATCH 2/3] cmake: allow setting a prefix for the library names

---
CMakeLists.txt | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 68a7767b8..d2baecd11 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,10 @@ set(
${LAPACK_MAJOR_VERSION}.${LAPACK_MINOR_VERSION}.${LAPACK_PATCH_VERSION}
)

+# Allow setting a prefix for the library names
+set(CMAKE_STATIC_LIBRARY_PREFIX "lib${LIBRARY_PREFIX}")
+set(CMAKE_SHARED_LIBRARY_PREFIX "lib${LIBRARY_PREFIX}")
+
# Add the CMake directory for custom CMake modules
set(CMAKE_MODULE_PATH "${LAPACK_SOURCE_DIR}/CMAKE" ${CMAKE_MODULE_PATH})

Loading