-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathconanfile.py
More file actions
131 lines (116 loc) · 3.59 KB
/
conanfile.py
File metadata and controls
131 lines (116 loc) · 3.59 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
from os.path import join
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import copy
from conan.tools.scm import Git
class DriftFrameworkConan(ConanFile):
name = "reduct-cpp"
license = "MIT"
author = "ReductSoftware UG"
url = "https://github.com/reduct-storage/reduct-cpp"
description = "Reduct Storage Client SDK for C++"
topics = ("reduct-storage", "http-client", "http-api")
settings = "os", "compiler", "build_type", "arch"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"cpp-httplib/*:with_openssl": True,
"cpp-httplib/*:with_zlib": True,
}
requires = (
"fmt/9.1.0",
"cpp-httplib/0.14.3",
"nlohmann_json/3.11.3",
"openssl/3.0.13",
"concurrentqueue/1.0.4",
)
def set_version(self):
if not self.version:
git = Git(self, self.recipe_folder)
self.version = git.run("describe --tags --always") + ".local"
def config_options(self):
if self.settings.get_safe("os") == "Windows":
self.options.rm_safe("fPIC")
def layout(self):
cmake_layout(self)
def generate(self):
deps = CMakeDeps(self)
deps.generate()
tc = CMakeToolchain(self)
tc.generate()
def export_sources(self):
if ".local" in self.version:
copy(
self,
"CMakeLists.txt",
src=self.recipe_folder,
dst=self.export_sources_folder,
)
copy(
self, "cmake/*", src=self.recipe_folder, dst=self.export_sources_folder
)
copy(self, "src/*", src=self.recipe_folder, dst=self.export_sources_folder)
def source(self):
if ".local" not in self.version:
git = Git(self)
git.clone(
url="https://github.com/reduct-storage/reduct-cpp.git", target="."
)
git.checkout(f"v{self.version}")
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
# headers
copy(
self,
"*.h",
src=join(self.source_folder, "src", "reduct"),
dst=join(self.package_folder, "include", "reduct"),
)
# binaries (Windows/MSVC uses per-config dirs like Release/Debug)
copy(
self,
"*.lib",
src=self.build_folder,
dst=join(self.package_folder, "lib"),
keep_path=False,
)
copy(
self,
"*.dll",
src=self.build_folder,
dst=join(self.package_folder, "bin"),
keep_path=False,
)
# unix
copy(
self,
"*.so*",
src=self.build_folder,
dst=join(self.package_folder, "lib"),
keep_path=False,
)
copy(
self,
"*.dylib",
src=self.build_folder,
dst=join(self.package_folder, "lib"),
keep_path=False,
)
copy(
self,
"*.a",
src=self.build_folder,
dst=join(self.package_folder, "lib"),
keep_path=False,
)
def package_info(self):
self.cpp_info.libs = ["reductcpp"]
self.cpp_info.set_property("cmake_file_name", "reductcpp")
self.cpp_info.set_property("cmake_target_name", "reductcpp::reductcpp")