Skip to content

Commit da46743

Browse files
committed
vtd: Update vtd-api packages for 2.0 compatibility
BREAKING CHANGE: The VTD_API_2_2_0 define is replaced by VTD_API_VERSION numerical constant for future proofing. This is split into separate defined components: - VTD_API_VERSION_EPOCH - VTD_API_VERSION_MAJOR - VTD_API_VERSION_MINOR - VTD_API_VERSION_PATCH These can be used once the `vtd_version.hpp` header is included. See this header file for documentation.
1 parent 7ec17cc commit da46743

15 files changed

+205
-109
lines changed

optional/vtd/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,12 @@ add_library(vtd-object-lib STATIC
2424
)
2525
target_link_libraries(vtd-object-lib
2626
PUBLIC
27-
vtd-api::vtd-api
27+
vtd::api
2828
cloe::runtime
2929
cloe::models
3030
Boost::boost
3131
open-simulation-interface::open-simulation-interface
3232
)
33-
message(STATUS "VTD_API_VERSION: ${VTD_API_VERSION}")
34-
if (${VTD_API_VERSION} MATCHES "2.2.0")
35-
add_compile_definitions("VTD_API_2_2_0")
36-
endif()
3733

3834
set_target_properties(vtd-object-lib PROPERTIES
3935
CXX_STANDARD 17

optional/vtd/conanfile.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,8 @@ def layout(self):
104104
cmake.cmake_layout(self)
105105

106106
def generate(self):
107-
vtd_api_version = str(self.requires.get("vtd-api"))
108-
if "vtd-api/2.2.0" in vtd_api_version:
109-
self.vtd_api_version = "2.2.0"
110-
else:
111-
self.vtd_api_version = "2022.3"
112107
tc = cmake.CMakeToolchain(self)
113108
tc.cache_variables["CMAKE_EXPORT_COMPILE_COMMANDS"] = True
114-
tc.preprocessor_definitions["VTD_API_VERSION"] = self.vtd_api_version
115-
tc.cache_variables["VTD_API_VERSION"] = self.vtd_api_version
116109
tc.cache_variables["CLOE_PROJECT_VERSION"] = self.version
117110
tc.cache_variables["TargetLintingExtended"] = self.options.pedantic
118111
tc.generate()
@@ -124,13 +117,15 @@ def build(self):
124117
cm.test()
125118

126119
def package(self):
120+
vtd_api_version = self.dependencies["vtd-api"].ref.version
121+
127122
cm = cmake.CMake(self)
128123
cm.install()
129124
self.copy("vtd-launch", dst="bin", src=f"{self.source_folder}/bin")
130125
self.copy(
131126
"*.tar",
132127
dst=self._setup_folder,
133-
src=f"{self.source_folder}/{self._setup_folder}/{self.vtd_api_version}"
128+
src=f"{self.source_folder}/{self._setup_folder}/{vtd_api_version}"
134129
)
135130

136131
def package_id(self):

optional/vtd/src/omni_sensor_component.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,17 @@
2727

2828
#include <Eigen/Geometry> // for Vector3d, Quaterniond
2929

30-
#ifdef VTD_API_2_2_0
31-
#include <viRDBIcd.h> // for RDB_OBJECT_TYPE_*
32-
#else
33-
#include <VtdToolkit/viRDBIcd.h>
34-
#endif
35-
3630
#include <cloe/component/lane_boundary.hpp> // for LaneBoundary
3731
#include <cloe/component/object.hpp> // for Object
3832
#include <cloe/utility/geometry.hpp> // for quaternion_from_rpy
3933

34+
#include "vtd_version.hpp"
35+
#if (VTD_API_VERSION_EPOCH == 0)
36+
#include <viRDBIcd.h> // for RDB_OBJECT_TYPE_*
37+
#else
38+
#include <VtdToolkit/viRDBIcd.h>
39+
#endif
40+
4041
#include "vtd_logger.hpp" // for lane_logger
4142

4243
namespace vtd {

optional/vtd/src/omni_sensor_component.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@
2727
#include <memory> // for shared_ptr<>, unique_ptr<>
2828
#include <string> // for string, to_string
2929

30-
#ifdef VTD_API_2_2_0
30+
#include "vtd_version.hpp"
31+
#if (VTD_API_VERSION_EPOCH == 0)
3132
#include <viRDBIcd.h> // for RDB_OBJECT_STATE_t, ...
3233
#else
3334
#include <VtdToolkit/viRDBIcd.h>
34-
#endif
35+
#endif
3536

3637
#include "rdb_codec.hpp" // for RdbCodec, RdbTransceiver
3738
#include "vtd_logger.hpp" // for vtd_logger

optional/vtd/src/rdb_codec.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@
2727
#include <string> // for string
2828
#include <utility> // for move
2929

30-
// This comes from VTD:
31-
#ifdef VTD_API_2_2_0
30+
#include <cloe/core.hpp> // for Json, Duration
31+
32+
#include "vtd_version.hpp"
33+
#if (VTD_API_VERSION_EPOCH == 0)
3234
#include <RDBHandler.hh> // for RDB_MSG_t
3335
#else
3436
#include <VtdToolkit/RDBHandler.hh>
3537
#endif
36-
#include <cloe/core.hpp> // for Json, Duration
3738

3839
#include "rdb_transceiver.hpp" // for RdbTransceiver
3940

optional/vtd/src/rdb_transceiver.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@
2525

2626
#include <memory> // for shared_ptr<>
2727
#include <vector> // for vector<>
28-
#ifdef VTD_API_2_2_0
28+
29+
#include <cloe/core.hpp> // for Json, Error
30+
31+
#include "vtd_version.hpp"
32+
#if (VTD_API_VERSION_EPOCH == 0)
2933
#include <viRDBIcd.h> // for RDB_MSG_t
3034
#else
3135
#include <VtdToolkit/viRDBIcd.h>
3236
#endif
33-
#include <cloe/core.hpp> // for Json, Error
3437

3538
namespace vtd {
3639

optional/vtd/src/rdb_transceiver_shm.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@
3030

3131
#include <boost/interprocess/xsi_shared_memory.hpp> // for xsi_shared_memory, ...
3232

33-
#ifdef VTD_API_2_2_0
33+
#include "vtd_version.hpp"
34+
#if (VTD_API_VERSION_EPOCH == 0)
3435
#include <RDBHandler.hh> // for RDB_SHM_BUFFER_INFO_t, RDB_MSG_t, ...
3536
#else
3637
#include <VtdToolkit/RDBHandler.hh>
37-
#endif
38+
#endif
3839

3940
#include "vtd_logger.hpp" // for rdb_logger
4041

optional/vtd/src/scp_transceiver.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@
2424
#include <iostream> // for snprintf
2525
#include <string> // for string
2626

27-
#ifdef VTD_API_2_2_0
27+
#include <cloe/utility/tcp_transceiver.hpp> // for TcpReadError
28+
29+
#include "vtd_version.hpp"
30+
#if (VTD_API_VERSION_EPOCH == 0)
2831
#include <scpIcd.h> // for SCP_MAGIC_NO, SCP_VERSION, SCP_MSG_HDR_t, ...
2932
#else
3033
#include <VtdToolkit/scpIcd.h>
31-
#endif
32-
33-
#include <cloe/utility/tcp_transceiver.hpp> // for TcpReadError
34+
#endif
3435

3536
namespace vtd {
3637

optional/vtd/src/scp_transceiver.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,16 @@
3636
#pragma once
3737

3838
#include <string> // for string
39-
#ifdef VTD_API_2_2_0
39+
40+
#include <cloe/core.hpp> // for Json, Error
41+
#include <cloe/utility/tcp_transceiver.hpp> // for TcpTransceiver
42+
43+
#include "vtd_version.hpp"
44+
#if (VTD_API_VERSION_EPOCH == 0)
4045
#include <scpIcd.h>
4146
#else
4247
#include <VtdToolkit/scpIcd.h>
4348
#endif
44-
#include <cloe/core.hpp> // for Json, Error
45-
#include <cloe/utility/tcp_transceiver.hpp> // for TcpTransceiver
4649

4750
#include "vtd_logger.hpp" // for scp_logger
4851

optional/vtd/src/task_control.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@
2525
#include <string> // for string
2626
#include <utility> // for move
2727

28-
#ifdef VTD_API_2_2_0
29-
#include <RDBHandler.hh>
30-
#else
31-
#include <VtdToolkit/RDBHandler.hh>
32-
#endif
33-
3428
#include <cloe/component/object.hpp> // for Object
3529
#include <cloe/core.hpp> // for Json
3630

31+
#include "vtd_version.hpp"
32+
#if (VTD_API_VERSION_EPOCH == 0)
33+
#include <RDBHandler.hh>
34+
#else
35+
#include <VtdToolkit/RDBHandler.hh>
36+
#endif
37+
3738
#include "omni_sensor_component.hpp" // for VtdOmniSensor
3839
#include "rdb_codec.hpp" // for RdbCodec
3940
#include "vtd_logger.hpp" // for vtd_logger

0 commit comments

Comments
 (0)