-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
117 lines (103 loc) · 5.12 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
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
#!/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
from conan.tools.files import copy, get
import os
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 MapgetRecipe(ConanFile):
name = "mapget"
version = "dev"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/ndsev/mapget"
license = "BSD-3-Clause"
topics = ["map"]
# Binary configuration
settings = "os", "compiler", "build_type", "arch"
options = {
"shared": [True, False],
"fPIC": [True, False],
"with_service": [True, False],
"with_httplib": [True, False],
"with_wheel": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"with_service": True,
"with_httplib": True,
"with_wheel": False,
"simfil/*:with_json": True,
"simfil/*:shared": False,
"cpp-httplib/*:with_openssl": True,
"cpp-httplib/*:with_zlib": True,
}
exports_sources = "CMakeLists.txt", "*.cmake", "libs/*", "apps/*", "test/*", "examples/*", "LICENSE"
def validate(self):
check_min_cppstd(self, "20")
def requirements(self):
self.requires("fmt/10.2.1", override=True)
self.requires("simfil/0.3.4", transitive_headers=True)
self.requires("spdlog/[~1]", transitive_headers=True)
self.requires("bitsery/[~5]")
# The override=True for is needed, until simfil 0.3.3 is released.
self.requires("nlohmann_json/3.11.3", override=True, transitive_headers=True)
self.requires("glm/cci.20230113", transitive_headers=True)
if self.options.with_httplib:
self.requires("cli11/2.3.2")
self.requires("cpp-httplib/0.15.3", transitive_headers=True)
self.requires("yaml-cpp/0.8.0")
self.requires("json-schema-validator/2.3.0")
self.requires("picosha2/cci.20220808", transitive_headers=True)
if self.options.with_service or self.options.with_httplib:
self.requires("rocksdb/9.1.0")
if self.options.with_wheel:
self.requires("pybind11/2.11.1")
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def layout(self):
cmake_layout(self)
def generate(self):
tc = CMakeToolchain(self)
tc.cache_variables["MAPGET_CONAN"] = True
tc.cache_variables["MAPGET_ENABLE_TESTING"] = False
tc.cache_variables["MAPGET_BUILD_EXAMPLES"] = False
tc.cache_variables["MAPGET_WITH_SERVICE"] = self.options.with_service
tc.cache_variables["MAPGET_WITH_HTTPLIB"] = self.options.with_httplib
tc.cache_variables["MAPGET_WITH_WHEEL"] = self.options.with_wheel
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()
copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
def package_info(self):
self.cpp_info.components["log"].libs = ["mapget-log"]
self.cpp_info.components["log"].set_property("cmake_target_name", "mapget::log")
self.cpp_info.components["log"].requires = ["spdlog::spdlog"]
self.cpp_info.components["model"].libs = ["mapget-model"]
self.cpp_info.components["model"].requires = ["log", "simfil::simfil", "nlohmann_json::nlohmann_json", "bitsery::bitsery", "glm::glm"]
self.cpp_info.components["model"].set_property("cmake_target_name", "mapget::model")
if self.options.with_service or self.options.with_httplib:
self.cpp_info.components["service"].libs = ["mapget-service"]
self.cpp_info.components["service"].set_property("cmake_target_name", "mapget::service")
self.cpp_info.components["service"].requires = ["log", "model", "rocksdb::rocksdb", "yaml-cpp::yaml-cpp"]
if self.options.with_httplib:
self.cpp_info.components["http-service"].libs = ["mapget-http-service"]
self.cpp_info.components["http-service"].set_property("cmake_target_name", "mapget::http-service")
self.cpp_info.components["http-service"].requires = ["service", "http-datasource", "cpp-httplib::cpp-httplib", "cli11::cli11"]
self.cpp_info.components["http-datasource"].libs = ["mapget-http-datasource"]
self.cpp_info.components["http-datasource"].set_property("cmake_target_name", "mapget::http-datasource")
self.cpp_info.components["http-datasource"].requires = ["model", "service", "cpp-httplib::cpp-httplib"]
if self.options.with_wheel:
self.cpp_info.components["pymapget"].libs = []
self.cpp_info.components["pymapget"].requires = ["model", "http-datasource", "pybind11::pybind11"]