From 049aa4ef3eae92bf6f7a55e5423f3b6fa7b32cb7 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Wed, 5 Feb 2014 23:48:00 -0700 Subject: [PATCH] Fix export API detection (for assimp < 2.0.885) It looks like this API was added in Assimp 2.0.885: https://github.com/assimp/assimp/commit/ae23c03bd9a0b5f1227dc0042fd98f7206c770a8 --- collada_urdf/CMakeLists.txt | 3 +++ collada_urdf/src/collada_to_urdf.cpp | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/collada_urdf/CMakeLists.txt b/collada_urdf/CMakeLists.txt index ee25ed3..bca56e9 100644 --- a/collada_urdf/CMakeLists.txt +++ b/collada_urdf/CMakeLists.txt @@ -27,6 +27,9 @@ if( ASSIMP_FOUND ) if( NOT ${ASSIMP_VERSION} STRLESS "2.0.1150" ) add_definitions(-DASSIMP_UNIFIED_HEADER_NAMES) endif() + if( NOT ${ASSIMP_VERSION} STRLESS "2.0.885" ) + add_definitions(-DASSIMP_EXPORT_API) + endif() include_directories(${ASSIMP_INCLUDE_DIRS}) link_directories(${ASSIMP_LIBRARY_DIRS}) else() diff --git a/collada_urdf/src/collada_to_urdf.cpp b/collada_urdf/src/collada_to_urdf.cpp index 0a0d08f..3a4d6e6 100644 --- a/collada_urdf/src/collada_to_urdf.cpp +++ b/collada_urdf/src/collada_to_urdf.cpp @@ -14,7 +14,9 @@ #include #else #include +#if defined(ASSIMP_EXPORT_API) #include +#endif #include #include #endif @@ -67,6 +69,7 @@ os << "xyz: " << origin.position.x << " " << origin.position.y << " " << origin. void assimp_file_export(std::string fname, std::string ofname, std::string mesh_type = "collada") { +#if defined(ASSIMP_EXPORT_API) if (fname.find("file://") == 0) { fname.erase(0, strlen("file://")); } @@ -100,6 +103,7 @@ void assimp_file_export(std::string fname, std::string ofname, std::string str( "assimp error" ); std::cerr << ";; " << str << std::endl; } +#endif } // assimp bounding box calculation @@ -593,7 +597,9 @@ int main(int argc, char** argv) cerr << ";; Adding gazebo description" << endl; } if (vm.count("use_assimp_export")) { +#if defined(ASSIMP_EXPORT_API) use_assimp_export = true; +#endif cerr << ";; Use assimp export" << endl; } if (vm.count("original_inertia_rotation")) {