diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ff178007c3f..fd606033aab 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -224,7 +224,4 @@ foreach(CMD_TEST endforeach() -if(NOT WIN32) - add_subdirectory(cmd) -endif() - +add_subdirectory(cmd) diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt index 11e7ef7e00b..21656eb0497 100644 --- a/src/cmd/CMakeLists.txt +++ b/src/cmd/CMakeLists.txt @@ -7,7 +7,13 @@ set(cmd_script_configured "${cmd_script_generated}.configured") # Set the library_location variable to the relative path to the library file # within the install directory structure. -set(library_location "../../../${CMAKE_INSTALL_LIBDIR}/$") +if(WIN32) + set(plugin_location ${CMAKE_INSTALL_BINDIR}) +else() + set(plugin_location ${CMAKE_INSTALL_LIBDIR}) +endif() + +set(library_location "../../../${plugin_location}/$") configure_file( "cmd${IGN_DESIGNATION}.rb.in" diff --git a/src/cmd/ModelCommandAPI.hh b/src/cmd/ModelCommandAPI.hh index 2ca7248c609..c9419364716 100644 --- a/src/cmd/ModelCommandAPI.hh +++ b/src/cmd/ModelCommandAPI.hh @@ -15,8 +15,10 @@ * */ +#include "ignition/gazebo/Export.hh" + /// \brief External hook to get a list of available models. -extern "C" void cmdModelList(); +extern "C" IGNITION_GAZEBO_VISIBLE void cmdModelList(); /// \brief External hook to dump model information. /// \param[in] _modelName Model name. @@ -24,7 +26,7 @@ extern "C" void cmdModelList(); /// \param[in] _linkName Link name. /// \param[in] _jointName Joint name. /// \param[in] _sensorName Sensor name. -extern "C" void cmdModelInfo( +extern "C" IGNITION_GAZEBO_VISIBLE void cmdModelInfo( const char *_modelName, int _pose, const char *_linkName, const char *_jointName, const char *_sensorName); diff --git a/src/cmd/cmdgazebo.rb.in b/src/cmd/cmdgazebo.rb.in index a8937648b05..fa5008a3dd7 100755 --- a/src/cmd/cmdgazebo.rb.in +++ b/src/cmd/cmdgazebo.rb.in @@ -455,6 +455,12 @@ See https://github.com/ignitionrobotics/ign-gazebo/issues/44 for more info." exit(-1) end + if plugin.end_with? ".dll" + puts "`ign gazebo` currently only works with the -s argument on Windows. +See https://github.com/gazebosim/gz-sim/issues/168 for more info." + exit(-1) + end + serverPid = Process.fork do ENV['RMT_PORT'] = '1500' Process.setpgid(0, 0) @@ -512,6 +518,12 @@ See https://github.com/ignitionrobotics/ign-gazebo/issues/44 for more info." exit(-1) end + if plugin.end_with? ".dll" + puts "`ign gazebo` currently only works with the -s argument on Windows. +See https://github.com/gazebosim/gz-sim/issues/168 for more info." + exit(-1) + end + ENV['RMT_PORT'] = '1501' Importer.runGui(options['gui_config'], options['render_engine_gui']) end diff --git a/src/ign.hh b/src/ign.hh index 28e5c26b97f..b09b970c4f4 100644 --- a/src/ign.hh +++ b/src/ign.hh @@ -21,18 +21,18 @@ /// \brief External hook to read the library version. /// \return C-string representing the version. Ex.: 0.1.2 -extern "C" char *ignitionGazeboVersion(); +extern "C" IGNITION_GAZEBO_VISIBLE char *ignitionGazeboVersion(); /// \brief Get the Gazebo version header. /// \return C-string containing the Gazebo version information. -extern "C" char *gazeboVersionHeader(); +extern "C" IGNITION_GAZEBO_VISIBLE char *gazeboVersionHeader(); /// \brief Set verbosity level /// \param[in] _verbosity 0 to 4 -extern "C" void cmdVerbosity( +extern "C" IGNITION_GAZEBO_VISIBLE void cmdVerbosity( const char *_verbosity); -extern "C" const char *worldInstallDir(); +extern "C" IGNITION_GAZEBO_VISIBLE const char *worldInstallDir(); /// \brief External hook to run simulation server. /// \param[in] _sdfString SDF file to run, as a string. @@ -56,7 +56,7 @@ extern "C" const char *worldInstallDir(); /// null to record the default topics. /// \param[in] _headless True if server rendering should run headless /// \return 0 if successful, 1 if not. -extern "C" int runServer(const char *_sdfString, +extern "C" IGNITION_GAZEBO_VISIBLE int runServer(const char *_sdfString, int _iterations, int _run, float _hz, int _levels, const char *_networkRole, int _networkSecondaries, int _record, const char *_recordPath, int _recordResources, int _logOverwrite, @@ -69,13 +69,13 @@ extern "C" int runServer(const char *_sdfString, /// \param[in] _guiConfig Path to Ignition GUI configuration file. /// \param[in] _renderEngine --render-engine-gui option /// \return 0 if successful, 1 if not. -extern "C" int runGui(const char *_guiConfig, const char *_renderEngine); +extern "C" IGNITION_GAZEBO_VISIBLE int runGui(const char *_guiConfig, const char *_renderEngine); /// \brief External hook to find or download a fuel world provided a URL. /// \param[in] _pathToResource Path to the fuel world resource, ie, /// https://staging-fuel.ignitionrobotics.org/1.0/gmas/worlds/ShapesClone /// \return C-string containing the path to the local world sdf file -extern "C" const char *findFuelResource( +extern "C" IGNITION_GAZEBO_VISIBLE const char *findFuelResource( char *_pathToResource); #endif diff --git a/src/systems/CMakeLists.txt b/src/systems/CMakeLists.txt index 043ffea86e3..d068e9aded0 100644 --- a/src/systems/CMakeLists.txt +++ b/src/systems/CMakeLists.txt @@ -82,10 +82,9 @@ function(gz_add_system system_name) set(unversioned ${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME_NO_VERSION_LOWER}-${system_name}${CMAKE_SHARED_LIBRARY_SUFFIX}) if(WIN32) # symlinks on Windows require admin priviledges, fallback to copy - ADD_CUSTOM_COMMAND(TARGET ${system_target} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy - "$" - "$/${unversioned}") + INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy + ${IGNITION_GAZEBO_PLUGIN_INSTALL_DIR}\/${versioned} + ${IGNITION_GAZEBO_PLUGIN_INSTALL_DIR}\/${unversioned})") else() file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/lib") EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink ${versioned} ${unversioned} WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/lib")