From 425914159997c8d1f6a6c4fe801b8cc647a701de Mon Sep 17 00:00:00 2001
From: Joseph Mirabel <jmirabel@laas.fr>
Date: Fri, 9 Nov 2018 15:27:19 +0100
Subject: [PATCH] Fix compilation errors and warnings

---
 CMakeLists.txt                         | 2 +-
 include/gepetto/viewer/corba/server.hh | 6 +++---
 plugins/pyqcustomplot/CMakeLists.txt   | 6 +++++-
 plugins/pyqgv/CMakeLists.txt           | 2 +-
 src/CMakeLists.txt                     | 5 +++++
 src/graphical-interface.impl.cpp       | 2 +-
 src/graphical-interface.impl.hh        | 4 ++--
 src/gui/CMakeLists.txt                 | 4 +---
 src/gui/selection-event.cc             | 6 +++---
 src/gui/tree-item.cc                   | 4 +++-
 10 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c43ff49..fb7ef5e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -62,7 +62,7 @@ IF(NOT CLIENT_ONLY)
   ADD_REQUIRED_DEPENDENCY("gepetto-viewer")
   ADD_REQUIRED_DEPENDENCY("urdfdom")
 
-  SET(BOOST_COMPONENTS system thread regex)
+  SET(BOOST_COMPONENTS system regex)
   SEARCH_FOR_BOOST ()
   FINDPYTHON()
 
diff --git a/include/gepetto/viewer/corba/server.hh b/include/gepetto/viewer/corba/server.hh
index 54c614f..c82ca7d 100644
--- a/include/gepetto/viewer/corba/server.hh
+++ b/include/gepetto/viewer/corba/server.hh
@@ -12,14 +12,14 @@
 # define SCENEVIEWER_CORBASERVER_SERVER_HH
 
 #include "gepetto/viewer/corba/fwd.hh"
