-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathextconf.rb
39 lines (34 loc) · 944 Bytes
/
extconf.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require "mkmf"
require "fileutils"
$CXXFLAGS += " -std=c++11 "
have_libsnappy = pkg_config("libsnappy") || have_library("snappy")
unless have_libsnappy
# build vendor/snappy
pwd = File.dirname File.expand_path __FILE__
dir = File.join pwd, "..", "vendor", "snappy"
Dir.chdir(dir) do
FileUtils.rm_rf "build"
FileUtils.mkdir_p "build"
Dir.chdir(File.join(dir, "build")) do
`cmake .. -DCMAKE_BUILD_TYPE=Release -DSNAPPY_BUILD_TESTS=OFF -DSNAPPY_BUILD_BENCHMARKS=OFF`
end
end
src = %w[
config.h
snappy-stubs-public.h
].map { |e| File.join dir, "build", e }
FileUtils.cp src, pwd, verbose: true
src = %w[
snappy-c.cc
snappy-c.h
snappy-internal.h
snappy-sinksource.cc
snappy-sinksource.h
snappy.cc
snappy.h
snappy-stubs-internal.cc
snappy-stubs-internal.h
].map { |e| File.join dir, e }
FileUtils.cp src, pwd, verbose: true
end
create_makefile "snappy_ext"