[Faiss] Fix dependencies (#18780)

* fixed targets

* bumped port version

* updated sha

* lapack-reference should always write into lapack

* lapack-reference sha

* Fixed clapack target

* versions

* sha

* ensure cmake finds the cuda compiler

* sha
This commit is contained in:
bucurb 2021-07-16 20:03:54 +01:00 committed by GitHub
parent 0bf44b144b
commit 0f05959612
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 83 additions and 20 deletions

View File

@ -200,10 +200,11 @@ if(CLAPACK_FOUND AND NOT TARGET clapack::clapack)
endif()
endif()
if(CLAPACK_FOUND AND NOT TARGET lapack)
# Ensure consistency with both CMake's vanilla as well as lapack-reference's FindLAPACK.cmake module and register the LAPACK::LAPACK target
if(CLAPACK_FOUND AND NOT TARGET LAPACK::LAPACK)
if(EXISTS "${LAPACK_LIBRARY_RELEASE_DLL}")
add_library(lapack SHARED IMPORTED)
set_target_properties(lapack PROPERTIES
add_library(LAPACK::LAPACK SHARED IMPORTED)
set_target_properties(LAPACK::LAPACK PROPERTIES
IMPORTED_LOCATION_RELEASE "${LAPACK_LIBRARY_RELEASE_DLL}"
IMPORTED_IMPLIB_RELEASE "${oLAPACK_LIBRARY_RELEASE}"
INTERFACE_INCLUDE_DIRECTORIES "${LAPACK_INCLUDE_DIR}"
@ -211,23 +212,28 @@ if(CLAPACK_FOUND AND NOT TARGET lapack)
IMPORTED_CONFIGURATIONS Release
IMPORTED_LINK_INTERFACE_LANGUAGES "C")
if(EXISTS "${LAPACK_LIBRARY_DEBUG_DLL}")
set_property(TARGET lapack APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug)
set_target_properties(lapack PROPERTIES
set_property(TARGET LAPACK::LAPACK APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug)
set_target_properties(LAPACK::LAPACK PROPERTIES
IMPORTED_LOCATION_DEBUG "${LAPACK_LIBRARY_DEBUG_DLL}"
IMPORTED_IMPLIB_DEBUG "${oLAPACK_LIBRARY_DEBUG}")
endif()
else()
add_library(lapack UNKNOWN IMPORTED)
set_target_properties(lapack PROPERTIES
add_library(LAPACK::LAPACK UNKNOWN IMPORTED)
set_target_properties(LAPACK::LAPACK PROPERTIES
IMPORTED_LOCATION_RELEASE "${oLAPACK_LIBRARY_RELEASE}"
INTERFACE_INCLUDE_DIRECTORIES "${LAPACK_INCLUDE_DIR}"
IMPORTED_CONFIGURATIONS Release
INTERFACE_LINK_LIBRARIES "$<$<NOT:$<CONFIG:DEBUG>>:${oF2C_LIBRARY_RELEASE}>;$<$<CONFIG:DEBUG>:${oF2C_LIBRARY_DEBUG}>;$<$<NOT:$<CONFIG:DEBUG>>:${LAPACK_BLAS_LIBRARY_RELEASE}>;$<$<CONFIG:DEBUG>:${LAPACK_BLAS_LIBRARY_DEBUG}>;$<LINK_ONLY:${ADDITIONAL_LAPACK_LIBRARY}>;$<LINK_ONLY:${PTHREAD_LINK_NAME}>"
IMPORTED_LINK_INTERFACE_LANGUAGES "C")
if(EXISTS "${LAPACK_LIBRARY_DEBUG}")
set_property(TARGET lapack APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug)
set_target_properties(lapack PROPERTIES
set_property(TARGET LAPACK::LAPACK APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug)
set_target_properties(LAPACK::LAPACK PROPERTIES
IMPORTED_LOCATION_DEBUG "${oLAPACK_LIBRARY_DEBUG}")
endif()
endif()
endif()
# Preserve backwards compatibility and also register the 'lapack' target
if(CLAPACK_FOUND AND NOT TARGET lapack)
add_library(lapack ALIAS LAPACK::LAPACK)
endif()

View File

@ -1,7 +1,7 @@
{
"name": "clapack",
"version-string": "3.2.1",
"port-version": 18,
"port-version": 19,
"description": "CLAPACK (f2c'ed version of LAPACK)",
"homepage": "https://www.netlib.org/clapack",
"dependencies": [

View File

@ -0,0 +1,34 @@
diff --git a/cmake/faiss-config.cmake.in b/cmake/faiss-config.cmake.in
index 43ea9d4c..437a7f81 100644
--- a/cmake/faiss-config.cmake.in
+++ b/cmake/faiss-config.cmake.in
@@ -4,4 +4,7 @@
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
+find_dependency(OpenMP REQUIRED)
+find_dependency(BLAS REQUIRED)
+find_dependency(LAPACK REQUIRED)
include("${CMAKE_CURRENT_LIST_DIR}/faiss-targets.cmake")
diff --git a/faiss/CMakeLists.txt b/faiss/CMakeLists.txt
index 51680fd1..691f52c2 100644
--- a/faiss/CMakeLists.txt
+++ b/faiss/CMakeLists.txt
@@ -148,14 +148,14 @@ find_package(OpenMP REQUIRED)
target_link_libraries(faiss PRIVATE OpenMP::OpenMP_CXX)
find_package(MKL)
-if(MKL_FOUND)
+if(0)
target_link_libraries(faiss PRIVATE ${MKL_LIBRARIES})
else()
find_package(BLAS REQUIRED)
- target_link_libraries(faiss PRIVATE ${BLAS_LIBRARIES})
+ target_link_libraries(faiss PRIVATE BLAS::BLAS)
find_package(LAPACK REQUIRED)
- target_link_libraries(faiss PRIVATE ${LAPACK_LIBRARIES})
+ target_link_libraries(faiss PRIVATE LAPACK::LAPACK)
endif()
install(TARGETS faiss

View File

@ -6,12 +6,21 @@ vcpkg_from_github(
REF 0fb6c00cfa9487416b5cdf514f5f796476eecb06 # v1.6.4
SHA512 c7019615103fd29124c1f4458a47faebc5fe35545eea185c41cf643f2eabe82d134dc558c85f67faea7680c292abd7477ceefde157a7c3969eda78b77a23462b
HEAD_REF master
PATCHES
fix-dependencies.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
gpu FAISS_ENABLE_GPU
FEATURES
gpu FAISS_ENABLE_GPU
)
if ("${FAISS_ENABLE_GPU}")
if (NOT VCPKG_CMAKE_SYSTEM_NAME AND NOT ENV{CUDACXX})
set(ENV{CUDACXX} "$ENV{CUDA_PATH}/bin/nvcc.exe")
endif()
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA

View File

@ -1,6 +1,7 @@
{
"name": "faiss",
"version-string": "1.6.4",
"version-semver": "1.6.4",
"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",

View File

@ -1,6 +1,6 @@
Source: lapack-reference
Version: 3.8.0
Port-Version: 4
Port-Version: 5
Description: LAPACK — Linear Algebra PACKage http://www.netlib.org/lapack/
Default-Features: blas-select
Build-Depends: vcpkg-gfortran (windows)

View File

@ -137,7 +137,5 @@ if(VCPKG_TARGET_IS_WINDOWS)
endif()
endif()
if(NOT VCPKG_TARGET_IS_WINDOWS)
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)
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)

View File

@ -1266,7 +1266,7 @@
},
"clapack": {
"baseline": "3.2.1",
"port-version": 18
"port-version": 19
},
"clara": {
"baseline": "1.1.5",
@ -1926,7 +1926,7 @@
},
"faiss": {
"baseline": "1.6.4",
"port-version": 0
"port-version": 1
},
"fakeit": {
"baseline": "2.0.7",
@ -2966,7 +2966,7 @@
},
"lapack-reference": {
"baseline": "3.8.0",
"port-version": 4
"port-version": 5
},
"lastools": {
"baseline": "2020-05-09",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "bedf61cf9cf765a2c823e1f2427a16af6d8a711e",
"version-string": "3.2.1",
"port-version": 19
},
{
"git-tree": "229447785643f09b1a4ef53bab355ff3757e178e",
"version-string": "3.2.1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "eb401df0155a10cfc7cba057bbf63d10fdc37067",
"version-semver": "1.6.4",
"port-version": 1
},
{
"git-tree": "57552b56d2871ea87459fc655463067e1b02fcf3",
"version-string": "1.6.4",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "1887fc1fcb0c96df1ea24fffc9b045330426e3b6",
"version-string": "3.8.0",
"port-version": 5
},
{
"git-tree": "34971ac86a76f6bffefe5962980c3991abf87a58",
"version-string": "3.8.0",