Skip to content

Commit ca03ade

Browse files
committed
vtd: Migrate cloe-plugin-vtd package to Conan 2.0 compatibility
1 parent 726fbf6 commit ca03ade

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

optional/vtd/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ find_package(cloe-runtime REQUIRED)
88
find_package(cloe-models REQUIRED)
99
find_package(Boost REQUIRED)
1010
find_package(open_simulation_interface REQUIRED)
11+
find_package(Protobuf REQUIRED)
1112

1213
add_library(vtd-object-lib STATIC
1314
src/omni_sensor_component.cpp
@@ -22,6 +23,10 @@ add_library(vtd-object-lib STATIC
2223
src/scp_messages.cpp
2324
src/scp_transceiver.cpp
2425
)
26+
target_include_directories(vtd-object-lib
27+
PRIVATE
28+
protobuf::libprotobuf
29+
)
2530
target_link_libraries(vtd-object-lib
2631
PUBLIC
2732
vtd::api

optional/vtd/conanfile.py

+5-13
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ class CloeSimulatorVTD(ConanFile):
1818
description = "Cloe simulator plugin that binds to Vires VTD"
1919
license = "Apache-2.0"
2020
settings = "os", "compiler", "build_type", "arch"
21-
options = {
22-
"pedantic": [True, False],
23-
}
24-
default_options = {
25-
"pedantic": True,
26-
}
2721
generators = "CMakeDeps", "VirtualRunEnv"
2822
no_copy_source = True
2923
exports_sources = [
@@ -37,6 +31,8 @@ class CloeSimulatorVTD(ConanFile):
3731
_setup_folder = "contrib/setups"
3832

3933
def set_version(self):
34+
# Check for both VERSION and ../../VERSION because when building inside
35+
# Docker only the plugin directory is exported.
4036
for version_path in ["VERSION", "../../VERSION"]:
4137
version_file = Path(self.recipe_folder) / version_path
4238
if version_file.exists():
@@ -73,7 +69,7 @@ def reset(tarinfo):
7369

7470
if not dir.is_dir():
7571
return
76-
# Compressing will add a timestamp to the package and therefore
72+
# Compressing will add a timestamp to the package and therefore
7773
# leads to different package_hashes everytime we export with conan.
7874
# To avoid that, changing from .tgz to .tar was necessary
7975
with tarfile.open(f"{dir.name}.tar", "w:") as tar:
@@ -107,7 +103,6 @@ def generate(self):
107103
tc = cmake.CMakeToolchain(self)
108104
tc.cache_variables["CMAKE_EXPORT_COMPILE_COMMANDS"] = True
109105
tc.cache_variables["CLOE_PROJECT_VERSION"] = self.version
110-
tc.cache_variables["TargetLintingExtended"] = self.options.pedantic
111106
tc.generate()
112107

113108
def build(self):
@@ -145,8 +140,5 @@ def package_info(self):
145140
self.cpp_info.set_property("cmake_find_mode", "both")
146141
self.cpp_info.set_property("cmake_file_name", "cloe-plugin-vtd")
147142
self.cpp_info.set_property("pkg_config_name", "cloe-plugin-vtd")
148-
self.env_info.VTD_LAUNCH = f"{self.package_folder}/bin/vtd-launch"
149-
self.env_info.VTD_SETUP_DIR = f"{self.package_folder}/{self._setup_folder}"
150-
151-
def package_id(self):
152-
del self.info.options.pedantic
143+
self.runenv_info.define("VTD_LAUNCH", f"{self.package_folder}/bin/vtd-launch")
144+
self.runenv_info.define("VTD_SETUP_DIR", f"{self.package_folder}/{self._setup_folder}")

0 commit comments

Comments
 (0)