Skip to content

Commit dca0ef8

Browse files
committed
vtd: Migrate open-simulation-interface to Conan 2.0 compatibility
The packages are now fully forward compatible with those from the Conan Center Index. This means we can swap with other versions of open-simulation-interface from the CCI without any other changes. BREAKING CHANGES: - Conan recipe requires Conan >= 1.60 - When including library in CMakeLists.txt, you now need to use: find_package(open_simulation_interface REQUIRED) - When referring to target in CMakeLists.txt, you need to refer to: open_simulation_interface::open_simulation_interface - When including headers, the osi headers are now in the osi3 folder: #include <osi3/osi_ground_truth.pb.h>
1 parent 7bea95b commit dca0ef8

22 files changed

+655
-270
lines changed

optional/vtd/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ find_package(vtd-api REQUIRED)
77
find_package(cloe-runtime REQUIRED)
88
find_package(cloe-models REQUIRED)
99
find_package(Boost REQUIRED)
10-
find_package(open-simulation-interface REQUIRED)
10+
find_package(open_simulation_interface REQUIRED)
1111

1212
add_library(vtd-object-lib STATIC
1313
src/omni_sensor_component.cpp
@@ -28,7 +28,7 @@ target_link_libraries(vtd-object-lib
2828
cloe::runtime
2929
cloe::models
3030
Boost::boost
31-
open-simulation-interface::open-simulation-interface
31+
open_simulation_interface::open_simulation_interface
3232
)
3333

3434
set_target_properties(vtd-object-lib PROPERTIES

optional/vtd/src/osi_ground_truth.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#include <cloe/simulator.hpp> // for ModelError
2626

27-
#include "osi_object.pb.h" // for MovingObject
27+
#include <osi3/osi_object.pb.h> // for MovingObject
2828

2929
namespace osii {
3030

optional/vtd/src/osi_ground_truth.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626

2727
#include <cloe/simulator.hpp> // for ModelError
2828

29-
#include "osi_groundtruth.pb.h" // for GroundTruth
30-
#include "osi_object.pb.h" // for MovingObject
29+
#include <osi3/osi_groundtruth.pb.h> // for GroundTruth
30+
#include <osi3/osi_object.pb.h> // for MovingObject
3131

3232
#include "osi_utils.hpp" // for osi_require, ..
3333

optional/vtd/src/osi_omni_sensor.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@
3535
#include <cloe/simulator.hpp> // for ModelError
3636
#include <cloe/utility/geometry.hpp> // for quaternion_from_rpy
3737

38-
#include "osi_common.pb.h" // for Timestamp, Identifier, BaseMoving, ..
39-
#include "osi_detectedobject.pb.h" // for DetectedMovingObject
40-
#include "osi_hostvehicledata.pb.h" // for HostVehicleData
41-
#include "osi_object.pb.h" // for MovingObject
42-
#include "osi_sensordata.pb.h" // for SensorData, DetectedEntityHeader
43-
#include "osi_sensorview.pb.h" // for SensorView
38+
#include <osi3/osi_common.pb.h> // for Timestamp, Identifier, BaseMoving, ..
39+
#include <osi3/osi_detectedobject.pb.h> // for DetectedMovingObject
40+
#include <osi3/osi_hostvehicledata.pb.h> // for HostVehicleData
41+
#include <osi3/osi_object.pb.h> // for MovingObject
42+
#include <osi3/osi_sensordata.pb.h> // for SensorData, DetectedEntityHeader
43+
#include <osi3/osi_sensorview.pb.h> // for SensorView
4444

4545
#include "osi_ground_truth.hpp" // for OsiGroundTruth
4646
#include "osi_utils.hpp" // for osi_require, ..

optional/vtd/src/osi_omni_sensor.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@
3535
#include <cloe/simulator.hpp> // for ModelError
3636
#include <cloe/sync.hpp> // for Sync
3737

38-
#include "osi_common.pb.h" // for Timestamp, Identifier, BaseMoving, ..
39-
#include "osi_detectedobject.pb.h" // for DetectedMovingObject
40-
#include "osi_hostvehicledata.pb.h" // for HostVehicleData
41-
#include "osi_object.pb.h" // for MovingObject
42-
#include "osi_sensordata.pb.h" // for SensorData, DetectedEntityHeader
38+
#include <osi3/osi_common.pb.h> // for Timestamp, Identifier, BaseMoving, ..
39+
#include <osi3/osi_detectedobject.pb.h> // for DetectedMovingObject
40+
#include <osi3/osi_hostvehicledata.pb.h> // for HostVehicleData
41+
#include <osi3/osi_object.pb.h> // for MovingObject
42+
#include <osi3/osi_sensordata.pb.h> // for SensorData, DetectedEntityHeader
4343

4444
#include "osi_ground_truth.hpp" // for OsiGroundTruth
4545
#include "osi_transceiver.hpp" // for OsiTransceiver

optional/vtd/src/osi_test.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
#include <cloe/component/object.hpp> // for Object
3232
#include <cloe/utility/geometry.hpp> // for quaternion_from_rpy
3333

34-
#include "osi_common.pb.h" // for Orientation3D, BaseMoving, ..
35-
#include "osi_object.pb.h" // for MovingObject
34+
#include <osi3/osi_common.pb.h> // for Orientation3D, BaseMoving, ..
35+
#include <osi3/osi_object.pb.h> // for MovingObject
3636

3737
#include "osi_omni_sensor.hpp" // for transform_ego_coord_from_osi_data, ...
3838
#include "osi_utils.hpp" // for pose_to_osi_position_orientation, ...

optional/vtd/src/osi_transceiver.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
#include <cloe/core.hpp> // for Json, Error
2929

30-
#include <osi_sensordata.pb.h> // for SensorData
30+
#include <osi3/osi_sensordata.pb.h> // for SensorData
3131

3232
namespace osii {
3333

optional/vtd/src/osi_transceiver_tcp.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include <google/protobuf/io/coded_stream.h> // for CodedInputStream
3232
#include <google/protobuf/io/zero_copy_stream_impl_lite.h> // for ArrayInputStream
3333

34-
#include "osi_sensordata.pb.h" // for SensorData
34+
#include <osi3/osi_sensordata.pb.h> // for SensorData
3535

3636
namespace osii {
3737

optional/vtd/src/osi_transceiver_tcp.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include <cloe/core.hpp> // for Json, Logger
3232
#include <cloe/utility/tcp_transceiver.hpp> // for TcpTransceiver
3333

34-
#include "osi_sensordata.pb.h" // for SensorData
34+
#include <osi3/osi_sensordata.pb.h> // for SensorData
3535

3636
#include "osi_transceiver.hpp" // for OsiTransceiver
3737
#include "osi_utils.hpp" // for osi_logger

optional/vtd/src/osi_utils.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030

3131
#include <cloe/utility/geometry.hpp> // for quaternion_from_rpy
3232

33-
#include "osi_common.pb.h" // for Timestamp, Identifier, BaseMoving, ..
34-
#include "osi_sensordata.pb.h" // for SensorData, DetectedEntityHeader
33+
#include <osi3/osi_common.pb.h> // for Timestamp, Identifier, BaseMoving, ..
34+
#include <osi3/osi_sensordata.pb.h> // for SensorData, DetectedEntityHeader
3535

3636
namespace osii {
3737

optional/vtd/src/osi_utils.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
#include <cloe/core.hpp> // for Logger, get
3030
#include <cloe/simulator.hpp> // for ModelError
3131

32-
#include "osi_common.pb.h" // for Dimension3d, Vector3d, ..
33-
#include "osi_sensordata.pb.h" // for SensorData
32+
#include <osi3/osi_common.pb.h> // for Dimension3d, Vector3d, ..
33+
#include <osi3/osi_sensordata.pb.h> // for SensorData
3434

3535
#undef osi_require
3636

optional/vtd/src/vtd_osi_test.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
#include <cloe/core/duration.hpp> // for Duration
3030
#include <cloe/utility/geometry.hpp> // for quaternion_from_rpy
3131

32-
#include "osi_common.pb.h" // for Timestamp, Identifier, BaseMoving, ..
33-
#include "osi_detectedobject.pb.h" // for DetectedMovingObject
34-
#include "osi_groundtruth.pb.h" // for GroundTruth
35-
#include "osi_object.pb.h" // for MovingObject
36-
#include "osi_sensordata.pb.h" // for SensorData, DetectedEntityHeader
37-
#include "osi_sensorview.pb.h" // for SensorView
32+
#include <osi3/osi_common.pb.h> // for Timestamp, Identifier, BaseMoving, ..
33+
#include <osi3/osi_detectedobject.pb.h> // for DetectedMovingObject
34+
#include <osi3/osi_groundtruth.pb.h> // for GroundTruth
35+
#include <osi3/osi_object.pb.h> // for MovingObject
36+
#include <osi3/osi_sensordata.pb.h> // for SensorData, DetectedEntityHeader
37+
#include <osi3/osi_sensorview.pb.h> // for SensorView
3838

3939
#include "osi_omni_sensor.hpp"
4040
#include "osi_sensor_component.hpp" // for transform_...

optional/vtd/vendor/open-simulation-interface-3.0.1/CMakeLists.txt

-76
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
versions:
3+
- "3.0.1"
4+
- "3.2.0"
5+
sources:
6+
"3.0.1":
7+
url: "https://github.com/OpenSimulationInterface/open-simulation-interface/archive/refs/tags/v3.0.1.tar.gz"
8+
sha256: "c822868e1fc1120685c778f478b263a3336d6b12de8ec288c7a4530cfb072fae"
9+
"3.2.0":
10+
url: "https://github.com/OpenSimulationInterface/open-simulation-interface/archive/refs/tags/v3.2.0.tar.gz"
11+
sha256: "18557ac871d1a32f4603d469239bc6e40e5744129be0ce05b22fb329c6d1f545"
12+
patches:
13+
"3.0.1":
14+
- patch_file: "patches/3.0.1_single_lib.patch"
15+
"3.2.0":
16+
- patch_file: "patches/3.2.0_single_lib.patch"

optional/vtd/vendor/open-simulation-interface-3.0.1/conanfile.py

+68-43
Original file line numberDiff line numberDiff line change
@@ -2,67 +2,92 @@
22
# pylint: skip-file
33

44
import os
5-
import shutil
65

7-
from conans import CMake, ConanFile, tools
6+
from conan import ConanFile
7+
from conan.errors import ConanInvalidConfiguration
8+
from conan.tools import build, cmake, files
9+
10+
required_conan_version = ">=1.60.0 <2.0 || >=2.0.5"
811

912

1013
class OpenSimulationInterfaceConan(ConanFile):
1114
name = "open-simulation-interface"
1215
version = "3.0.1"
13-
license = "Mozilla Public License 2.0"
14-
url = "https://github.com/OpenSimulationInterface/open-simulation-interface"
15-
description = "A generic interface for the environmental perception of automated driving functions in virtual scenarios."
16-
topics = ("Sensor Simulation", "HAD")
17-
settings = "os", "compiler", "build_type", "arch"
16+
description = "Generic interface environmental perception of automated driving functions in virtual scenarios"
17+
license = "MPL-2.0"
18+
url = "https://github.com/conan-io/conan-center-index"
19+
homepage = "https://github.com/OpenSimulationInterface/open-simulation-interface"
20+
topics = ("asam", "adas", "open-simulation", "automated-driving", "openx")
21+
package_type = "library"
22+
generators = "CMakeDeps", "CMakeToolchain"
23+
settings = "os", "arch", "compiler", "build_type"
1824
options = {
1925
"shared": [True, False],
2026
"fPIC": [True, False],
2127
}
2228
default_options = {
23-
"shared": True,
29+
"shared": False,
2430
"fPIC": True,
2531
}
26-
generators = "cmake"
27-
build_policy = "missing"
28-
no_copy_source = False
29-
exports_sources = [
30-
"CMakeLists.txt",
31-
]
32-
requires = [
33-
"protobuf/2.6.1@cloe/stable"
34-
]
35-
36-
_git_url = (
37-
"https://github.com/OpenSimulationInterface/open-simulation-interface.git"
38-
)
39-
_git_dir = "osi"
40-
_git_ref = f"v{version}"
41-
42-
_cmake = None
32+
33+
def export_sources(self):
34+
files.export_conandata_patches(self)
35+
36+
def config_options(self):
37+
if self.settings.os == "Windows":
38+
del self.options.fPIC
39+
40+
def configure(self):
41+
if self.options.shared:
42+
self.options.rm_safe("fPIC")
43+
44+
def layout(self):
45+
cmake.cmake_layout(self)
46+
47+
def requirements(self):
48+
self.requires("protobuf/2.6.1@cloe/stable", transitive_headers=True, transitive_libs=True)
49+
50+
def validate(self):
51+
if self.settings.compiler.get_safe("cppstd"):
52+
build.check_min_cppstd(self, 11)
53+
if self.options.shared and self.settings.os == "Windows":
54+
raise ConanInvalidConfiguration(
55+
"Shared Libraries are not supported on windows because of the missing symbol export in the library."
56+
)
57+
58+
def build_requirements(self):
59+
self.tool_requires("protobuf/<host_version>")
4360

4461
def source(self):
45-
git = tools.Git(folder=self._git_dir)
46-
git.clone(self._git_url, self._git_ref, shallow=True)
47-
dst = os.path.join(self.source_folder, self._git_dir)
48-
shutil.copy("CMakeLists.txt", dst)
49-
50-
def _configure_cmake(self):
51-
if self._cmake:
52-
return self._cmake
53-
self._cmake = CMake(self)
54-
self._cmake.definitions["CMAKE_PROJECT_VERSION"] = self.version
55-
self._cmake.definitions["CMAKE_EXPORT_COMPILE_COMMANDS"] = True
56-
self._cmake.configure(source_folder=self._git_dir)
57-
return self._cmake
62+
files.get(self, **self.conan_data["sources"][self.version], strip_root=True)
5863

5964
def build(self):
60-
cmake = self._configure_cmake()
61-
cmake.build()
65+
files.apply_conandata_patches(self)
66+
cm = cmake.CMake(self)
67+
if self.should_configure:
68+
cm.configure()
69+
if self.should_build:
70+
cm.build()
6271

6372
def package(self):
64-
cmake = self._configure_cmake()
65-
cmake.install()
73+
if not self.should_install:
74+
return
75+
cm = cmake.CMake(self)
76+
cm.install()
77+
files.copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
78+
if self.settings.os == "Windows":
79+
files.rmdir(self, os.path.join(self.package_folder, "CMake"))
80+
else:
81+
files.rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
6682

6783
def package_info(self):
68-
self.cpp_info.libs = tools.collect_libs(self)
84+
self.cpp_info.set_property("cmake_file_name", "open_simulation_interface")
85+
self.cpp_info.set_property("cmake_target_name", "open_simulation_interface::open_simulation_interface")
86+
self.cpp_info.components["libopen_simulation_interface"].libs = ["open_simulation_interface"]
87+
self.cpp_info.components["libopen_simulation_interface"].requires = ["protobuf::libprotobuf"]
88+
89+
# TODO: to remove in conan v2 once cmake_find_package_* generators removed
90+
self.cpp_info.names["cmake_find_package"] = "open_simulation_interface"
91+
self.cpp_info.names["cmake_find_package_multi"] = "open_simulation_interface"
92+
self.cpp_info.components["libopen_simulation_interface"].names["cmake_find_package"] = "open_simulation_interface"
93+
self.cpp_info.components["libopen_simulation_interface"].names["cmake_find_package_multi"] = "open_simulation_interface"

0 commit comments

Comments
 (0)