1
1
# mypy: ignore-errors
2
2
# pylint: skip-file
3
3
4
- import os
5
4
from pathlib import Path
6
- from semver import SemVer
7
5
8
6
from conan import ConanFile
9
7
from conan .tools import cmake , files , scm
@@ -18,56 +16,22 @@ class Cloe(ConanFile):
18
16
description = "Closed-loop automated driving simulation environment"
19
17
topics = ["simulation" ]
20
18
settings = "os" , "compiler" , "build_type" , "arch"
21
- provides = (
22
- "fable" ,
23
- "cloe-runtime" ,
24
- "cloe-models" ,
25
- "cloe-oak" ,
26
- "cloe-engine" ,
27
- "cloe-plugins-core" ,
28
- "cloe-plugin-basic" ,
29
- "cloe-plugin-gndtruth-extractor" ,
30
- "cloe-plugin-minimator" ,
31
- "cloe-plugin-mocks" ,
32
- "cloe-plugin-noisy-sensor" ,
33
- "cloe-plugin-speedometer" ,
34
- "cloe-plugin-virtue" ,
35
- )
36
19
options = {
37
- "shared " : [True , False ],
38
- "fPIC " : [True , False ],
39
- "fable_allow_comments" : [ True , False ],
40
- "engine_server" : [ True , False ],
41
- "engine_lrdb " : [True , False ]
20
+ "with_vtd " : [True , False ],
21
+ "with_engine " : [True , False ],
22
+
23
+ # Doesn't affect package ID:
24
+ "pedantic " : [True , False ],
42
25
}
43
26
default_options = {
44
- "shared" : True ,
45
- "fPIC" : True ,
46
- "fable_allow_comments" : True ,
47
- "engine_server" : True ,
48
- "engine_lrdb" : True ,
49
- }
50
- generators = "CMakeDeps" , "VirtualRunEnv"
51
- no_copy_source = True
52
- exports_sources = [
53
- "*/cmake/*" ,
54
- "*/src/*" ,
55
- "*/include/*" ,
56
- "*/CMakeLists.txt" ,
27
+ "with_vtd" : False ,
28
+ "with_engine" : True ,
57
29
58
- "fable/examples/*" ,
30
+ "pedantic" : True ,
59
31
60
- "engine/lua/*" ,
61
- "engine/webui/*" ,
62
- "engine/vendor/*" ,
63
-
64
- "plugins/*/src/*" ,
65
- "plugins/*/include/*" ,
66
- "plugins/*/ui/*" ,
67
- "plugins/*/CMakeLists.txt" ,
68
-
69
- "CMakelists.txt"
70
- ]
32
+ "cloe-engine:server" : True ,
33
+ }
34
+ no_copy_source = True
71
35
72
36
def set_version (self ):
73
37
version_file = Path (self .recipe_folder ) / "VERSION"
@@ -78,120 +42,31 @@ def set_version(self):
78
42
self .version = git .run ("describe --dirty=-dirty" )[1 :]
79
43
80
44
def requirements (self ):
81
- self .requires ("fmt/9.1.0" )
82
- self .requires ("inja/3.4.0" )
83
- self .requires ("nlohmann_json/3.11.2" )
84
- self .requires ("incbin/cci.20211107" ),
85
- self .requires ("spdlog/1.11.0" )
86
- self .requires ("eigen/3.4.0" )
87
- self .requires ("cli11/2.3.2" , private = True )
88
- self .requires ("sol2/3.3.1" )
89
- self .requires ("boost/[>=1.65.1]" )
90
- if self .options .engine_server :
91
- self .requires ("oatpp/1.3.0" )
92
-
93
- def build_requirements (self ):
94
- self .test_requires ("gtest/1.13.0" )
95
-
96
- def layout (self ):
97
- cmake .cmake_layout (self )
98
- self .cpp .build .bindirs = ["bin" ]
99
- self .cpp .source .includedirs .append (os .path .join (self .folders .build , "include" ))
100
-
101
- def generate (self ):
102
- # The version as a single 32-bit number takes the format:
103
- #
104
- # (EPOCH << 24) | (MAJOR_VERSION << 16) | (MINOR_VERSION << 8) | PATCH_VERSION
105
- #
106
- # Each version consists of at most 8 bits, so 256 potential values, including 0.
107
- # The epoch starts with 0, and is bumped after each version naming scheme.
108
- semver = SemVer (self .version , True )
109
- version_u32 = (0 << 24 ) | (semver .major << 16 ) | (semver .minor << 8 ) | semver .patch
110
-
111
- tc = cmake .CMakeToolchain (self )
112
- tc .cache_variables ["CMAKE_EXPORT_COMPILE_COMMANDS" ] = True
113
- tc .cache_variables ["CMAKE_MODULE_PATH" ] = self .source_folder + "/runtime/cmake"
114
- tc .cache_variables ["FABLE_VERSION" ] = self .version
115
- tc .cache_variables ["FABLE_VERSION_U32" ] = version_u32
116
- tc .cache_variables ["FABLE_ALLOW_COMMENTS" ] = self .options .fable_allow_comments
117
- tc .cache_variables ["CLOE_PROJECT_VERSION" ] = self .version
118
- tc .cache_variables ["CLOE_VERSION" ] = self .version
119
- tc .cache_variables ["CLOE_VERSION_U32" ] = version_u32
120
- tc .cache_variables ["CLOE_ENGINE_WITH_SERVER" ] = self .options .engine_server
121
- tc .cache_variables ["CLOE_ENGINE_WITH_LRDB" ] = self .options .engine_lrdb
122
- tc .generate ()
123
-
124
- def build (self ):
125
- cm = cmake .CMake (self )
126
- if self .should_configure :
127
- cm .configure ()
128
- if self .should_build :
129
- cm .build ()
130
- if self .should_test :
131
- cm .test ()
132
-
133
- def package (self ):
134
- if self .should_install :
135
- cm = cmake .CMake (self )
136
- cm .install ()
137
-
138
- # Package license files for compliance
139
- for meta , dep in self .dependencies .items ():
140
- if dep .package_folder is None :
141
- continue
142
- ref = str (meta .ref )
143
- name = ref [: str (ref ).index ("/" )]
144
- files .copy (
145
- self ,
146
- "*" ,
147
- src = os .path .join (dep .package_folder , "licenses" ),
148
- dst = os .path .join (self .package_folder , "licenses" , name ),
149
- )
150
-
151
- def package_info (self ):
152
- self .cpp_info .set_property ("cmake_find_mode" , "both" )
153
- self .cpp_info .set_property ("cmake_file_name" , "cloe" )
154
- self .cpp_info .set_property ("pkg_config_name" , "cloe" )
155
-
156
- self .cpp_info .components ["fable" ].libs = ["fable" ]
157
- self .cpp_info .components ["fable" ].set_property ("cmake_file_name" , "fable" )
158
- self .cpp_info .components ["fable" ].set_property ("cmake_target_name" , "fable::fable" )
159
- self .cpp_info .components ["fable" ].set_property ("pkg_config_name" , "fable" )
160
-
161
- self .cpp_info .components ["runtime" ].libs = ["cloe-runtime" ]
162
- self .cpp_info .components ["runtime" ].requires = ["fable" ]
163
- self .cpp_info .components ["runtime" ].set_property ("cmake_file_name" , "cloe-runtime" )
164
- self .cpp_info .components ["runtime" ].set_property ("cmake_target_name" , "cloe::runtime" )
165
- self .cpp_info .components ["runtime" ].set_property ("pkg_config_name" , "cloe-runtime" )
166
-
167
- if self .settings .os == "Linux" :
168
- self .cpp_info .system_libs .append ("pthread" )
169
- self .cpp_info .system_libs .append ("dl" )
170
-
171
- # Linking to libstdc++fs is required on GCC < 9.
172
- # (GCC compilers with version < 7 have no std::filesystem support.)
173
- # No consideration has been made yet for other compilers,
174
- # please add them here as necessary.
175
- if self .settings .get_safe ("compiler" ) == "gcc" and self .settings .get_safe ("compiler.version" ) in ["7" , "8" ]:
176
- self .cpp_info .system_libs = ["stdc++fs" ]
177
-
178
- self .cpp_info .libs = files .collect_libs (self )
179
- if not self .in_local_cache : # editable build
180
- self .cpp_info .builddirs .append (os .path .join (self .source_folder , "cmake" ))
181
- self .cpp_info .includedirs .append (os .path .join (self .build_folder , "include" ))
182
- bindir = os .path .join (self .build_folder , "bin" )
183
- luadir = os .path .join (self .source_folder , "engine/lua" )
184
- libdir = os .path .join (self .build_folder , "lib" );
185
- else :
186
- self .cpp_info .builddirs .append (os .path .join ("lib" , "cmake" , "cloe" ))
187
- bindir = os .path .join (self .package_folder , "bin" )
188
- luadir = os .path .join (self .package_folder , "lib/cloe/lua" )
189
- libdir = None
190
-
191
- self .output .info (f"Appending PATH environment variable: { bindir } " )
192
- self .runenv_info .prepend_path ("PATH" , bindir )
193
- self .output .info (f"Appending CLOE_LUA_PATH environment variable: { luadir } " )
194
- self .runenv_info .prepend_path ("CLOE_LUA_PATH" , luadir )
195
- if libdir is not None :
196
- self .output .info (f"Appending LD_LIBRARY_PATH environment variable: { libdir } " )
197
- self .runenv_info .append_path ("LD_LIBRARY_PATH" , libdir )
45
+ def cloe_requires (dep ):
46
+ self .requires (f"{ dep } /{ self .version } @cloe/develop" )
47
+
48
+ cloe_requires ("cloe-runtime" )
49
+ cloe_requires ("cloe-models" )
50
+ cloe_requires ("cloe-plugin-basic" )
51
+ cloe_requires ("cloe-plugin-gndtruth-extractor" )
52
+ cloe_requires ("cloe-plugin-minimator" )
53
+ cloe_requires ("cloe-plugin-mocks" )
54
+ cloe_requires ("cloe-plugin-noisy-sensor" )
55
+ cloe_requires ("cloe-plugin-speedometer" )
56
+ cloe_requires ("cloe-plugin-virtue" )
57
+ if self .options .with_vtd :
58
+ cloe_requires ("cloe-plugin-vtd" )
59
+
60
+ boost_version = "[>=1.65.0]"
61
+ if self .options .with_engine :
62
+ cloe_requires ("cloe-engine" )
63
+
64
+ # Overrides:
65
+ self .requires ("fmt/9.1.0" , override = True )
66
+ self .requires ("inja/3.4.0" , override = True )
67
+ self .requires ("nlohmann_json/3.11.2" , override = True )
68
+ self .requires ("incbin/cci.20211107" , override = True ),
69
+ self .requires (f"boost/{ boost_version } " , override = True )
70
+
71
+ def package_id (self ):
72
+ del self .info .options .pedantic
0 commit comments