forked from borgoat/conan-RocksDB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
75 lines (60 loc) · 2.46 KB
/
conanfile.py
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
from conans import ConanFile, AutoToolsBuildEnvironment, tools
import os
# https://github.com/giorgioazzinnaro/rocksdb/blob/master/INSTALL.md
class RocksdbConan(ConanFile):
name = "RocksDB"
version = "5.8"
license = "https://github.com/facebook/rocksdb/blob/master/COPYING"
url = "https://github.com/giorgioazzinnaro/conan-RocksDB"
description = "A library that provides an embeddable, persistent key-value store for fast storage."
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False]}
default_options = "shared=False"
generators = "cmake"
source_tgz = "https://github.com/facebook/rocksdb/archive/v%s.tar.gz" % version
requires = (
"zlib/1.2.11@conan/stable",
"bzip2/1.0.6@conan/stable",
"lz4/1.8.3@bincrafters/stable",
"snappy/1.1.7@bincrafters/stable",
"zstd/1.4.0@bincrafters/stable"
)
def source(self):
self.output.info("Downloading %s" %self.source_tgz)
tools.download(self.source_tgz, "rocksdb.tar.gz")
tools.unzip("rocksdb.tar.gz")
os.remove("rocksdb.tar.gz")
@property
def subfolder(self):
return "rocksdb-%s" % self.version
def build(self):
if tools.os_info.is_windows:
self.windows_build()
else:
self.unix_build()
def windows_build(self):
# TODO
True
def unix_build(self):
with tools.chdir(self.subfolder):
env_build = AutoToolsBuildEnvironment(self)
env_build.fpic = True
if self.settings.build_type == "Debug":
env_build.make() # $ make
else:
if self.options.shared:
env_build.make(["shared_lib"]) # $ make shared_lib
else:
env_build.make(["static_lib"]) # $ make static_lib
def package(self):
self.copy("LICENSE.Apache", src=self.subfolder, keep_path=False)
self.copy("LICENSE.leveldb", src=self.subfolder, keep_path=False)
self.copy("*.h", dst="include", src=("%s/include" % self.subfolder))
if self.options.shared:
self.copy("librocksdb.so", dst="lib", src=self.subfolder, keep_path=False)
else:
self.copy("librocksdb.a", dst="lib", src=self.subfolder, keep_path=False)
def package_info(self):
self.cpp_info.libs = ["rocksdb"]
if self.settings.os == "Linux":
self.cpp_info.libs.append("pthread")