-#include <gepetto/viewer/windows-manager.h>
+#include <gepetto/gui/windows-manager.hh>
 
 namespace graphics
 {
   namespace corbaServer
   {
-    using graphics::WindowsManager;
-    using graphics::WindowsManagerPtr_t;
+    using gepetto::gui::WindowsManager;
+    using gepetto::gui::WindowsManagerPtr_t;
 
     /// Implementation of Hpp module Corba server.
 
diff --git a/plugins/pyqcustomplot/CMakeLists.txt b/plugins/pyqcustomplot/CMakeLists.txt
index a751a24..2238f61 100644
--- a/plugins/pyqcustomplot/CMakeLists.txt
+++ b/plugins/pyqcustomplot/CMakeLists.txt
@@ -22,7 +22,7 @@ ELSE()
   SET(QT4 "")
 ENDIF()
 
-INCLUDE_DIRECTORIES("${PYTHON_INCLUDE_DIR}" "${PYTHONQT_INCLUDE_DIR}")
+INCLUDE_DIRECTORIES(SYSTEM "${PYTHON_INCLUDE_DIR}" "${PYTHONQT_INCLUDE_DIR}")
 ADD_DEFINITIONS(-DQCUSTOMPLOT_COMPILE_LIBRARY)
 
 GEPETTO_GUI_PLUGIN(pyqcustomplot
@@ -47,3 +47,7 @@ GEPETTO_GUI_PLUGIN(pyqcustomplot
   PKG_CONFIG_DEPENDENCIES
   omniORB4
   )
+
+SET_SOURCE_FILES_PROPERTIES(qcustomplot.cpp
+  PROPERTIES
+  COMPILE_FLAGS "-Wno-conversion")
diff --git a/plugins/pyqgv/CMakeLists.txt b/plugins/pyqgv/CMakeLists.txt
index 50d1a63..dc3aae7 100644
--- a/plugins/pyqgv/CMakeLists.txt
+++ b/plugins/pyqgv/CMakeLists.txt
@@ -22,7 +22,7 @@ ELSE()
   SET(QT4 "")
 ENDIF()
 
-INCLUDE_DIRECTORIES("${PYTHON_INCLUDE_DIR}" "${PYTHONQT_INCLUDE_DIR}")
+INCLUDE_DIRECTORIES(SYSTEM "${PYTHON_INCLUDE_DIR}" "${PYTHONQT_INCLUDE_DIR}")
 
 GEPETTO_GUI_PLUGIN(pyqgv
   INSIDE_GEPETTO_VIEWER_CORBA
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6da77b4..f808b2b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -63,6 +63,11 @@ IF(NOT CLIENT_ONLY)
     ${CMAKE_CURRENT_BINARY_DIR}/gepetto/viewer/corba/graphical-interface.hh
     ${CMAKE_CURRENT_BINARY_DIR}/gepetto/viewer/corba/graphical-interfaceSK.cc
   )
+  # Removes 5 warnings about anonymous variadic macros that were added from
+  # c++ 11.
+  SET_SOURCE_FILES_PROPERTIES(graphical-interface.impl.cpp
+    PROPERTIES
+    COMPILE_FLAGS "-Wno-variadic-macros")
 
   ADD_DEPENDENCIES (${LIBRARY_NAME} generate_idl_cpp)
   ADD_DEPENDENCIES (${LIBRARY_NAME} generate_idl_python)
diff --git a/src/graphical-interface.impl.cpp b/src/graphical-interface.impl.cpp
index 4cfa29e..4850aea 100644
--- a/src/graphical-interface.impl.cpp
+++ b/src/graphical-interface.impl.cpp
@@ -25,7 +25,7 @@ namespace graphics {
 
         template <typename Input, typename Output>
           void to (const Input& in, Output& out, const int size) {
-            for (CORBA::ULong i = 0; i < size; ++i)
+            for (CORBA::ULong i = 0; i < (CORBA::ULong)size; ++i)
               out[i] = in[i];
           }
 
diff --git a/src/graphical-interface.impl.hh b/src/graphical-interface.impl.hh
index 76f94a6..7b6e6b5 100644
--- a/src/graphical-interface.impl.hh
+++ b/src/graphical-interface.impl.hh
@@ -24,14 +24,14 @@ struct NodeConfiguration {
     osgQuat quat;
 };
 
-using graphics::WindowsManagerPtr_t;
+using gepetto::gui::WindowsManagerPtr_t;
 class GraphicalInterface :
     public virtual POA_gepetto::corbaserver::GraphicalInterface
 {
 private:
     WindowsManagerPtr_t windowsManager_;
     typedef gepetto::Error Error;
-    typedef graphics::WindowsManager::value_type value_type;
+    typedef gepetto::gui::WindowsManager::value_type value_type;
     typedef gepetto::corbaserver::Transform_slice Transform_slice;
 
 public:
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index 0a6c0e8..9d9e6ef 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -18,8 +18,6 @@
 # <http://www.gnu.org/licenses/>.
 
 # Configure the project
-INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/src)
-
 SET (${PROJECT_NAME}_SOURCES
   ${CMAKE_BINARY_DIR}/src/gui/main.cc
   settings.cc
@@ -43,7 +41,7 @@ SET (${PROJECT_NAME}_SOURCES
   )
 
 IF(GEPETTO_GUI_HAS_PYTHONQT)
-  INCLUDE_DIRECTORIES("${PYTHON_INCLUDE_DIR}" "${PYTHONQT_INCLUDE_DIR}")
+  INCLUDE_DIRECTORIES(SYSTEM "${PYTHON_INCLUDE_DIR}" "${PYTHONQT_INCLUDE_DIR}")
   SET (${PROJECT_NAME}_SOURCES
     ${${PROJECT_NAME}_SOURCES}
     pythonwidget.cc)
diff --git a/src/gui/selection-event.cc b/src/gui/selection-event.cc
index 23c3ab6..130e4cc 100644
--- a/src/gui/selection-event.cc
+++ b/src/gui/selection-event.cc
@@ -30,9 +30,9 @@ namespace gepetto {
         out.setZ(in[2]);
       }
       void toQVector3(const osg::Vec3d& in, QVector3D& out) {
-        out.setX(in[0]);
-        out.setY(in[1]);
-        out.setZ(in[2]);
+        out.setX((float)in[0]);
+        out.setY((float)in[1]);
+        out.setZ((float)in[2]);
       }
     }
 
diff --git a/src/gui/tree-item.cc b/src/gui/tree-item.cc
index 6ee5be5..18b683d 100644
--- a/src/gui/tree-item.cc
+++ b/src/gui/tree-item.cc
@@ -28,6 +28,8 @@
 #include <gepetto/gui/bodytreewidget.hh>
 
 namespace gepetto {
+  using graphics::ScopedLock;
+
   namespace gui {
     QWidget* boolPropertyEditor (BodyTreeItem* bti, const graphics::PropertyPtr_t prop)
     {
@@ -177,7 +179,7 @@ namespace gepetto {
         QVariant nameVariant = sender->property("propertyName");
         if (nameVariant.isValid()) {
           std::string name = nameVariant.toString().toStdString();
-          boost::mutex::scoped_lock lock (MainWindow::instance()->osg()->osgFrameMutex());
+          ScopedLock lock (MainWindow::instance()->osg()->osgFrameMutex());
           node_->setProperty<T>(name, value);
         } else {
           qDebug() << "Sender has no property propertyName" << sender;
-- 
GitLab