Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lapacke] New port #42345

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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 ports/lapacke/cmake-config.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/LAPACKE/cmake/lapacke-config-install.cmake.in b/LAPACKE/cmake/lapacke-config-install.cmake.in
index 8e735c0..2fcf2e9 100644
--- a/LAPACKE/cmake/lapacke-config-install.cmake.in
+++ b/LAPACKE/cmake/lapacke-config-install.cmake.in
@@ -1,12 +1,10 @@
-# Compute locations from <prefix>/@{LIBRARY_DIR@/cmake/lapacke-<v>/<self>.cmake
+# Compute locations from <prefix>/@{LIBRARY_DIR@/share/lapacke/<self>.cmake
get_filename_component(_LAPACKE_SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_LAPACKE_PREFIX "${_LAPACKE_SELF_DIR}" PATH)
get_filename_component(_LAPACKE_PREFIX "${_LAPACKE_PREFIX}" PATH)
-get_filename_component(_LAPACKE_PREFIX "${_LAPACKE_PREFIX}" PATH)

# Load the LAPACK package with which we were built.
-set(LAPACK_DIR "${_LAPACKE_PREFIX}/@CMAKE_INSTALL_LIBDIR@/cmake/@LAPACKLIB@-@LAPACK_VERSION@")
-find_package(LAPACK NO_MODULE)
+find_package(LAPACK)

# Load lapacke targets from the install tree.
if(NOT TARGET @LAPACKELIB@)
17 changes: 17 additions & 0 deletions ports/lapacke/fix_prefix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c99d71a..7333110 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,12 @@ set(
${LAPACK_MAJOR_VERSION}.${LAPACK_MINOR_VERSION}.${LAPACK_PATCH_VERSION}
)

+if(WIN32)
+ set(CMAKE_STATIC_LIBRARY_PREFIX "")
+ set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
+ set(CMAKE_IMPORT_LIBRARY_PREFIX "")
+endif()
+
# Add the CMake directory for custom CMake modules
set(CMAKE_MODULE_PATH "${LAPACK_SOURCE_DIR}/CMAKE" ${CMAKE_MODULE_PATH})

48 changes: 48 additions & 0 deletions ports/lapacke/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO "Reference-LAPACK/lapack"
REF "v${VERSION}"
SHA512 fc3258b9d91a833149a68a89c5589b5113e90a8f9f41c3a73fbfccb1ecddd92d9462802c0f870f1c3dab392623452de4ef512727f5874ffdcba6a4845f78fc9a
HEAD_REF master
PATCHES
cmake-config.diff
fix_prefix.patch
lapacke.diff
)

# Fortran setup as in lapack-reference
set(VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT enabled)
include(vcpkg_find_fortran)
vcpkg_find_fortran(FORTRAN_CMAKE)
if(NOT VCPKG_TARGET_IS_WINDOWS)
set(ENV{FFLAGS} "$ENV{FFLAGS} -fPIC") # should come from toolchain
endif()

vcpkg_check_features(OUT_FEATURE_OPTIONS options
FEATURES
tmg LAPACKE_WITH_TMG
)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${options}
-DLAPACKE=ON
-DUSE_OPTIMIZED_BLAS=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_BLAS=ON
-DUSE_OPTIMIZED_LAPACK=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_LAPACK=ON
-DTEST_FORTRAN_COMPILER=OFF
)

vcpkg_cmake_install()

file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/lapack.pc" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/lapack.pc")
vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/cmake/lapack-${VERSION}" "${CURRENT_PACKAGES_DIR}/debug/lib/cmake/lapack-${VERSION}")
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/lapacke-${VERSION}")

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LAPACKE/LICENSE")
13 changes: 13 additions & 0 deletions ports/lapacke/tmglib.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 68a7767..8998200 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -420,6 +420,8 @@ if(BUILD_TESTING OR LAPACKE_WITH_TMG)
# Build and install TMG as part of LAPACKE targets (as opposed to LAPACK
# targets)
set(LAPACK_INSTALL_EXPORT_NAME ${LAPACKELIB}-targets)
+ else()
+ set(TMGLIB "")
endif()
endif()
add_subdirectory(TESTING/MATGEN)
27 changes: 27 additions & 0 deletions ports/lapacke/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "lapacke",
"version": "3.11.0",
"description": "Standard C language APIs for LAPACK",
"homepage": "https://netlib.org/lapack/lapacke.html",
"license": "BSD-3-Clause",
"dependencies": [
"lapack",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
{
"name": "vcpkg-gfortran",
"platform": "windows"
}
],
"features": {
"tmg": {
"description": "Build LAPACKE with tmglib routines."
}
}
}
10 changes: 10 additions & 0 deletions scripts/test_ports/vcpkg-ci-lapacke/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)

vcpkg_find_acquire_program(PKGCONFIG)

vcpkg_cmake_configure(
SOURCE_PATH "${CURRENT_PORT_DIR}/project"
OPTIONS
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
)
vcpkg_cmake_build()
14 changes: 14 additions & 0 deletions scripts/test_ports/vcpkg-ci-lapacke/project/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.10..3.30)
project(lapacke-test C Fortran)

find_package(lapacke CONFIG REQUIRED)

add_executable(main main.c)
target_link_libraries(main PRIVATE lapacke)

find_package(PkgConfig REQUIRED)
pkg_check_modules(pc_lapacke lapacke REQUIRED IMPORTED_TARGET)

# Fixme: Carry Fortran linker language eqivalent through pc files
#add_executable(main-pkgconfig main.c)
#target_link_libraries(main-pkgconfig PRIVATE PkgConfig::pc_lapacke)
18 changes: 18 additions & 0 deletions scripts/test_ports/vcpkg-ci-lapacke/project/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* Cf. https://netlib.org/lapack/lapacke.html */
#include <lapacke.h>

int main()
{
double a[5][3] = {1,1,1,2,3,4,3,5,2,4,2,5,5,4,3};
double b[5][2] = {-10,-3,12,14,14,12,16,16,18,16};

lapack_int m = 5;
lapack_int n = 3;
lapack_int nrhs = 2;
lapack_int lda = 3;
lapack_int ldb = 2;

lapack_int info = LAPACKE_dgels(LAPACK_ROW_MAJOR,'N',m,n,nrhs,*a,lda,*b,ldb);

return 0;
}
30 changes: 30 additions & 0 deletions scripts/test_ports/vcpkg-ci-lapacke/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "vcpkg-ci-lapacke",
"version-string": "ci",
"description": "Port to force features of lapacke within CI",
"homepage": "https://github.com/microsoft/vcpkg",
"license": "MIT",
"dependencies": [
"lapacke",
{
"name": "vcpkg-cmake",
"host": true
}
],
"default-features": [
"all"
],
"features": {
"all": {
"description": "Test all features",
"dependencies": [
{
"name": "lapacke",
"features": [
"tmg"
]
}
]
}
}
}
4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4196,6 +4196,10 @@
"baseline": "3.11.0",
"port-version": 6
},
"lapacke": {
"baseline": "3.11.0",
"port-version": 0
},
"lastools": {
"baseline": "2.0.3",
"port-version": 0
Expand Down
9 changes: 9 additions & 0 deletions versions/l-/lapacke.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "0f3e1bccf5401a23157fa49b37e9816fecc64c51",
"version": "3.11.0",
"port-version": 0
}
]
}
Loading