Skip to content

Commit 79b54db

Browse files
committed
Improved extconf setup
1 parent 0ffe4f0 commit 79b54db

9 files changed

Lines changed: 9 additions & 19 deletions

File tree

Rakefile

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,4 @@ task :remove_ext do
2525
end
2626
end
2727

28-
task :remove_obj do
29-
Dir["ext/faiss/*.o"].each do |path|
30-
File.unlink(path)
31-
end
32-
end
33-
34-
Rake::Task["build"].enhance [:remove_ext, :remove_obj]
35-
Rake::Task["compile"].enhance [:remove_obj]
36-
37-
CLEAN.include("vendor/faiss/**/*.o")
28+
Rake::Task["build"].enhance [:remove_ext]

ext/faiss/extconf.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
$LDFLAGS += " -Wl,-undefined,dynamic_lookup" if RbConfig::CONFIG["host_os"] =~ /darwin/i
2121

2222
$CXXFLAGS += " -std=c++17 $(optflags) -DFINTEGER=int"
23-
$CXXFLAGS += " -Wall -Wno-unused-parameter -Wno-unused-function -Wno-unused-variable -Wno-unused-private-field -Wno-deprecated-declarations -Wno-sign-compare"
23+
$CXXFLAGS += " -Wall -Wno-unused-parameter -Wno-unused-function -Wno-unused-variable -Wno-unused-local-typedefs -Wno-deprecated-declarations -Wno-sign-compare"
2424

2525
# -march=native not supported with ARM Mac
2626
default_optflags = RbConfig::CONFIG["host_os"] =~ /darwin/i && RbConfig::CONFIG["host_cpu"] =~ /arm|aarch64/i ? "" : " -march=native"
@@ -34,8 +34,7 @@
3434
vendor = File.expand_path("../../vendor/faiss", __dir__)
3535

3636
$srcs = Dir["{#{ext},#{vendor}/faiss,#{vendor}/faiss/{impl,invlists,utils}/**}/*.{cpp}"]
37-
$objs = $srcs.map { |v| v.sub(/cpp\z/, "o") }
3837
abort "Faiss not found" unless find_header("faiss/Index.h", vendor)
39-
$VPATH << vendor
38+
$VPATH += $srcs.filter_map { |v| File.dirname(v) if v.start_with?(vendor) }.uniq
4039

4140
create_makefile("faiss/ext")

ext/faiss/index_binary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <rice/rice.hpp>
1010

1111
#include "numo.hpp"
12-
#include "utils.h"
12+
#include "utils_rb.h"
1313

1414
void init_index_binary(Rice::Module& m) {
1515
Rice::define_class_under<faiss::IndexBinary>(m, "IndexBinary")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <rice/stl.hpp>
1919

2020
#include "numo.hpp"
21-
#include "utils.h"
21+
#include "utils_rb.h"
2222

2323
namespace Rice::detail {
2424
template<>

ext/faiss/kmeans.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <rice/rice.hpp>
66

77
#include "numo.hpp"
8-
#include "utils.h"
8+
#include "utils_rb.h"
99

1010
void init_kmeans(Rice::Module& m) {
1111
Rice::define_class_under<faiss::Clustering>(m, "Kmeans")

ext/faiss/pca_matrix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <rice/rice.hpp>
33

44
#include "numo.hpp"
5-
#include "utils.h"
5+
#include "utils_rb.h"
66

77
void init_pca_matrix(Rice::Module& m) {
88
Rice::define_class_under<faiss::PCAMatrix>(m, "PCAMatrix")

ext/faiss/product_quantizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <rice/rice.hpp>
44

55
#include "numo.hpp"
6-
#include "utils.h"
6+
#include "utils_rb.h"
77

88
void init_product_quantizer(Rice::Module& m) {
99
Rice::define_class_under<faiss::ProductQuantizer>(m, "ProductQuantizer")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <rice/rice.hpp>
22

33
#include "numo.hpp"
4-
#include "utils.h"
4+
#include "utils_rb.h"
55

66
size_t check_shape(const numo::NArray& objects, size_t k) {
77
auto ndim = objects.ndim();
File renamed without changes.

0 commit comments

Comments
 (0)