Skip to content

Commit 4f9f8af

Browse files
committed
feat: allow the developer to build the conan project in editable and non-editable mode.
Command for build: * editable: ``` conan install conanfile.py cloe/0.22.0-develop@cloe/develop --install-folder="build" --build=outdated && \ cmake --preset=debug && \ cmake --build --preset=debug ``` * non-editable: `conan create . cloe/develop`
1 parent 389e062 commit 4f9f8af

File tree

6 files changed

+80
-21
lines changed

6 files changed

+80
-21
lines changed

conanfile.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class Cloe(ConanFile):
3434
"cloe-plugin-noisy-sensor",
3535
"cloe-plugin-speedometer",
3636
"cloe-plugin-virtue",
37+
"cloe-databroker-bindings",
38+
"cloe-python-api"
3739
)
3840
options = {
3941
"shared": [True, False],
@@ -99,7 +101,7 @@ def requirements(self):
99101
if self.options.engine_server:
100102
self.requires("oatpp/1.3.0")
101103
if self.options.python_api:
102-
self.requires("pybind11/2.10.1")
104+
self.requires("pybind11/2.11.1")
103105

104106
def build_requirements(self):
105107
self.test_requires("gtest/1.13.0")
@@ -131,6 +133,7 @@ def generate(self):
131133
tc.cache_variables["CLOE_ENGINE_WITH_SERVER"] = self.options.engine_server
132134
tc.cache_variables["CLOE_ENGINE_WITH_LRDB"] = self.options.engine_lrdb
133135
tc.cache_variables["CLOE_PYTHON_API"] = self.options.python_api
136+
tc.cache_variables["PYTHON_BINDINGS_LOCAL_DEV"] = not self.in_local_cache
134137
tc.generate()
135138

136139
def build(self):
@@ -196,23 +199,26 @@ def package_info(self):
196199
self.cpp_info.includedirs.append(os.path.join(self.build_folder, "include"))
197200
bindir = os.path.join(self.build_folder, "bin")
198201
luadir = os.path.join(self.source_folder, "engine/lua")
199-
pydir = os.path.join(self.source_folder, "python/python_api")
202+
pydir = os.path.join(self.build_folder, "lib/cloe/python")
203+
py_path = os.path.join(self.source_folder, "python/python_api")
200204
libdir = os.path.join(self.build_folder, "lib")
201205
else:
202206
self.cpp_info.builddirs.append(os.path.join("lib", "cmake", "cloe"))
203207
bindir = os.path.join(self.package_folder, "bin")
204208
luadir = os.path.join(self.package_folder, "lib/cloe/lua")
205209
pydir = os.path.join(self.package_folder, "lib/cloe/python")
210+
py_path = pydir
206211
libdir = None
207212

208213
self.output.info(f"Appending PATH environment variable: {bindir}")
209214
self.runenv_info.prepend_path("PATH", bindir)
210215
self.output.info(f"Appending CLOE_LUA_PATH environment variable: {luadir}")
211216
self.runenv_info.prepend_path("CLOE_LUA_PATH", luadir)
212217
if libdir is not None:
218+
#TODO
213219
self.output.info(f"Appending LD_LIBRARY_PATH environment variable: {libdir}")
214220
self.runenv_info.append_path("LD_LIBRARY_PATH", libdir)
215221
if self.options.python_api:
216-
self.output.info(f"Appending PYHTONPATH and CLOE_PYTHON_BINDINGS environment variables: {pydir}")
217-
self.runenv_info.prepend_path("PYTHONPATH", str(pydir))
218-
self.runenv_info.prepend_path("CLOE_PYTHON_BINDINGS", str(pydir))
222+
self.output.info(f"Appending PYHTONPATH and BASIC_CLOE_PYTHON_BINDINGS environment variables: {pydir}")
223+
self.runenv_info.prepend_path("PYTHONPATH", str(py_path))
224+
self.runenv_info.prepend_path("BASIC_CLOE_PYTHON_BINDINGS", str(pydir))

plugins/basic/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ set_target_properties(_basic_bindings PROPERTIES
3232
CXX_STANDARD 17
3333
CXX_STANDARD_REQUIRED ON
3434
)
35+
36+
if(PYTHON_BINDINGS_LOCAL_DEV)
37+
set_target_properties(_basic_bindings
38+
PROPERTIES
39+
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cloe/python"
40+
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cloe/python"
41+
)
42+
endif()
43+
3544
install(TARGETS _basic_bindings LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/cloe/python)
3645

3746
include(CTest)

python/python_api/cloe/_runner.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ def log_level(self, value):
177177

178178
def bind_plugin_types(self, lib: Path):
179179
import importlib
180+
import importlib.util
180181
import sys
181182
components = str(lib.name).split('.')
182183
module_name = components[0]
@@ -194,11 +195,7 @@ def bind_plugin_types(self, lib: Path):
194195
def __init__(self, stack: Optional[Dict[str, Any]] = None):
195196
self.databroker_adapter = DataBrokerAdapter()
196197
self.driver = SimulationDriver(self.databroker_adapter)
197-
if "CLOE_PLUGIN_PATH" not in os.environ:
198-
# todo this is just here for debugging
199-
plugin_paths = ["/home/ohf4fe/dev/sil/cloe/build/linux-x86_64-gcc-8/Debug/lib/cloe"]
200-
else:
201-
plugin_paths = os.environ["CLOE_PLUGIN_PATH"].split(":")
198+
plugin_paths = os.environ["CLOE_PLUGIN_PATH"].split(":")
202199
full_config_stack = Stack(plugin_paths)
203200
if not stack:
204201
# todo this is just here for debugging
@@ -211,11 +208,11 @@ def __init__(self, stack: Optional[Dict[str, Any]] = None):
211208

212209
self._sim = _Simulation(full_config_stack, self.driver, uuid="123")
213210

214-
if "CLOE_PYTHON_BINDINGS" in os.environ:
211+
if "BASIC_CLOE_PYTHON_BINDINGS" in os.environ:
215212
import importlib.util
216213
import sys
217214
binding_libs = []
218-
for binding_dir in os.environ["CLOE_PYTHON_BINDINGS"].split(":"):
215+
for binding_dir in os.environ["BASIC_CLOE_PYTHON_BINDINGS"].split(":"):
219216
if len(str(binding_dir)) > 1:
220217
binding_path = Path(binding_dir)
221218
if binding_path.exists():

python/python_api/cloe/test/config_minimator_infinite.json

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,35 @@
1515
},
1616
"simulators": [
1717
{
18-
"binding": "minimator"
19-
// name is automatically "minimator"
18+
"binding": "minimator",
19+
"args": {
20+
"vehicles": {
21+
"ego1": {
22+
"ego_sensor_mockup": {
23+
"ego_object": {
24+
"velocity": 20.0,
25+
"position": {
26+
"x": 0.0,
27+
"y": 0.0,
28+
"z": 0.0
29+
}
30+
}
31+
},
32+
"object_sensor_mockup": {
33+
"objects": [
34+
{
35+
"velocity": 0.0,
36+
"position": {
37+
"x": 10.0,
38+
"y": 0.0,
39+
"z": 0.0
40+
}
41+
}
42+
]
43+
}
44+
}
45+
}
46+
}
2047
}
2148
],
2249
"vehicles": [

python/python_api/cloe/test/config_minimator_smoketest.json

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,37 @@
33
"include": [
44
"config_minimator_infinite.json"
55
],
6+
"logging": [
7+
{
8+
"name": "*",
9+
"level": "error"
10+
}
11+
],
612
"server": {
713
"listen": false,
814
"listen_port": 23456
915
},
1016
"triggers": [
11-
{"event": "virtue/failure", "action": "fail"},
1217
{
13-
"label": "Vehicle default should never move with the minimator binding.",
14-
"event": "default_speed/kmph=>0.0", "action": "fail"
18+
"event": "virtue/failure",
19+
"action": "fail"
1520
},
16-
{"event": "start", "action": "log=info: Running minimator/basic smoketest."},
17-
{"event": "start", "action": "realtime_factor=-1"},
18-
{"event": "time=60", "action": "succeed"}
21+
{
22+
"label": "Vehicle default should never move at a velocity greater that 72 kmph with the minimator binding.",
23+
"event": "default_speed/kmph=>80.0",
24+
"action": "fail"
25+
},
26+
{
27+
"event": "start",
28+
"action": "log=info: Running minimator/basic smoketest."
29+
},
30+
{
31+
"event": "start",
32+
"action": "realtime_factor=-1"
33+
},
34+
{
35+
"event": "time=60",
36+
"action": "succeed"
37+
}
1938
]
20-
}
39+
}

runtime/include/cloe/databroker/data_broker_meta_information.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <typeindex>
44
#include <any>
55
#include <unordered_map>
6+
#include <string>
67

78
namespace cloe {
89
/**

0 commit comments

Comments
 (0)