Skip to content

Commit c16fab7

Browse files
committed
esmini: Move from optional to base
The optional directory contains projects that are hard to build. ESMini does not fall into this category, since the sources are freely available. This commit does the following: - Move optional/esmini to plugins/esmini - Move optional/osi to osi - Replace Conan recipe for vendor/esmini and vendor/esmini-data - Replace Conan recipe for vendor/open-simulation-interface - Patch the esmini and osi Cloe libraries for compatibility with new open-simulation-interface. In particular, the generated headers are now namespaced with osi3/ - Fix several findings in esmini and osi Cloe libraries highlighted by clang-tidy. The vendored libraries are written in a manner similar to how it is done in the Conan-Center-Index.
1 parent ddff0cb commit c16fab7

File tree

90 files changed

+3153
-1283
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+3153
-1283
lines changed

.github/workflows/build-cloe.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- "cloe-normal"
2323
package_target:
2424
# 1. Build each test configuration in Conan cache and run all tests
25-
- "export smoketest-deps smoketest"
25+
- "export export-vendor smoketest-deps smoketest"
2626
env:
2727
CONAN_NON_INTERACTIVE: "yes"
2828
DEBIAN_FRONTEND: noninteractive

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ setup.sh
77
# Standard out-of-source build
88
build/
99

10+
# Vendored Conan recipes sometimes extract fetched sources
11+
vendor/**/src/
12+
1013
# Documentation
1114
docs/_build/
1215
docs/_extra/

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ WORKDIR /cloe
6969
SHELL ["/bin/bash", "-c"]
7070

7171
ARG PROJECT_VERSION=unknown
72-
ARG PACKAGE_TARGET="export smoketest-deps"
72+
ARG PACKAGE_TARGET="export-vendor export smoketest-deps"
7373
ARG KEEP_SOURCES=0
7474

7575
COPY . /cloe

Makefile.all

+17-11
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ SUBMAKEFLAGS :=
3737

3838
META_PKG := cloe
3939
PLUGIN_PKGS := $(wildcard plugins/*)
40-
ALL_PKGS := fable runtime models oak engine ${PLUGIN_PKGS} ${META_PKG}
40+
ALL_PKGS := fable runtime models oak osi engine ${PLUGIN_PKGS} ${META_PKG}
4141
WITHOUT_PKGS :=
4242
UNSELECT_PKGS := ${WITHOUT_PKGS}
4343
WITH_PKGS :=
@@ -48,7 +48,7 @@ SELECT_PKGS := $(call uniq, $(filter-out ${UNSELECT_PKGS}, ${ALL_PKGS}) ${WITH_P
4848
##
4949
## Functions analogously to normal package selection.
5050
##
51-
ALL_VENDOR :=
51+
ALL_VENDOR := $(wildcard vendor/*)
5252
WITHOUT_VENDOR :=
5353
UNSELECT_VENDOR := ${WITHOUT_VENDOR}
5454
WITH_VENDOR :=
@@ -61,7 +61,13 @@ runtime: fable
6161
models: runtime
6262
oak: runtime
6363
engine: models oak
64+
osi: runtime models vendor/open-simulation-interface
6465
${PLUGIN_PKGS}: runtime models
66+
plugins/esmini: vendor/open-simulation-interface vendor/esmini
67+
68+
vendor/esmini: vendor/open-simulation-interface
69+
vendor/esmini-data:
70+
vendor/open-simulation-interface:
6571

6672
## BUILD_POLICY
6773
## Usage: make BUILD_POLICY="missing"
@@ -119,9 +125,9 @@ ${META_PKG}:
119125
done
120126

121127
# Usage: $(call make_vendor_target, TARGET-NAME, HELP-DESCRIPTION, HELP-CATEGORY)
122-
# define make_vendor_target
123-
# $(eval $(call _make_target_rules,${1},${2},${3},${SELECT_VENDOR}))
124-
# endef
128+
define make_vendor_target
129+
$(eval $(call _make_target_rules,${1},${2},${3},${SELECT_VENDOR}))
130+
endef
125131

126132
# Usage: $(call make_every_target, TARGET-NAME, HELP-DESCRIPTION, HELP-CATEGORY)
127133
define make_every_target
@@ -141,9 +147,9 @@ endef
141147
help::
142148
$(call print_help_section, "Available build targets")
143149

144-
# $(call make_vendor_target, export-vendor, "export all vendor packages", "[conan-cache]")
145-
# $(call make_vendor_target, package-vendor, "create all vendor packages", "[conan-cache]")
146-
# $(call make_vendor_target, download-vendor, "download or build vendor packages", "[conan-cache]")
150+
$(call make_vendor_target, export-vendor, "export all vendor packages", "[conan-cache]")
151+
$(call make_vendor_target, package-vendor, "create all vendor packages", "[conan-cache]")
152+
$(call make_vendor_target, download-vendor, "download or build vendor packages", "[conan-cache]")
147153

148154
help::
149155
echo
@@ -179,15 +185,15 @@ $(call make_select_target, clean-select, "remove build artifacts", "[in-source]"
179185
help::
180186
echo
181187
$(call print_help_subsection, "Options")
182-
# $(call print_help_option, WITH_VENDOR, "", "include optional vendor packages from ${_grn}UNSELECT_VENDOR${_rst}")
188+
$(call print_help_option, WITH_VENDOR, "", "include optional vendor packages from ${_grn}UNSELECT_VENDOR${_rst}")
183189
$(call print_help_option, WITH_PKGS, "", "include optional packages from ${_grn}UNSELECT_PKGS${_rst}")
184190
$(call print_help_option, LOCKFILE_SOURCE, "", "use specified conanfile as lockfile source for build")
185191
echo
186192
$(call print_help_subsection, "Defines")
187193
$(call print_help_option, BUILD_POLICY, ${BUILD_POLICY})
188194
$(call print_help_define, CONAN_OPTIONS, ${CONAN_OPTIONS})
189-
# $(call print_help_define_lines, UNSELECT_VENDOR, ${UNSELECT_VENDOR})
190-
# $(call print_help_define_lines, SELECT_VENDOR, ${SELECT_VENDOR})
195+
$(call print_help_define_lines, UNSELECT_VENDOR, ${UNSELECT_VENDOR})
196+
$(call print_help_define_lines, SELECT_VENDOR, ${SELECT_VENDOR})
191197
$(call print_help_define_lines, UNSELECT_PKGS, ${UNSELECT_PKGS})
192198
$(call print_help_define_lines, SELECT_PKGS, ${SELECT_PKGS})
193199
echo

conanfile.py

+39-164
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# mypy: ignore-errors
22
# pylint: skip-file
33

4-
import os
54
from pathlib import Path
6-
from semver import SemVer
75

86
from conan import ConanFile
97
from conan.tools import cmake, files, scm
@@ -18,56 +16,22 @@ class Cloe(ConanFile):
1816
description = "Closed-loop automated driving simulation environment"
1917
topics = ["simulation"]
2018
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-
)
3619
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],
4225
}
4326
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,
5729

58-
"fable/examples/*",
30+
"pedantic": True,
5931

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
7135

7236
def set_version(self):
7337
version_file = Path(self.recipe_folder) / "VERSION"
@@ -78,120 +42,31 @@ def set_version(self):
7842
self.version = git.run("describe --dirty=-dirty")[1:]
7943

8044
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

optional/esmini/.gitignore

-1
This file was deleted.

optional/esmini/Makefile

-43
This file was deleted.

optional/esmini/README.md

-15
This file was deleted.

0 commit comments

Comments
 (0)