[lapack-reference] Update, fixes (#28679)

* [cmake-user] Test FindLAPACK.cmake

* Minor cleanup

* Avoid release-only lib variable

* Fix usage of external blas

* Update to 3.11

* Add usage doc

* Update versions
This commit is contained in:
Kai Pastor 2023-01-04 21:37:43 +01:00 committed by GitHub
parent 1b5f1aacad
commit 85d7c82eef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 59 additions and 17 deletions

View File

@ -0,0 +1,21 @@
diff --git a/CMAKE/lapack-config-install.cmake.in b/CMAKE/lapack-config-install.cmake.in
index 7760960..102eb92 100644
--- a/CMAKE/lapack-config-install.cmake.in
+++ b/CMAKE/lapack-config-install.cmake.in
@@ -12,8 +12,14 @@ unset(_LAPACK_TARGET)
set(LAPACK_Fortran_COMPILER_ID "@CMAKE_Fortran_COMPILER_ID@")
# Report the blas and lapack raw or imported libraries.
-set(LAPACK_blas_LIBRARIES "@BLAS_LIBRARIES@")
+if("@USE_OPTIMIZED_BLAS@")
+ include(CMakeFindDependencyMacro)
+ find_dependency(BLAS) # For current build type
+ set(LAPACK_blas_LIBRARIES "${BLAS_LIBRARIES}")
+else()
+ set(LAPACK_blas_LIBRARIES "@BLASLIB@") # target carries link libraries
+endif()
set(LAPACK_lapack_LIBRARIES "@LAPACK_LIBRARIES@")
-set(LAPACK_LIBRARIES ${LAPACK_blas_LIBRARIES} ${LAPACK_lapack_LIBRARIES})
+set(LAPACK_LIBRARIES ${LAPACK_lapack_LIBRARIES}) # target carries link libraries
unset(_LAPACK_SELF_DIR)

View File

@ -8,18 +8,19 @@ if(EXISTS "${CURRENT_INSTALLED_DIR}/share/clapack/copyright")
message(FATAL_ERROR "Can't build ${PORT} if clapack is installed. Please remove clapack:${TARGET_TRIPLET}, and try to install ${PORT}:${TARGET_TRIPLET} again.")
endif()
vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION}
include(vcpkg_find_fortran)
SET(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
set(lapack_ver 3.10.1)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO "Reference-LAPACK/lapack"
REF "v${lapack_ver}"
SHA512 0500bbbb48483208c0a35b74972ff0059c389da6032824a2079637266a99fa980882eedf7f1fc490219ee4ff27812ac8c6afe118e25f40a9c2387e7b997762fb
REF "v${VERSION}"
SHA512 fc3258b9d91a833149a68a89c5589b5113e90a8f9f41c3a73fbfccb1ecddd92d9462802c0f870f1c3dab392623452de4ef512727f5874ffdcba6a4845f78fc9a
HEAD_REF master
PATCHES
cmake-config.patch
lapacke.patch
)
@ -51,7 +52,7 @@ endif()
set(VCPKG_CRT_LINKAGE_BACKUP ${VCPKG_CRT_LINKAGE})
vcpkg_find_fortran(FORTRAN_CMAKE)
if(VCPKG_USE_INTERNAL_Fortran)
if(VCPKG_CRT_LINKAGE_BACKUP STREQUAL static)
if(VCPKG_CRT_LINKAGE_BACKUP STREQUAL "static")
# If openblas has been built with static crt linkage we cannot use it with gfortran!
set(USE_OPTIMIZED_BLAS OFF)
#Cannot use openblas from vcpkg if we are building with gfortran here.
@ -59,21 +60,22 @@ if(VCPKG_USE_INTERNAL_Fortran)
message(FATAL_ERROR "Feature 'noblas' cannot be used without supplying an external fortran compiler")
endif()
endif()
else()
set(USE_OPTIMIZED_BLAS ON)
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
"-DUSE_OPTIMIZED_BLAS=${USE_OPTIMIZED_BLAS}"
"-DCMAKE_REQUIRE_FIND_PACKAGE_BLAS=${USE_OPTIMIZED_BLAS}"
"-DCBLAS=${CBLAS}"
${FORTRAN_CMAKE}
MAYBE_UNUSED_VARIABLES
CMAKE_REQUIRE_FIND_PACKAGE_BLAS
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME lapack-${lapack_ver} CONFIG_PATH lib/cmake/lapack-${lapack_ver}) #Should the target path be lapack and not lapack-reference?
vcpkg_cmake_config_fixup(PACKAGE_NAME lapack-${VERSION} CONFIG_PATH lib/cmake/lapack-${VERSION}) #Should the target path be lapack and not lapack-reference?
set(pcfile "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/lapack.pc")
if(EXISTS "${pcfile}")
@ -117,11 +119,7 @@ if("cblas" IN_LIST FEATURES)
endif()
vcpkg_fixup_pkgconfig()
# Handle copyright
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
# remove debug includes
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
if(VCPKG_TARGET_IS_WINDOWS)
if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/liblapack.lib")
@ -140,5 +138,9 @@ if(VCPKG_TARGET_IS_WINDOWS)
endif()
endif()
file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/lapack)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindLAPACK.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/lapack)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/lapack")
file(COPY "${CMAKE_CURRENT_LIST_DIR}/FindLAPACK.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/lapack")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View File

@ -0,0 +1,9 @@
lapack-reference provides CMake targets:
find_package(lapack CONFIG REQUIRED)
target_link_libraries(main PRIVATE lapack)
lapack-reference is compatible with built-in CMake targets:
find_package(LAPACK REQUIRED)
target_link_libraries(main PRIVATE LAPACK::LAPACK)

View File

@ -1,6 +1,6 @@
{
"name": "lapack-reference",
"version": "3.10.1",
"version": "3.11.0",
"description": "LAPACK - Linear Algebra PACKage",
"homepage": "http://www.netlib.org/lapack/",
"license": "BSD-3-Clause-Open-MPI",

View File

@ -91,6 +91,11 @@
"$package": "JPEG",
"name": "libjpeg-turbo"
},
{
"$package": "LAPACK",
"name": "lapack",
"platform": "!(uwp & arm)"
},
{
"$package": "LibLZMA",
"name": "liblzma"

View File

@ -3517,7 +3517,7 @@
"port-version": 0
},
"lapack-reference": {
"baseline": "3.10.1",
"baseline": "3.11.0",
"port-version": 0
},
"lastools": {

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "17a29c388c22fa340ab6c87b4df6ba6bad201de4",
"version": "3.11.0",
"port-version": 0
},
{
"git-tree": "44ad48321efe7014cd1dc7ab7b46516309e6c395",
"version": "3.10.1",