Skip to content

Commit 7c4f852

Browse files
authored
faiss: update to 1.12.0 (#8434)
* faiss: update to 1.12.0 * update xmake.lua * Update xmake.lua
1 parent 192178c commit 7c4f852

File tree

1 file changed

+31
-13
lines changed

1 file changed

+31
-13
lines changed

packages/f/faiss/xmake.lua

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,52 @@
11
package("faiss")
2-
32
set_homepage("https://github.com/facebookresearch/faiss/")
43
set_description("A library for efficient similarity search and clustering of dense vectors.")
54
set_license("MIT")
65

76
add_urls("https://github.com/facebookresearch/faiss/archive/refs/tags/$(version).tar.gz",
87
"https://github.com/facebookresearch/faiss.git")
98
add_versions("v1.7.0", "f86d346ac9f409ee30abe37e52f6cce366b7f60d3924d65719f40aa07ceb4bec")
9+
add_versions("v1.12.0", "561376d1a44771bf1230fabeef9c81643468009b45a585382cf38d3a7a94990a")
10+
11+
add_configs("gpu", {description = "Enable support for GPU indexes.", default = false, type = "boolean"})
12+
add_configs("gpu_static", {description = "Link GPU libraries statically.", default = false, type = "boolean"})
13+
add_configs("mkl", {description = "Enable MKL.", default = false, type = "boolean"})
14+
add_configs("python", {description = "Build Python extension.", default = false, type = "boolean"})
15+
add_configs("c_api", {description = "Build C API.", default = false, type = "boolean"})
16+
add_configs("lto", {description = "Enable Link-Time optimization.", default = false, type = "boolean"})
1017

11-
add_deps("cmake")
12-
add_deps("cuda", {system = true, optional = true})
13-
add_deps("mkl", "cuda", {system = true, optional = true})
1418
if is_plat("linux") then
1519
add_syslinks("pthread")
1620
end
17-
on_load("windows|x64", "linux", function (package)
18-
if not find_package("mkl") then
21+
22+
add_deps("cmake", "openmp")
23+
on_load(function (package)
24+
if package:config("gpu") then
25+
package:add("deps", "cuda")
26+
end
27+
if package:config("mkl") then
28+
package:add("deps", "mkl", {system = true, optional = true})
29+
else
1930
package:add("deps", "openblas")
2031
end
2132
end)
2233

23-
on_install("windows|x64", "linux", function (package)
24-
io.replace("CMakeLists.txt", "add_subdirectory(demos)", "", {plain = true})
25-
io.replace("CMakeLists.txt", "add_subdirectory(tutorial/cpp)", "", {plain = true})
26-
local configs = {"-DFAISS_ENABLE_PYTHON=OFF", "-DBUILD_TESTING=OFF"}
27-
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
28-
table.insert(configs, "-DFAISS_ENABLE_GPU=" .. (package:dep("cuda"):exists() and "ON" or "OFF"))
34+
on_install("windows|x64", "linux", "macosx", function (package)
35+
local configs = {
36+
"-DBUILD_TESTING=OFF",
37+
"-DFAISS_ENABLE_EXTRAS=OFF",
38+
}
39+
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
40+
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
41+
table.insert(configs, "-DFAISS_ENABLE_GPU=" .. (package:config("gpu") and "ON" or "OFF"))
42+
table.insert(configs, "-DFAISS_GPU_STATIC=" .. (package:config("gpu_static") and "ON" or "OFF"))
43+
table.insert(configs, "-DFAISS_ENABLE_MKL=" .. (package:config("mkl") and "ON" or "OFF"))
44+
table.insert(configs, "-DFAISS_ENABLE_PYTHON=" .. (package:config("python") and "ON" or "OFF"))
45+
table.insert(configs, "-DFAISS_ENABLE_C_API=" .. (package:config("c_api") and "ON" or "OFF"))
46+
table.insert(configs, "-DFAISS_ENABLE_LTO=" .. (package:config("lto") and "ON" or "OFF"))
2947
import("package.tools.cmake").install(package, configs)
3048
end)
3149

3250
on_test(function (package)
33-
assert(package:has_cxxtypes("faiss::MultiIndexQuantizer", {configs = {languages = "c++11"}, includes = "faiss/IndexPQ.h"}))
51+
assert(package:has_cxxtypes("faiss::MultiIndexQuantizer", {configs = {languages = "c++17"}, includes = "faiss/IndexPQ.h"}))
3452
end)

0 commit comments

Comments
 (0)