From 3dfb50d1b51c3a022ffb2191a6e0b3ddfa64d0e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Mon, 7 Dec 2020 23:05:37 +0100 Subject: [PATCH] Removed windows warnings (#58) Signed-off-by: ahcorde Signed-off-by: Louise Poubel Co-authored-by: Louise Poubel Co-authored-by: Ian Chen Co-authored-by: Steve Peters --- examples/save_image/main.cc | 17 ++++++- include/ignition/sensors/AirPressureSensor.hh | 3 ++ include/ignition/sensors/AltimeterSensor.hh | 3 ++ include/ignition/sensors/CameraSensor.hh | 21 ++++++++ include/ignition/sensors/DepthCameraSensor.hh | 23 ++++++++- include/ignition/sensors/GpuLidarSensor.hh | 13 +++++ .../sensors/ImageGaussianNoiseModel.hh | 9 ++++ include/ignition/sensors/ImuSensor.hh | 3 ++ include/ignition/sensors/Lidar.hh | 5 ++ .../ignition/sensors/LogicalCameraSensor.hh | 11 ++++ .../ignition/sensors/MagnetometerSensor.hh | 3 ++ include/ignition/sensors/Manager.hh | 3 ++ include/ignition/sensors/RenderingEvents.hh | 16 +++++- include/ignition/sensors/RenderingSensor.hh | 16 +++++- include/ignition/sensors/RgbdCameraSensor.hh | 3 ++ include/ignition/sensors/Sensor.hh | 11 ++++ include/ignition/sensors/SensorFactory.hh | 3 ++ .../ignition/sensors/ThermalCameraSensor.hh | 21 +++++++- src/AirPressureSensor.cc | 9 ++++ src/AltimeterSensor.cc | 4 +- src/CMakeLists.txt | 51 +++++++++++-------- src/CameraSensor.cc | 11 +++- src/DepthCameraSensor.cc | 11 +++- src/GpuLidarSensor.cc | 14 ++++- src/ImageGaussianNoiseModel.cc | 22 +++++--- src/ImuSensor.cc | 12 ++++- src/ImuSensor_TEST.cc | 16 +++--- src/Lidar.cc | 11 ++-- src/Lidar_TEST.cc | 11 +++- src/MagnetometerSensor.cc | 11 +++- src/Noise.cc | 5 +- src/PointCloudUtil.hh | 8 +++ src/RenderingSensor.cc | 9 ++++ src/RgbdCameraSensor.cc | 18 +++++++ src/Sensor.cc | 3 +- src/ThermalCameraSensor.cc | 13 ++++- test/gtest/src/gtest.cc | 2 + test/integration/camera_plugin.cc | 23 ++++++++- test/integration/depth_camera_plugin.cc | 31 +++++++++-- test/integration/gpu_lidar_sensor_plugin.cc | 24 ++++++++- test/integration/logical_camera_plugin.cc | 8 +++ test/integration/rgbd_camera_plugin.cc | 31 +++++++++-- test/integration/thermal_camera_plugin.cc | 37 +++++++++++--- 43 files changed, 497 insertions(+), 82 deletions(-) diff --git a/examples/save_image/main.cc b/examples/save_image/main.cc index ddaa707f..cfbcfac7 100644 --- a/examples/save_image/main.cc +++ b/examples/save_image/main.cc @@ -24,7 +24,22 @@ #include #include #include -#include + +// TODO(louise) Remove these pragmas once ign-rendering is disabling the +// warnings +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4251) +#endif +#include +#include +#include +#include +#include +#ifdef _WIN32 +#pragma warning(pop) +#endif + #include void OnImageFrame(const ignition::msgs::Image &_image) diff --git a/include/ignition/sensors/AirPressureSensor.hh b/include/ignition/sensors/AirPressureSensor.hh index d3db6b8b..4655944a 100644 --- a/include/ignition/sensors/AirPressureSensor.hh +++ b/include/ignition/sensors/AirPressureSensor.hh @@ -21,6 +21,7 @@ #include +#include #include #include @@ -84,9 +85,11 @@ namespace ignition /// \return Verical reference position in meters public: double ReferenceAltitude() const; + IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING /// \brief Data pointer for private data /// \internal private: std::unique_ptr dataPtr; + IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING }; } } diff --git a/include/ignition/sensors/AltimeterSensor.hh b/include/ignition/sensors/AltimeterSensor.hh index af582786..59ec82f7 100644 --- a/include/ignition/sensors/AltimeterSensor.hh +++ b/include/ignition/sensors/AltimeterSensor.hh @@ -21,6 +21,7 @@ #include +#include #include #include @@ -101,9 +102,11 @@ namespace ignition /// \return Vertical velocity in meters per second public: double VerticalVelocity() const; + IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING /// \brief Data pointer for private data /// \internal private: std::unique_ptr dataPtr; + IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING }; } } diff --git a/include/ignition/sensors/CameraSensor.hh b/include/ignition/sensors/CameraSensor.hh index 6da658fc..53423575 100644 --- a/include/ignition/sensors/CameraSensor.hh +++ b/include/ignition/sensors/CameraSensor.hh @@ -24,10 +24,29 @@ #include #include +#include #include +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif + +// TODO(louise) Remove these pragmas once ign-rendering is disabling the +// warnings +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include "ignition/sensors/camera/Export.hh" #include "ignition/sensors/config.hh" @@ -162,9 +181,11 @@ namespace ignition /// \param[in] _scene Pointer to the new scene. private: void OnSceneChange(ignition::rendering::ScenePtr /*_scene*/); + IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING /// \brief Data pointer for private data /// \internal private: std::unique_ptr dataPtr; + IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING }; } } diff --git a/include/ignition/sensors/DepthCameraSensor.hh b/include/ignition/sensors/DepthCameraSensor.hh index e5fd8f45..59d6b64e 100644 --- a/include/ignition/sensors/DepthCameraSensor.hh +++ b/include/ignition/sensors/DepthCameraSensor.hh @@ -24,13 +24,30 @@ #include #include - #include +#include #include +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif +// TODO(louise) Remove these pragmas once ign-rendering is disabling the +// warnings +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include "ignition/sensors/depth_camera/Export.hh" #include "ignition/sensors/CameraSensor.hh" @@ -80,7 +97,7 @@ namespace ignition /// \param[in] _now The current time /// \return true if the update was successfull public: virtual bool IGN_DEPRECATED(4) Update( - const common::Time &_now) override; + const ignition::common::Time &_now) override; /// \brief Force the sensor to generate data /// \param[in] _now The current time @@ -158,9 +175,11 @@ namespace ignition private: void OnSceneChange(ignition::rendering::ScenePtr /*_scene*/) { } + IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING /// \brief Data pointer for private data /// \internal private: std::unique_ptr dataPtr; + IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING }; } } diff --git a/include/ignition/sensors/GpuLidarSensor.hh b/include/ignition/sensors/GpuLidarSensor.hh index a7376192..8ddfbc19 100644 --- a/include/ignition/sensors/GpuLidarSensor.hh +++ b/include/ignition/sensors/GpuLidarSensor.hh @@ -22,7 +22,18 @@ #include +#include + +// TODO(louise) Remove these pragmas once ign-rendering is disabling the +// warnings +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include "ignition/sensors/gpu_lidar/Export.hh" #include "ignition/sensors/RenderingEvents.hh" @@ -123,9 +134,11 @@ namespace ignition unsigned int _heighti, unsigned int _channels, const std::string &/*_format*/)> _subscriber) override; + IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING /// \brief Data pointer for private data /// \internal private: std::unique_ptr dataPtr; + IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING }; } } diff --git a/include/ignition/sensors/ImageGaussianNoiseModel.hh b/include/ignition/sensors/ImageGaussianNoiseModel.hh index 374906e9..f20ca0bc 100644 --- a/include/ignition/sensors/ImageGaussianNoiseModel.hh +++ b/include/ignition/sensors/ImageGaussianNoiseModel.hh @@ -20,7 +20,16 @@ #include +// TODO(louise) Remove these pragmas once ign-rendering is disabling the +// warnings +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include "ignition/sensors/config.hh" #include "ignition/sensors/GaussianNoiseModel.hh" diff --git a/include/ignition/sensors/ImuSensor.hh b/include/ignition/sensors/ImuSensor.hh index c490d0dc..51e9f77f 100644 --- a/include/ignition/sensors/ImuSensor.hh +++ b/include/ignition/sensors/ImuSensor.hh @@ -21,6 +21,7 @@ #include +#include #include #include @@ -128,9 +129,11 @@ namespace ignition /// \return Gravity vectory in meters per second squared. public: math::Vector3d Gravity() const; + IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING /// \brief Data pointer for private data /// \internal private: std::unique_ptr dataPtr; + IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING }; } } diff --git a/include/ignition/sensors/Lidar.hh b/include/ignition/sensors/Lidar.hh index 44f5c780..bcbb587d 100644 --- a/include/ignition/sensors/Lidar.hh +++ b/include/ignition/sensors/Lidar.hh @@ -21,6 +21,7 @@ #include #include +#include #include #include "ignition/sensors/lidar/Export.hh" @@ -242,8 +243,10 @@ namespace ignition // Documentation inherited public: virtual bool IsActive() const; + IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING /// \brief Just a mutex for thread safety public: mutable std::mutex lidarMutex; + IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING /// \brief Raw buffer of laser data. public: float *laserBuffer = nullptr; @@ -263,9 +266,11 @@ namespace ignition unsigned int _heighti, unsigned int _channels, const std::string &/*_format*/)> _subscriber); + IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING /// \brief Data pointer for private data /// \internal private: std::unique_ptr dataPtr; + IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING }; } } diff --git a/include/ignition/sensors/LogicalCameraSensor.hh b/include/ignition/sensors/LogicalCameraSensor.hh index 54a1b179..338e587f 100644 --- a/include/ignition/sensors/LogicalCameraSensor.hh +++ b/include/ignition/sensors/LogicalCameraSensor.hh @@ -24,11 +24,20 @@ #include #include +#include #include #include +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include "ignition/sensors/config.hh" #include "ignition/sensors/Export.hh" @@ -110,9 +119,11 @@ namespace ignition /// \return List of detected models. public: msgs::LogicalCameraImage Image() const; + IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING /// \brief Data pointer for private data /// \internal private: std::unique_ptr dataPtr; + IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING }; } } diff --git a/include/ignition/sensors/MagnetometerSensor.hh b/include/ignition/sensors/MagnetometerSensor.hh index fe077167..fe0f483b 100644 --- a/include/ignition/sensors/MagnetometerSensor.hh +++ b/include/ignition/sensors/MagnetometerSensor.hh @@ -21,6 +21,7 @@ #include +#include #include #include @@ -97,9 +98,11 @@ namespace ignition /// \return Magnetic field vector in body frame public: math::Vector3d MagneticField() const; + IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING /// \brief Data pointer for private data /// \internal private: std::unique_ptr dataPtr; + IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING }; } } diff --git a/include/ignition/sensors/Manager.hh b/include/ignition/sensors/Manager.hh index f6f0f20b..a9e04151 100644 --- a/include/ignition/sensors/Manager.hh +++ b/include/ignition/sensors/Manager.hh @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -212,8 +213,10 @@ namespace ignition private: ignition::sensors::SensorId LoadSensorPlugin( const std::string &_filename, sdf::ElementPtr _sdf); + IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING /// \brief private data pointer private: std::unique_ptr dataPtr; + IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING }; } } diff --git a/include/ignition/sensors/RenderingEvents.hh b/include/ignition/sensors/RenderingEvents.hh index f9959863..7912d012 100644 --- a/include/ignition/sensors/RenderingEvents.hh +++ b/include/ignition/sensors/RenderingEvents.hh @@ -19,7 +19,19 @@ #define IGNITION_SENSORS_RENDERINGEVENTS_HH_ #include -#include +#include + +// TODO(louise) Remove these pragmas once ign-rendering is disabling the +// warnings +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4251) +#endif +#include +#ifdef _WIN32 +#pragma warning(pop) +#endif + #include #include @@ -43,10 +55,12 @@ namespace ignition std::function _callback); + IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING /// \brief Event that is used to trigger callbacks when the scene /// is changed public: static ignition::common::EventT< void(const ignition::rendering::ScenePtr &)> sceneEvent; + IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING }; } } diff --git a/include/ignition/sensors/RenderingSensor.hh b/include/ignition/sensors/RenderingSensor.hh index 36df85e3..d39a0f26 100644 --- a/include/ignition/sensors/RenderingSensor.hh +++ b/include/ignition/sensors/RenderingSensor.hh @@ -19,8 +19,18 @@ #include -#include -#include +#include + +// TODO(louise) Remove these pragmas once ign-rendering is disabling the +// warnings +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4251) +#endif +#include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include "ignition/sensors/rendering/Export.hh" #include "ignition/sensors/Sensor.hh" @@ -76,9 +86,11 @@ namespace ignition /// \param[in] _sensor Sensor to add. protected: void AddSensor(rendering::SensorPtr _sensor); + IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING /// \internal /// \brief Data pointer for private data private: std::unique_ptr dataPtr; + IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING }; } } diff --git a/include/ignition/sensors/RgbdCameraSensor.hh b/include/ignition/sensors/RgbdCameraSensor.hh index 17c563a2..2712396f 100644 --- a/include/ignition/sensors/RgbdCameraSensor.hh +++ b/include/ignition/sensors/RgbdCameraSensor.hh @@ -21,6 +21,7 @@ #include +#include #include #include "ignition/sensors/CameraSensor.hh" @@ -95,9 +96,11 @@ namespace ignition /// \return True on success. private: bool CreateCameras(); + IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING /// \brief Data pointer for private data /// \internal private: std::unique_ptr dataPtr; + IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING }; } } diff --git a/include/ignition/sensors/Sensor.hh b/include/ignition/sensors/Sensor.hh index adcc1db8..450e7c53 100644 --- a/include/ignition/sensors/Sensor.hh +++ b/include/ignition/sensors/Sensor.hh @@ -17,11 +17,20 @@ #ifndef IGNITION_SENSORS_SENSOR_HH_ #define IGNITION_SENSORS_SENSOR_HH_ +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include #include +#include #include #include #include @@ -210,9 +219,11 @@ namespace ignition public: void AddSequence(ignition::msgs::Header *_msg, const std::string &_seqKey = "default"); + IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING /// \internal /// \brief Data pointer for private data private: std::unique_ptr dataPtr; + IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING }; } } diff --git a/include/ignition/sensors/SensorFactory.hh b/include/ignition/sensors/SensorFactory.hh index 365566fe..32004a21 100644 --- a/include/ignition/sensors/SensorFactory.hh +++ b/include/ignition/sensors/SensorFactory.hh @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -176,8 +177,10 @@ namespace ignition private: std::shared_ptr LoadSensorPlugin( const std::string &_filename); + IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING /// \brief private data pointer private: std::unique_ptr dataPtr; + IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING }; /// \brief Sensor registration macro diff --git a/include/ignition/sensors/ThermalCameraSensor.hh b/include/ignition/sensors/ThermalCameraSensor.hh index 3eab5123..fddb2ca9 100644 --- a/include/ignition/sensors/ThermalCameraSensor.hh +++ b/include/ignition/sensors/ThermalCameraSensor.hh @@ -24,13 +24,30 @@ #include #include - #include +#include #include +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif +// TODO(louise) Remove these pragmas once ign-rendering is disabling the +// warnings +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include "ignition/sensors/thermal_camera/Export.hh" #include "ignition/sensors/CameraSensor.hh" @@ -162,9 +179,11 @@ namespace ignition private: void OnSceneChange(ignition::rendering::ScenePtr /*_scene*/) { } + IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING /// \brief Data pointer for private data /// \internal private: std::unique_ptr dataPtr; + IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING }; } } diff --git a/src/AirPressureSensor.cc b/src/AirPressureSensor.cc index cbdf5124..9982e9e3 100644 --- a/src/AirPressureSensor.cc +++ b/src/AirPressureSensor.cc @@ -15,7 +15,16 @@ * */ +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif + #include #include diff --git a/src/AltimeterSensor.cc b/src/AltimeterSensor.cc index 7d29a9b7..6391380c 100644 --- a/src/AltimeterSensor.cc +++ b/src/AltimeterSensor.cc @@ -18,10 +18,10 @@ #include #include +#include "ignition/sensors/AltimeterSensor.hh" #include "ignition/sensors/Noise.hh" -#include "ignition/sensors/SensorTypes.hh" #include "ignition/sensors/SensorFactory.hh" -#include "ignition/sensors/AltimeterSensor.hh" +#include "ignition/sensors/SensorTypes.hh" using namespace ignition; using namespace sensors; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 268ed90b..97a38024 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,6 +8,27 @@ set (sources SensorTypes.cc ) +set(rendering_sources + RenderingSensor.cc + RenderingEvents.cc + ImageGaussianNoiseModel.cc + ImageNoise.cc +) + +set (gtest_sources + Manager_TEST.cc + Noise_TEST.cc + Sensor_TEST.cc +) + +if (MSVC) + # TODO(louise) Remove this once warnings are suppressed in ign-rendering + set_source_files_properties( + ${rendering_sources} + COMPILE_FLAGS "/wd4251" + ) +endif() + # Create the library target. ign_create_core_library(SOURCES ${sources} CXX_STANDARD 14) @@ -23,20 +44,13 @@ target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PRIVATE ignition-common${IGN_COMMON_VER}::profiler ) - -set(rendering_sources - RenderingSensor.cc - RenderingEvents.cc - ImageGaussianNoiseModel.cc - ImageNoise.cc -) +target_compile_definitions(${PROJECT_LIBRARY_TARGET_NAME} PUBLIC DepthPoints_EXPORTS) ign_add_component(rendering SOURCES ${rendering_sources} GET_TARGET_NAME rendering_target) target_link_libraries(${rendering_target} PUBLIC ignition-rendering${IGN_RENDERING_VER}::ignition-rendering${IGN_RENDERING_VER} - ) - +) set(camera_sources CameraSensor.cc) ign_add_component(camera SOURCES ${camera_sources} GET_TARGET_NAME camera_target) @@ -49,7 +63,7 @@ target_link_libraries(${camera_target} PRIVATE ignition-msgs${IGN_MSGS_VER}::ignition-msgs${IGN_MSGS_VER} ignition-transport${IGN_TRANSPORT_VER}::ignition-transport${IGN_TRANSPORT_VER} - ) +) set(depth_camera_sources DepthCameraSensor.cc) ign_add_component(depth_camera SOURCES ${depth_camera_sources} GET_TARGET_NAME depth_camera_target) @@ -59,7 +73,7 @@ target_link_libraries(${depth_camera_target} ${camera_target} ignition-msgs${IGN_MSGS_VER}::ignition-msgs${IGN_MSGS_VER} ignition-transport${IGN_TRANSPORT_VER}::ignition-transport${IGN_TRANSPORT_VER} - ) +) set(lidar_sources Lidar.cc) ign_add_component(lidar SOURCES ${lidar_sources} GET_TARGET_NAME lidar_target) @@ -70,7 +84,7 @@ target_link_libraries(${lidar_target} PRIVATE ignition-msgs${IGN_MSGS_VER}::ignition-msgs${IGN_MSGS_VER} ignition-transport${IGN_TRANSPORT_VER}::ignition-transport${IGN_TRANSPORT_VER} - ) +) set(gpu_lidar_sources GpuLidarSensor.cc) ign_add_component(gpu_lidar SOURCES ${gpu_lidar_sources} GET_TARGET_NAME gpu_lidar_target) @@ -80,7 +94,7 @@ target_link_libraries(${gpu_lidar_target} ignition-msgs${IGN_MSGS_VER}::ignition-msgs${IGN_MSGS_VER} ignition-transport${IGN_TRANSPORT_VER}::ignition-transport${IGN_TRANSPORT_VER} ${lidar_target} - ) +) set(logical_camera_sources LogicalCameraSensor.cc) ign_add_component(logical_camera SOURCES ${logical_camera_sources} GET_TARGET_NAME logical_camera_target) @@ -89,7 +103,7 @@ target_link_libraries(${logical_camera_target} PRIVATE ignition-msgs${IGN_MSGS_VER}::ignition-msgs${IGN_MSGS_VER} ignition-transport${IGN_TRANSPORT_VER}::ignition-transport${IGN_TRANSPORT_VER} - ) +) set(magnetometer_sources MagnetometerSensor.cc) ign_add_component(magnetometer SOURCES ${magnetometer_sources} GET_TARGET_NAME magnetometer_target) @@ -111,7 +125,7 @@ target_link_libraries(${rgbd_camera_target} ${camera_target} ignition-msgs${IGN_MSGS_VER}::ignition-msgs${IGN_MSGS_VER} ignition-transport${IGN_TRANSPORT_VER}::ignition-transport${IGN_TRANSPORT_VER} - ) +) set(thermal_camera_sources ThermalCameraSensor.cc) ign_add_component(thermal_camera SOURCES ${thermal_camera_sources} GET_TARGET_NAME thermal_camera_target) @@ -120,13 +134,6 @@ target_link_libraries(${thermal_camera_target} ${camera_target} ignition-msgs${IGN_MSGS_VER}::ignition-msgs${IGN_MSGS_VER} ignition-transport${IGN_TRANSPORT_VER}::ignition-transport${IGN_TRANSPORT_VER} - ) - - -set (gtest_sources - Manager_TEST.cc - Noise_TEST.cc - Sensor_TEST.cc ) # Build the unit tests. diff --git a/src/CameraSensor.cc b/src/CameraSensor.cc index 3e3046d1..846cf34f 100644 --- a/src/CameraSensor.cc +++ b/src/CameraSensor.cc @@ -14,7 +14,15 @@ * limitations under the License. * */ +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include @@ -24,9 +32,8 @@ #include #include #include -#include - #include +#include #include "ignition/sensors/CameraSensor.hh" #include "ignition/sensors/ImageGaussianNoiseModel.hh" diff --git a/src/DepthCameraSensor.cc b/src/DepthCameraSensor.cc index d78822e4..561e7b78 100644 --- a/src/DepthCameraSensor.cc +++ b/src/DepthCameraSensor.cc @@ -14,8 +14,15 @@ * limitations under the License. * */ - +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include @@ -160,7 +167,7 @@ bool DepthCameraSensorPrivate::ConvertDepthToImage( double factor = 255 / maxDepth; for (unsigned int j = 0; j < _height * _width; ++j) { - unsigned char d = 255 - (_data[j] * factor); + unsigned char d = static_cast(255 - (_data[j] * factor)); _imageBuffer[j * 3] = d; _imageBuffer[j * 3 + 1] = d; _imageBuffer[j * 3 + 2] = d; diff --git a/src/GpuLidarSensor.cc b/src/GpuLidarSensor.cc index 548e8d2a..e72f3868 100644 --- a/src/GpuLidarSensor.cc +++ b/src/GpuLidarSensor.cc @@ -14,12 +14,22 @@ * limitations under the License. * */ + +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include -#include -#include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include #include +#include +#include + #include "ignition/sensors/GpuLidarSensor.hh" #include "ignition/sensors/SensorFactory.hh" diff --git a/src/ImageGaussianNoiseModel.cc b/src/ImageGaussianNoiseModel.cc index 4c842980..5f4bf803 100644 --- a/src/ImageGaussianNoiseModel.cc +++ b/src/ImageGaussianNoiseModel.cc @@ -20,13 +20,23 @@ #include #endif -#include "ignition/common/Console.hh" -#include "ignition/sensors/ImageGaussianNoiseModel.hh" -#include "ignition/rendering/GaussianNoisePass.hh" -#include "ignition/rendering/RenderPass.hh" -#include "ignition/rendering/RenderEngine.hh" -#include "ignition/rendering/RenderPassSystem.hh" +#include +// TODO(louise) Remove these pragmas once ign-rendering is disabling the +// warnings +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4251) +#endif +#include +#include +#include +#include +#ifdef _WIN32 +#pragma warning(pop) +#endif + +#include "ignition/sensors/ImageGaussianNoiseModel.hh" using namespace ignition; using namespace sensors; diff --git a/src/ImuSensor.cc b/src/ImuSensor.cc index 2c9103f4..ff31c3e6 100644 --- a/src/ImuSensor.cc +++ b/src/ImuSensor.cc @@ -14,15 +14,23 @@ * limitations under the License. * */ - +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif + #include #include +#include "ignition/sensors/ImuSensor.hh" #include "ignition/sensors/Noise.hh" #include "ignition/sensors/SensorFactory.hh" #include "ignition/sensors/SensorTypes.hh" -#include "ignition/sensors/ImuSensor.hh" using namespace ignition; using namespace sensors; diff --git a/src/ImuSensor_TEST.cc b/src/ImuSensor_TEST.cc index 76566afb..d690f460 100644 --- a/src/ImuSensor_TEST.cc +++ b/src/ImuSensor_TEST.cc @@ -18,11 +18,19 @@ #include #include +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include -#include -#include +#ifdef _WIN32 +#pragma warning(pop) +#endif +#include #include +#include using namespace ignition; @@ -310,7 +318,3 @@ int main(int argc, char **argv) ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } - - - - diff --git a/src/Lidar.cc b/src/Lidar.cc index b5c6147a..3dbd0ba1 100644 --- a/src/Lidar.cc +++ b/src/Lidar.cc @@ -20,11 +20,11 @@ #include #include +#include "ignition/sensors/GaussianNoiseModel.hh" #include "ignition/sensors/Lidar.hh" #include "ignition/sensors/Noise.hh" #include "ignition/sensors/SensorFactory.hh" #include "ignition/sensors/SensorTypes.hh" -#include "ignition/sensors/GaussianNoiseModel.hh" using namespace ignition::sensors; @@ -340,7 +340,8 @@ unsigned int Lidar::RayCount() const ////////////////////////////////////////////////// unsigned int Lidar::RangeCount() const { - return this->RayCount() * this->dataPtr->sdfLidar.HorizontalScanResolution(); + return static_cast(this->RayCount() * + this->dataPtr->sdfLidar.HorizontalScanResolution()); } ////////////////////////////////////////////////// @@ -352,12 +353,12 @@ unsigned int Lidar::VerticalRayCount() const ////////////////////////////////////////////////// unsigned int Lidar::VerticalRangeCount() const { - int rows = this->VerticalRayCount() * - this->dataPtr->sdfLidar.VerticalScanResolution(); + unsigned int rows = static_cast(this->VerticalRayCount() * + this->dataPtr->sdfLidar.VerticalScanResolution()); if (rows > 1) return rows; else - return 1; + return 1u; } ////////////////////////////////////////////////// diff --git a/src/Lidar_TEST.cc b/src/Lidar_TEST.cc index a40d4b18..c35f004b 100644 --- a/src/Lidar_TEST.cc +++ b/src/Lidar_TEST.cc @@ -19,13 +19,20 @@ #include #include +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif + #include #include - #include - sdf::ElementPtr LidarToSDF(const std::string &name, double update_rate, const std::string &topic, double horz_samples, double horz_resolution, double horz_min_angle, double horz_max_angle, double vert_samples, diff --git a/src/MagnetometerSensor.cc b/src/MagnetometerSensor.cc index 325b92df..236b3165 100644 --- a/src/MagnetometerSensor.cc +++ b/src/MagnetometerSensor.cc @@ -15,15 +15,24 @@ * */ +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif + #include #include #include +#include "ignition/sensors/MagnetometerSensor.hh" #include "ignition/sensors/Noise.hh" #include "ignition/sensors/SensorFactory.hh" #include "ignition/sensors/SensorTypes.hh" -#include "ignition/sensors/MagnetometerSensor.hh" using namespace ignition; using namespace sensors; diff --git a/src/Noise.cc b/src/Noise.cc index 10f589ba..4d25945a 100644 --- a/src/Noise.cc +++ b/src/Noise.cc @@ -23,9 +23,10 @@ #include -#include #include -#include + +#include "ignition/sensors/GaussianNoiseModel.hh" +#include "ignition/sensors/Noise.hh" using namespace ignition; using namespace sensors; diff --git a/src/PointCloudUtil.hh b/src/PointCloudUtil.hh index 46ad45b0..efcaea1e 100644 --- a/src/PointCloudUtil.hh +++ b/src/PointCloudUtil.hh @@ -18,7 +18,15 @@ #ifndef IGNITION_SENSORS_POINTCLOUDUTIL_HH_ #define IGNITION_SENSORS_POINTCLOUDUTIL_HH_ +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include #include "ignition/sensors/config.hh" diff --git a/src/RenderingSensor.cc b/src/RenderingSensor.cc index 0e8fb6ae..ef99bcfe 100644 --- a/src/RenderingSensor.cc +++ b/src/RenderingSensor.cc @@ -17,7 +17,16 @@ #include +// TODO(louise) Remove these pragmas once ign-rendering is disabling the +// warnings +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include "ignition/sensors/RenderingSensor.hh" diff --git a/src/RgbdCameraSensor.cc b/src/RgbdCameraSensor.cc index 48ce5af3..90389d8b 100644 --- a/src/RgbdCameraSensor.cc +++ b/src/RgbdCameraSensor.cc @@ -15,15 +15,33 @@ * */ +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include #include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include #include #include +// TODO(louise) Remove these pragmas once ign-rendering is disabling the +// warnings +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4251) +#endif #include #include +#ifdef _WIN32 +#pragma warning(pop) +#endif + #include #include diff --git a/src/Sensor.cc b/src/Sensor.cc index 11400628..cf744a52 100644 --- a/src/Sensor.cc +++ b/src/Sensor.cc @@ -18,11 +18,12 @@ #include "ignition/sensors/Sensor.hh" #include #include -#include #include #include #include +#include + using namespace ignition::sensors; diff --git a/src/ThermalCameraSensor.cc b/src/ThermalCameraSensor.cc index 1b40c67b..e6573691 100644 --- a/src/ThermalCameraSensor.cc +++ b/src/ThermalCameraSensor.cc @@ -14,7 +14,16 @@ * limitations under the License. * */ + +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include #include @@ -130,7 +139,7 @@ class ignition::sensors::ThermalCameraSensorPrivate public: float maxTemp = ignition::math::INF_F; /// \brief Linear resolution. Defaults to 10mK - public: float resolution = 0.01; + public: float resolution = 0.01f; }; using namespace ignition; @@ -530,7 +539,7 @@ bool ThermalCameraSensorPrivate::ConvertTemperatureToImage( { uint16_t temp = _data[i*_width + j]; double t = static_cast(temp-*min) / range; - int r = 255*t; + int r = static_cast(255*t); int g = r; int b = r; int index = i*_width*3 + j*3; diff --git a/test/gtest/src/gtest.cc b/test/gtest/src/gtest.cc index ac21ea4b..5e8c3c41 100644 --- a/test/gtest/src/gtest.cc +++ b/test/gtest/src/gtest.cc @@ -30,7 +30,9 @@ // // The Google C++ Testing and Mocking Framework (Google Test) +#ifndef _WIN32 #pragma GCC system_header +#endif #include "gtest/gtest.h" #include "gtest/internal/custom/gtest.h" diff --git a/test/integration/camera_plugin.cc b/test/integration/camera_plugin.cc index 7919ba39..ad86ee99 100644 --- a/test/integration/camera_plugin.cc +++ b/test/integration/camera_plugin.cc @@ -20,8 +20,29 @@ #include #include #include -#include + +// TODO(louise) Remove these pragmas once ign-rendering is disabling the +// warnings +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4251) +#endif +#include +#include +#include +#ifdef _WIN32 +#pragma warning(pop) +#endif + +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include "test_config.h" // NOLINT(build/include) #include "TransportTestTools.hh" diff --git a/test/integration/depth_camera_plugin.cc b/test/integration/depth_camera_plugin.cc index 12460aef..991418fa 100644 --- a/test/integration/depth_camera_plugin.cc +++ b/test/integration/depth_camera_plugin.cc @@ -16,14 +16,37 @@ */ #include + +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include +#include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include #include #include #include -#include -#include + +// TODO(louise) Remove these pragmas once ign-rendering is disabling the +// warnings +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4251) +#endif +#include +#include +#include +#include +#include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include "test_config.h" // NOLINT(build/include) #include "TransportTestTools.hh" @@ -247,8 +270,8 @@ void DepthCameraSensorTest::ImagesWithBuiltinSDF( // wait for a few depth camera frames mgr.RunOnce(std::chrono::steady_clock::duration::zero(), true); - int midWidth = depthSensor->ImageWidth() * 0.5; - int midHeight = depthSensor->ImageHeight() * 0.5; + int midWidth = static_cast(depthSensor->ImageWidth() * 0.5); + int midHeight = static_cast(depthSensor->ImageHeight() * 0.5); int mid = midHeight * depthSensor->ImageWidth() + midWidth -1; double expectedRangeAtMidPoint = boxPosition.X() - unitBoxSize * 0.5; diff --git a/test/integration/gpu_lidar_sensor_plugin.cc b/test/integration/gpu_lidar_sensor_plugin.cc index adbb9088..c21d7790 100644 --- a/test/integration/gpu_lidar_sensor_plugin.cc +++ b/test/integration/gpu_lidar_sensor_plugin.cc @@ -26,9 +26,31 @@ #include #include #include +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include -#include + +// TODO(louise) Remove these pragmas once ign-rendering is disabling the +// warnings +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4251) +#endif +#include +#include +#include +#include +#ifdef _WIN32 +#pragma warning(pop) +#endif + #include #include "test_config.h" // NOLINT(build/include) diff --git a/test/integration/logical_camera_plugin.cc b/test/integration/logical_camera_plugin.cc index a2f349bb..dd3bcc0a 100644 --- a/test/integration/logical_camera_plugin.cc +++ b/test/integration/logical_camera_plugin.cc @@ -27,7 +27,15 @@ #include #include +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include #include "test_config.h" // NOLINT(build/include) diff --git a/test/integration/rgbd_camera_plugin.cc b/test/integration/rgbd_camera_plugin.cc index 81755601..9f88b9e7 100644 --- a/test/integration/rgbd_camera_plugin.cc +++ b/test/integration/rgbd_camera_plugin.cc @@ -16,14 +16,37 @@ */ #include + +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include +#include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include #include #include #include -#include -#include + +// TODO(louise) Remove these pragmas once ign-rendering is disabling the +// warnings +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4251) +#endif +#include +#include +#include +#include +#include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include "test_config.h" // NOLINT(build/include) #include "TransportTestTools.hh" @@ -318,8 +341,8 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF( pcCounter = 0; // depth image indices - int midWidth = rgbdSensor->ImageWidth() * 0.5; - int midHeight = rgbdSensor->ImageHeight() * 0.5; + int midWidth = static_cast(rgbdSensor->ImageWidth() * 0.5); + int midHeight = static_cast(rgbdSensor->ImageHeight() * 0.5); int mid = midHeight * rgbdSensor->ImageWidth() + midWidth -1; double expectedRangeAtMidPoint = boxPosition.X() - unitBoxSize * 0.5; int left = midHeight * rgbdSensor->ImageWidth(); diff --git a/test/integration/thermal_camera_plugin.cc b/test/integration/thermal_camera_plugin.cc index 6a66c473..fc2463d9 100644 --- a/test/integration/thermal_camera_plugin.cc +++ b/test/integration/thermal_camera_plugin.cc @@ -16,19 +16,40 @@ */ #include + +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4005) +#pragma warning(disable: 4251) +#endif #include +#include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include #include #include #include -#include -#include + +// TODO(louise) Remove these pragmas once ign-rendering is disabling the +// warnings +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable: 4251) +#endif +#include +#include +#include +#include +#ifdef _WIN32 +#pragma warning(pop) +#endif #include "test_config.h" // NOLINT(build/include) #include "TransportTestTools.hh" - #define DOUBLE_TOL 1e-6 std::mutex g_mutex; @@ -141,9 +162,9 @@ void ThermalCameraSensorTest::ImagesWithBuiltinSDF( mgr.CreateSensor(sensorPtr); ASSERT_NE(thermalSensor, nullptr); - float ambientTemp = 296.0; - float ambientTempRange = 4.0; - float linearResolution = 0.01; + float ambientTemp = 296.0f; + float ambientTempRange = 4.0f; + float linearResolution = 0.01f; thermalSensor->SetAmbientTemperature(ambientTemp); thermalSensor->SetAmbientTemperatureRange(ambientTempRange); thermalSensor->SetLinearResolution(linearResolution); @@ -176,8 +197,8 @@ void ThermalCameraSensorTest::ImagesWithBuiltinSDF( // wait for a few thermal camera frames mgr.RunOnce(std::chrono::steady_clock::duration::zero(), true); - int midWidth = thermalSensor->ImageWidth() * 0.5; - int midHeight = thermalSensor->ImageHeight() * 0.5; + int midWidth = static_cast(thermalSensor->ImageWidth() * 0.5); + int midHeight = static_cast(thermalSensor->ImageHeight() * 0.5); int mid = midHeight * thermalSensor->ImageWidth() + midWidth -1; int left = midHeight * thermalSensor->ImageWidth(); int right = (midHeight+1) * thermalSensor->ImageWidth() - 1;