compile collada_urdf with c++11 standard (redux) (#145)

* compile collada_urdf with c++11 standard

as the gnu-specific keyword "typeof" is used in the code,
the gnu 11 standard has to be specified.

cmake_minimum_required increased to have add_compile_options around.

* use decltype and check for flag before passing it

* disable some warnings and fix cxx flag check
This commit is contained in:
William Woodall 2016-08-23 14:33:38 -07:00 committed by GitHub
parent 2dfb8a2606
commit dbd8907ce1
4 changed files with 27 additions and 2 deletions

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.3) cmake_minimum_required(VERSION 2.8.12)
project(collada_urdf) project(collada_urdf)
find_package(catkin REQUIRED COMPONENTS angles collada_parser resource_retriever urdf geometric_shapes tf cmake_modules) find_package(catkin REQUIRED COMPONENTS angles collada_parser resource_retriever urdf geometric_shapes tf cmake_modules)
@ -10,6 +10,12 @@ catkin_package(
INCLUDE_DIRS include INCLUDE_DIRS include
DEPENDS angles collada_parser resource_retriever urdf geometric_shapes tf) DEPENDS angles collada_parser resource_retriever urdf geometric_shapes tf)
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-std=c++11 HAS_STD_CPP11_FLAG)
if(HAS_STD_CPP11_FLAG)
add_compile_options(-std=c++11)
endif()
include_directories(include) include_directories(include)
find_package(assimp QUIET) find_package(assimp QUIET)

View File

@ -39,7 +39,14 @@
#include <string> #include <string>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#ifndef _WIN32
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <dae.h> #include <dae.h>
#pragma GCC diagnostic pop
#endif
#include "urdf/model.h" #include "urdf/model.h"
namespace collada_urdf { namespace collada_urdf {

View File

@ -40,6 +40,9 @@
#include <vector> #include <vector>
#include <list> #include <list>
#ifndef _WIN32
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <dae.h> #include <dae.h>
#include <dae/daeDocument.h> #include <dae/daeDocument.h>
#include <dae/daeErrorHandler.h> #include <dae/daeErrorHandler.h>
@ -49,6 +52,9 @@
#include <dom/domElements.h> #include <dom/domElements.h>
#include <dom/domTriangles.h> #include <dom/domTriangles.h>
#include <dom/domTypes.h> #include <dom/domTypes.h>
#pragma GCC diagnostic pop
#endif
#include <resource_retriever/retriever.h> #include <resource_retriever/retriever.h>
#include <urdf/model.h> #include <urdf/model.h>
#include <urdf_model/pose.h> #include <urdf_model/pose.h>
@ -82,7 +88,7 @@
#include <geometric_shapes/shapes.h> #include <geometric_shapes/shapes.h>
#include <geometric_shapes/mesh_operations.h> #include <geometric_shapes/mesh_operations.h>
#define FOREACH(it, v) for(typeof((v).begin())it = (v).begin(); it != (v).end(); (it)++) #define FOREACH(it, v) for(decltype((v).begin()) it = (v).begin(); it != (v).end(); (it)++)
#define FOREACHC FOREACH #define FOREACHC FOREACH
using namespace std; using namespace std;

View File

@ -34,7 +34,13 @@
/* Author: Tim Field */ /* Author: Tim Field */
#ifndef _WIN32
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include "collada_urdf/collada_urdf.h" #include "collada_urdf/collada_urdf.h"
#pragma GCC diagnostic pop
#endif
#include <ros/ros.h> #include <ros/ros.h>
int main(int argc, char** argv) int main(int argc, char** argv)