-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
86 lines (69 loc) · 2.65 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
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env python3
from conan import ConanFile
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout
required_conan_version = ">=1.62.0"
# NOTE: The recipe used for conan-center-index is a copy of this
# file with the version removed! Make sure to copy changes
# in this file over to the conan-center-index recipe.
class SimfilRecipe(ConanFile):
name = "simfil"
version = "dev"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/Klebert-Engineering/simfil"
license = "BSD-3-Clause"
topics = ["query-language", "json", "data-model"]
# Binary configuration
settings = "os", "compiler", "build_type", "arch"
options = {
"shared": [True, False],
"fPIC": [True, False],
"with_json": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"with_json": True,
}
exports_sources = "CMakeLists.txt", "*.cmake", "include/*", "src/*"
def validate(self):
check_min_cppstd(self, "20")
def build_requirements(self):
self.tool_requires("cmake/[>3.19 <4]")
def requirements(self):
self.requires("sfl/[~1]", transitive_headers=True)
self.requires("fmt/10.0.0", transitive_headers=True)
self.requires("bitsery/[~5]", transitive_headers=True)
if self.options.with_json:
self.requires("nlohmann_json/[~3]", transitive_headers=True)
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def layout(self):
cmake_layout(self)
def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
def generate(self):
tc = CMakeToolchain(self)
tc.cache_variables["SIMFIL_CONAN"] = True
tc.cache_variables["SIMFIL_SHARED"] = bool(self.options.get_safe("shared"))
tc.cache_variables["SIMFIL_WITH_REPL"] = False
tc.cache_variables["SIMFIL_WITH_COVERAGE"] = False
tc.cache_variables["SIMFIL_WITH_TESTS"] = False
tc.cache_variables["SIMFIL_WITH_EXAMPLES"] = False
tc.cache_variables["SIMFIL_WITH_MODEL_JSON"] = bool(self.options.with_json)
tc.generate()
deps = CMakeDeps(self)
deps.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
cmake = CMake(self)
cmake.install()
def package_info(self):
self.cpp_info.libs = ["simfil"]
if self.options.with_json:
self.cpp_info.defines = ["SIMFIL_WITH_MODEL_JSON=1"]