forked from Prograda/Skybolt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
120 lines (100 loc) · 4.74 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
118
119
120
from conans import ConanFile, CMake
import os
class SkyboltConan(ConanFile):
name = "skybolt"
version = "1.5.0"
settings = "os", "compiler", "arch", "build_type"
options = {
"enable_bullet": [True, False],
"enable_fft_ocean": [True, False],
"enable_python": [True, False],
"enable_sprocket": [True, False],
"shared": [True, False],
"shared_plugins": [True, False], # Build plugins as shared libraries
"fPIC": [True, False]
}
default_options = {
"enable_bullet": False,
"enable_fft_ocean": True,
"enable_python": False,
"enable_sprocket": False,
"qt:shared": True, # Use shared Qt to avoid Qt's LGPL viral static linking
"qt:qtsvg":True, # Build the Qt SVG plugin to display Sprocket icons
"qwt:shared": True,
"shared": False,
"shared_plugins": True,
"fPIC": True
}
generators = ["cmake_paths", "cmake_find_package", "virtualrunenv"]
exports = "Conan/*"
exports_sources = "*"
no_copy_source = True
requires = [
"boost/1.75.0@_/_",
"catch2/2.13.8@_/_",
"cpp-httplib/0.10.1@_/_",
"earcut/2.2.3@_/_",
"glm/0.9.9.8@_/_",
"nlohmann_json/3.10.5@_/_",
"zlib/1.2.12@_/_" # Indirect dependency. Specified to resolve version clash between boost and freetype.
]
def include_package(self, name, version, subfolder=None):
currentDir = os.path.dirname(os.path.abspath(__file__))
recipes_path = os.path.join(currentDir, "Conan/Recipes", name)
if (subfolder):
recipes_path = os.path.join(recipes_path, subfolder)
self.run(("conan export . %s/%s@user/stable" % (name, version)), cwd=recipes_path)
self.requires(("%s/%s@user/stable" % (name, version)))
def configure(self):
self.options["openscenegraph-mr"].with_curl = True # Required for loading terrain tiles from http sources
self.options["bullet3"].double_precision = True
if self.settings.compiler == 'Visual Studio':
del self.options.fPIC
def requirements(self):
self.include_package("cxxtimer", "1.0.0")
self.include_package("px_sched", "1.0.0")
self.include_package("openscenegraph-mr", "3.7.0", "all")
if self.options.enable_bullet:
self.requires("bullet3/3.22a@_/_")
if self.options.enable_fft_ocean:
self.include_package("mufft", "1.0.0")
self.include_package("xsimd", "7.4.10")
if self.options.enable_python:
self.requires("pybind11/2.9.1@_/_")
if self.options.enable_sprocket:
self.requires("expat/2.4.8@_/_") # Indirect dependency. Specified to resolve version clash between wayland (used by Qt) and fontconfig (used by OSG)
self.requires("ois/1.5@_/_")
self.requires("qt/5.15.3@_/_")
self.requires("qwt/6.1.6@_/_")
self.include_package("toolwindowmanager", "1.0.0")
def build(self):
cmake = CMake(self)
cmake.definitions["Boost_STATIC_LIBS"] = str(not self.options["boost"].shared)
cmake.definitions["OSG_STATIC_LIBS"] = str(not self.options["openscenegraph-mr"].shared)
cmake.definitions["SKYBOLT_PLUGINS_STATIC_BUILD"] = str(not self.options.shared_plugins)
if "fPIC" in self.options:
cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.fPIC
if self.options.enable_bullet:
cmake.definitions["BUILD_BULLET_PLUGIN"] = "true"
if self.options.enable_fft_ocean:
cmake.definitions["BUILD_FFT_OCEAN_PLUGIN"] = "true"
if self.options.enable_python:
cmake.definitions["BUILD_PYTHON_BINDINGS"] = "true"
cmake.definitions["BUILD_PYTHON_COMPONENT_PLUGIN"] = "true"
if self.options.enable_sprocket:
cmake.definitions["BUILD_SEQUENCE_EDITOR_PLUGIN"] = "true"
cmake.definitions["BUILD_SPROCKET"] = "true"
cmake.definitions["CMAKE_TOOLCHAIN_FILE"] = "conan_paths.cmake"
cmake.configure()
cmake.build()
def package(self):
cmake = CMake(self)
cmake.install()
def package_info(self):
self.cpp_info.includedirs = ["include"]
self.cpp_info.names["cmake_find_package"] = "Skybolt"
self.cpp_info.libs = ["AircraftHud", "MapAttributesConverter", "SkyboltCommon", "SkyboltEngine", "SkyboltSim", "SkyboltVis"]
if self.options.enable_fft_ocean and not self.options.shared_plugins:
self.cpp_info.libs.append("FftOcean")
if self.options.enable_sprocket == True:
self.cpp_info.libs.append("Sprocket")