From 91da15b1cb1597d3e29be442cea0e77a3639b8ff Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Thu, 3 Jan 2019 00:29:06 +0100 Subject: [PATCH 1/4] Fix errors in DepthCameraDriver.cpp Fix missing yarp:: before sig::Matrix Fix missing return value in getDepthClipPlanes --- plugins/depthCamera/src/DepthCameraDriver.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/depthCamera/src/DepthCameraDriver.cpp b/plugins/depthCamera/src/DepthCameraDriver.cpp index d087388ff..e674f7a21 100644 --- a/plugins/depthCamera/src/DepthCameraDriver.cpp +++ b/plugins/depthCamera/src/DepthCameraDriver.cpp @@ -376,6 +376,7 @@ bool GazeboYarpDepthCameraDriver::getDepthClipPlanes(double& nearPlane, double& { nearPlane = m_depthCameraSensorPtr->DepthCamera()->NearClip(); farPlane = m_depthCameraSensorPtr->DepthCamera()->FarClip(); + return true; } bool GazeboYarpDepthCameraDriver::setDepthClipPlanes(double nearPlane, double farPlane) { @@ -415,7 +416,7 @@ bool GazeboYarpDepthCameraDriver::getDepthImage(depthImageType& depthImage, Stam m_depthFrameMutex.post(); return true; } -bool GazeboYarpDepthCameraDriver::getExtrinsicParam(sig::Matrix& extrinsic) +bool GazeboYarpDepthCameraDriver::getExtrinsicParam(yarp::sig::Matrix& extrinsic) { extrinsic.resize(4, 4); extrinsic.zero(); From b05fa5656222caf5a8bb2468b2a06db84f4c02f6 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Thu, 3 Jan 2019 00:30:16 +0100 Subject: [PATCH 2/4] On Windows define a few preprocessor symbol to correctly load Gazebo includes --- cmake/AddGazeboYarpPluginTarget.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmake/AddGazeboYarpPluginTarget.cmake b/cmake/AddGazeboYarpPluginTarget.cmake index 46743bb0e..20043bbee 100644 --- a/cmake/AddGazeboYarpPluginTarget.cmake +++ b/cmake/AddGazeboYarpPluginTarget.cmake @@ -57,10 +57,18 @@ endif() add_library(${GAZEBO_PLUGIN_LIBRARY_NAME} ${LIBRARY_TYPE} ${GAZEBO_PLUGIN_SOURCES} ${GAZEBO_PLUGIN_HEADERS}) target_link_libraries(${GAZEBO_PLUGIN_LIBRARY_NAME} ${GAZEBO_PLUGIN_LINKED_LIBRARIES}) + target_include_directories(${GAZEBO_PLUGIN_LIBRARY_NAME} PUBLIC $ "$") +if(MSVC) + # On Visual Studio, it is necessary to define this Windows-specific macros + # to get Gazebo headers to compile without problems, for more details + # see https://stackoverflow.com/questions/5971332/redefinition-errors-in-winsock2-h + target_compile_definitions(${GAZEBO_PLUGIN_LIBRARY_NAME} PUBLIC NOMINMAX WIN32_LEAN_AND_MEAN _USE_MATH_DEFINES) +endif() + # Add install target install(TARGETS ${GAZEBO_PLUGIN_LIBRARY_NAME} EXPORT GazeboYARPPlugins From c7f2003e45b0f9a373e0f0397ce2c13eab36e704 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Thu, 3 Jan 2019 00:31:43 +0100 Subject: [PATCH 3/4] Add missing RUNTIME DESTINATION in linkattacher install(TARGETS --- thrift/linkattacher/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/thrift/linkattacher/CMakeLists.txt b/thrift/linkattacher/CMakeLists.txt index 717360650..89b6ab931 100644 --- a/thrift/linkattacher/CMakeLists.txt +++ b/thrift/linkattacher/CMakeLists.txt @@ -22,7 +22,8 @@ set_property(TARGET ${LIBRARY_TARGET_NAME} PROPERTY PUBLIC_HEADER "${LARPC_HEADE install(TARGETS ${LIBRARY_TARGET_NAME} EXPORT ${PROJECT_NAME} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gazebo) set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_TARGETS ${LIBRARY_TARGET_NAME}) From 80d749b55d30614472a746e677365efe9dfb7839 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Thu, 3 Jan 2019 00:32:29 +0100 Subject: [PATCH 4/4] General CMake cleanup for building on Windows * Add workaround for https://github.com/ms-iot/ROSOnWindows/issues/48 * Cleanup unnecessary find_package calls * Bump minimum required cmake version to 3.5 (YARP 3.1 already requires 3.5) due to use of target_compile_definitons --- CMakeLists.txt | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f7e86f339..2816c43a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ # Authors: Enrico Mingo, Alessio Rocchi, Mirko Ferrati, Silvio Traversaro, Alessandro Settimi and Francesco Romano # CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT -cmake_minimum_required(VERSION 2.8.7) +cmake_minimum_required(VERSION 3.5) PROJECT(GazeboYARPPlugins) # Project version @@ -18,19 +18,28 @@ include(GNUInstallDirs) # Finding dependencies find_package(YARP 3.0.101 REQUIRED) -find_package(Boost REQUIRED serialization system) -find_package(Protobuf REQUIRED) find_package(Gazebo REQUIRED) if (Gazebo_VERSION_MAJOR LESS 7.0) message(status "Gazebo version : " ${Gazebo_VERSION_MAJOR}.${Gazebo_VERSION_MINOR}.${Gazebo_VERSION_PATCH}) message(FATAL_ERROR "Your Gazebo version is older than Gazebo 7.0. Gazebo Yarp plugins are supported with gazebo versions >= 7.0. Please update to a newer version") endif() -find_package(SDFormat REQUIRED) -find_package(OGRE QUIET) + +# Custom workaround for chocolatey distributed Gazebo and OGRE +# See https://github.com/ms-iot/ROSOnWindows/issues/48 for the original issue +if(MSVC) + find_package(OGRE REQUIRED CONFIG) + # It is tipically better to use target_include_directories in place of + # global include_directories, but in this case it is more compact to use include_directories + include_directories(${OGRE_Paging_INCLUDE_DIRS}) +endif() + # Add Gazebo CXX flags, to support Gazebo 6 reckless dependency on C++11 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GAZEBO_CXX_FLAGS}") +# On Windows, export all symbols by default as *nix +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + # add local cmake scripts set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)