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

[blas][lapack] Reorganize lapack/blas metaport system #21479

Closed
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
3 changes: 1 addition & 2 deletions ports/blas/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
SET(VCPKG_POLICY_EMPTY_PACKAGE enabled)

# Make sure BLAS can be found
vcpkg_configure_cmake(SOURCE_PATH ${CURRENT_PORT_DIR}
OPTIONS -DCMAKE_PREFIX_PATH="${CURRENT_PACKAGES_DIR}")
vcpkg_configure_cmake(SOURCE_PATH "${CMAKE_CURRENT_LIST_DIR}" PREFER_NINJA)
2 changes: 1 addition & 1 deletion ports/blas/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "blas",
"version-string": "1",
"port-version": 1,
"port-version": 2,
"description": "Metapackage for packages which provide BLAS",
"dependencies": [
"openblas"
Expand Down
239 changes: 0 additions & 239 deletions ports/clapack/FindLAPACK.cmake

This file was deleted.

4 changes: 3 additions & 1 deletion ports/clapack/fix-ConfigFile.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ diff --git a/clapack-config.cmake.in b/clapack-config.cmake.in
index cd19f1d..49af4f0 100644
--- a/clapack-config.cmake.in
+++ b/clapack-config.cmake.in
@@ -1 +1 @@
@@ -1 +3 @@
-include("@CLAPACK_BINARY_DIR@/clapack-targets.cmake")
+include(CMakeFindDependencyMacro)
+find_dependency(BLAS)
+include("${CMAKE_CURRENT_LIST_DIR}/clapack-targets.cmake")
7 changes: 4 additions & 3 deletions ports/clapack/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,14 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
vcpkg_copy_pdbs()

#TODO: fix the official exported targets, since they are broken (luckily it seems that no-one uses them for now)
vcpkg_fixup_cmake_targets(CONFIG_PATH share/clapack)

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

# Install clapack wrappers.
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/lapack)
file(INSTALL ${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)

# Handle copyright
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" @ONLY)
4 changes: 4 additions & 0 deletions ports/clapack/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The package @PORT@:@TARGET_TRIPLET@ provides an implementation of LAPACK for CMake:

find_package(LAPACK REQUIRED)
target_link_libraries(main PRIVATE LAPACK::LAPACK)
32 changes: 21 additions & 11 deletions ports/clapack/vcpkg-cmake-wrapper.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
message(STATUS "Using VCPKG FindLAPACK from package 'clapack'")
set(LAPACK_PREV_MODULE_PATH ${CMAKE_MODULE_PATH})
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})

list(REMOVE_ITEM ARGS "NO_MODULE")
list(REMOVE_ITEM ARGS "CONFIG")
list(REMOVE_ITEM ARGS "MODULE")

_find_package(${ARGS})

set(CMAKE_MODULE_PATH ${LAPACK_PREV_MODULE_PATH})
if(NOT clapack_FOUND)
set(NEW_ARGS "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add :
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW)

if("REQUIRED" IN_LIST ARGS)
list(APPEND NEW_ARGS "REQUIRED")
endif()
if("QUIET" IN_LIST ARGS)
list(APPEND NEW_ARGS "QUIET")
else()
message(STATUS "Using Lapack from vcpkg package 'clapack'")
endif()
_find_package(clapack CONFIG ${NEW_ARGS})
if(clapack_FOUND)
set(LAPACK_FOUND TRUE)
set(LAPACK95_FOUND TRUE)
add_library(LAPACK::LAPACK IMPORTED INTERFACE)
target_link_libraries(LAPACK::LAPACK INTERFACE lapack)
set(LAPACK_LINKER_FLAGS "")
set(LAPACK_LIBRARIES "lapack")
set(LAPACK95_LIBRARIES "")
endif()
endif()
2 changes: 1 addition & 1 deletion ports/clapack/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "clapack",
"version-string": "3.2.1",
"port-version": 19,
"port-version": 20,
"description": "CLAPACK (f2c'ed version of LAPACK)",
"homepage": "https://www.netlib.org/clapack",
"dependencies": [
Expand Down
3 changes: 2 additions & 1 deletion ports/faiss/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "faiss",
"version-semver": "1.7.1",
"port-version": 1,
"description": "Faiss is a library for efficient similarity search and clustering of dense vectors.",
"homepage": "https://github.com/facebookresearch/faiss",
"license": "MIT",
"supports": "!uwp & !osx & !x86",
"dependencies": [
"lapack",
"openblas",
"blas",
{
"name": "vcpkg-cmake",
"host": true
Expand Down
Loading