Skip to content

Commit 55ddac7

Browse files
j-riverochapulina
andauthored
Final Windows fixes to complete compilation (#585)
* Final Windows fixes to compile the software and test suite * Remove invalid visibility macros * Change system to be a header only file * Fix setenv to use ignition::common * Set visibility for GuiSystem Signed-off-by: Jose Luis Rivero <[email protected]> Co-authored-by: Louise Poubel <[email protected]>
1 parent cd78bd4 commit 55ddac7

File tree

11 files changed

+40
-10
lines changed

11 files changed

+40
-10
lines changed

include/ignition/gazebo/EventManager.hh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ namespace ignition
4747
/// occur.
4848
///
4949
/// See \ref ignition::gazebo::events for a complete list of events.
50+
51+
/// TODO: if visibility is added here the MSVC is unable to compile it.
52+
/// The use of smart pointer inside the unordered_map (events method) is
53+
/// the cause of it. Maybe a compiler bug?
5054
class EventManager
5155
{
5256
/// \brief Constructor

include/ignition/gazebo/gui/GuiSystem.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#include <ignition/gazebo/config.hh>
2323
#include <ignition/gazebo/EntityComponentManager.hh>
24-
#include <ignition/gazebo/Export.hh>
24+
#include <ignition/gazebo/gui/Export.hh>
2525
#include <ignition/gui/Plugin.hh>
2626

2727
#include <sdf/Element.hh>
@@ -41,7 +41,7 @@ namespace gazebo
4141
/// GUI systems are different from `ignition::gazebo::System`s because they
4242
/// don't run in the same process as the physics. Instead, they run in a
4343
/// separate process that is stepped by updates coming through the network
44-
class GuiSystem : public ignition::gui::Plugin
44+
class IGNITION_GAZEBO_GUI_VISIBLE GuiSystem : public ignition::gui::Plugin
4545
{
4646
Q_OBJECT
4747

include/ignition/gazebo/gui/TmpIface.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <ignition/msgs.hh>
2525
#include <ignition/transport.hh>
2626

27-
#include "ignition/gazebo/Export.hh"
27+
#include "ignition/gazebo/gui/Export.hh"
2828

2929
namespace ignition
3030
{

src/gui/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ ign_add_component(gui
3333

3434
target_link_libraries(${gui_target}
3535
PUBLIC
36+
${PROJECT_LIBRARY_TARGET_NAME}
3637
ignition-common${IGN_COMMON_VER}::ignition-common${IGN_COMMON_VER}
3738
ignition-gui${IGN_GUI_VER}::ignition-gui${IGN_GUI_VER}
3839
ignition-transport${IGN_TRANSPORT_VER}::ignition-transport${IGN_TRANSPORT_VER}

src/systems/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@ function(gz_add_system system_name)
3333

3434
set(system_name ${system_name}-system)
3535

36+
37+
if(MSVC)
38+
# Warning #4251 is the "dll-interface" warning that tells you when types
39+
# used by a class are not being exported. These generated source files have
40+
# private members that don't get exported, so they trigger this warning.
41+
# However, the warning is not important since those members do not need to
42+
# be interfaced with.
43+
set_source_files_properties(${sources} COMPILE_FLAGS "/wd4251")
44+
endif()
45+
46+
3647
ign_add_component(${system_name}
3748
SOURCES ${sources}
3849
GET_TARGET_NAME system_target

src/systems/camera_video_recorder/CameraVideoRecorder.hh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ namespace systems
4040
/// not specified, the topic defaults to:
4141
/// /world/<world_name/model/<model_name>/link/<link_name>/
4242
/// sensor/<sensor_name>/record_video
43-
class
44-
CameraVideoRecorder:
43+
class CameraVideoRecorder:
4544
public System,
4645
public ISystemConfigure,
4746
public ISystemPostUpdate

src/systems/kinetic_energy_monitor/KineticEnergyMonitor.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ namespace systems
9797
</plugin>
9898
</model>
9999
\endverbatim */
100-
class IGNITION_GAZEBO_VISIBLE KineticEnergyMonitor:
100+
class KineticEnergyMonitor:
101101
public System,
102102
public ISystemConfigure,
103103
public ISystemPostUpdate

src/systems/logical_audio_sensor_plugin/LogicalAudio.hh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include <ignition/gazebo/components/LogicalAudio.hh>
2323
#include <ignition/gazebo/config.hh>
24+
#include <ignition/gazebo/logicalaudiosensorplugin-system/Export.hh>
2425
#include <ignition/math/Pose3.hh>
2526

2627
namespace ignition
@@ -41,6 +42,7 @@ namespace logical_audio
4142
/// device with a higher detection threshold.
4243
/// \return true if the listening device can detect volume at _volumeLevel,
4344
/// false otherwise.
45+
IGNITION_GAZEBO_LOGICALAUDIOSENSORPLUGIN_SYSTEM_VISIBLE
4446
bool detect(double _volumeLevel, double _volumeDetectionThreshold);
4547

4648
/// \brief Computes the volume level of an audio source at a certain location.
@@ -61,6 +63,7 @@ namespace logical_audio
6163
/// \return The volume level at this location.
6264
/// If the attenuation function or shape is undefined, -1.0 is returned.
6365
/// If the source is not playing, 0.0 is returned.
66+
IGNITION_GAZEBO_LOGICALAUDIOSENSORPLUGIN_SYSTEM_VISIBLE
6467
double computeVolume(bool _playing,
6568
AttenuationFunction _attenuationFunc,
6669
AttenuationShape _attenuationShape,
@@ -83,6 +86,7 @@ namespace logical_audio
8386
/// the calculated attenuation function.
8487
/// \param[in] _str A string that should map to a value in
8588
/// AttenuationFunction.
89+
IGNITION_GAZEBO_LOGICALAUDIOSENSORPLUGIN_SYSTEM_VISIBLE
8690
void setAttenuationFunction(AttenuationFunction &_attenuationFunc,
8791
std::string _str);
8892

@@ -98,6 +102,7 @@ namespace logical_audio
98102
/// calculated attenuation shape.
99103
/// \param[in] _str A string that should map to a value in
100104
/// AttenuationShape.
105+
IGNITION_GAZEBO_LOGICALAUDIOSENSORPLUGIN_SYSTEM_VISIBLE
101106
void setAttenuationShape(AttenuationShape &_attenuationShape,
102107
std::string _str);
103108

@@ -110,13 +115,15 @@ namespace logical_audio
110115
/// source. This value must be greater than _innerRadius.
111116
/// If _falloffDistance < _innerRadius, _falloffDistance will be set to
112117
/// _innerRadius + 1 (assuming that _innerRadius is valid).
118+
IGNITION_GAZEBO_LOGICALAUDIOSENSORPLUGIN_SYSTEM_VISIBLE
113119
void validateInnerRadiusAndFalloffDistance(double &_innerRadius,
114120
double &_falloffDistance);
115121

116122
/// \brief Validate a source's emission volume level.
117123
/// \param[in,out] _volumeLevel The volume the source should play at.
118124
/// This parameter is checked (and possibly clipped) to ensure that it falls
119125
/// between 0.0 (0% volume) and 1.0 (100% volume).
126+
IGNITION_GAZEBO_LOGICALAUDIOSENSORPLUGIN_SYSTEM_VISIBLE
120127
void validateVolumeLevel(double &_volumeLevel);
121128
}
122129
}

test/integration/examples_build.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ bool createAndSwitchToTempDir(std::string &_newTempPath)
7878
#include <windows.h> // NOLINT(build/include_order)
7979
#include <winnt.h> // NOLINT(build/include_order)
8080
#include <cstdint>
81-
#include <ignition/common/PrintWindowsSystemWarning.hh>
8281

8382
/////////////////////////////////////////////////
8483
bool createAndSwitchToTempDir(std::string &_newTempPath)

test/integration/kinetic_energy_monitor_system.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <mutex>
2222

2323
#include <ignition/common/Console.hh>
24+
#include <ignition/common/Util.hh>
2425
#include <ignition/math/Pose3.hh>
2526
#include <ignition/transport/Node.hh>
2627

@@ -38,8 +39,8 @@ class KineticEnergyMonitorTest : public ::testing::Test
3839
protected: void SetUp() override
3940
{
4041
ignition::common::Console::SetVerbosity(4);
41-
setenv("IGN_GAZEBO_SYSTEM_PLUGIN_PATH",
42-
(std::string(PROJECT_BINARY_PATH) + "/lib").c_str(), 1);
42+
ignition::common::setenv("IGN_GAZEBO_SYSTEM_PLUGIN_PATH",
43+
(std::string(PROJECT_BINARY_PATH) + "/lib").c_str());
4344
}
4445
};
4546

test/plugins/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,20 @@ set (test_plugins
1313
EventTriggerSystem
1414
TestModelSystem
1515
TestSensorSystem
16-
TestSystem
1716
TestWorldSystem
1817
MockSystem
1918
Null
2019
)
2120

21+
# TODO: someone with knowledge of ign-plugin please resolve:
22+
# TestSystem.obj : error LNK2001: unresolved external symbol IgnitionPluginHook
23+
if(NOT WIN32)
24+
set (test_plugins
25+
${test_plugins}
26+
TestSystem
27+
)
28+
endif()
29+
2230
# Plugin shared libraries
2331
if(BUILD_TESTING)
2432
foreach (src ${test_plugins})

0 commit comments

Comments
 (0)