diff --git a/CMakeLists.txt b/CMakeLists.txt index bbc629af3cc40..773967400cdab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,6 +150,51 @@ endif() find_package(ASSIMP 3.0.0 QUIET) if(ASSIMP_FOUND) message(STATUS "Looking for ASSIMP - ${ASSIMP_VERSION} found") + + # Check for missing symbols in ASSIMP (see #451) + include(CheckCXXSourceCompiles) + set(CMAKE_REQUIRED_INCLUDES ${ASSIMP_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES ${ASSIMP_LIBRARIES}) + + check_cxx_source_compiles( + " + #include + int main() + { + aiScene* scene = new aiScene; + delete scene; + return 1; + } + " + ASSIMP_AISCENE_CTOR_DTOR_DEFINED) + + if(NOT ASSIMP_AISCENE_CTOR_DTOR_DEFINED) + message(WARNING "Installed ASSIMP ${ASSIMP_VERSION} is missing symbols " + "for constructor or destructor of aiScene. DART will use own " + "implementation. Please use ASSIMP that fixed this issue.") + endif(NOT ASSIMP_AISCENE_CTOR_DTOR_DEFINED) + + check_cxx_source_compiles( + " + #include + int main() + { + aiMaterial* material = new aiMaterial; + delete material; + return 1; + } + " + ASSIMP_AIMATERIAL_CTOR_DTOR_DEFINED) + + if(NOT ASSIMP_AIMATERIAL_CTOR_DTOR_DEFINED) + message(WARNING "Installed ASSIMP ${ASSIMP_VERSION} is missing symbols " + "for constructor or destructor of aiMaterial. DART will use own " + "implementation. Please use ASSIMP that fixed this issue.") + endif(NOT ASSIMP_AIMATERIAL_CTOR_DTOR_DEFINED) + + unset(CMAKE_REQUIRED_INCLUDES) + unset(CMAKE_REQUIRED_LIBRARIES) + else() if(ASSIMP_VERSION) message(SEND_ERROR "Looking for ASSIMP - ${ASSIMP_VERSION} found, ${PROJECT_NAME} requires 3.0.0 or greater.") @@ -410,7 +455,7 @@ endif() #=============================================================================== execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/case_sensitive_filesystem RESULT_VARIABLE FILESYSTEM_CASE_SENSITIVE_RETURN) -if (${FILESYSTEM_CASE_SENSITIVE_RETURN} EQUAL 0) +if(${FILESYSTEM_CASE_SENSITIVE_RETURN} EQUAL 0) set(FILESYSTEM_CASE_SENSITIVE TRUE) else() set(FILESYSTEM_CASE_SENSITIVE FALSE) diff --git a/dart/config.h.in b/dart/config.h.in index dfd5fb2ed7996..588c24f91bfc9 100644 --- a/dart/config.h.in +++ b/dart/config.h.in @@ -50,4 +50,8 @@ #define DART_ROOT_PATH "@CMAKE_SOURCE_DIR@/" #define DART_DATA_PATH "@CMAKE_SOURCE_DIR@/data/" +// See #451 +#cmakedefine ASSIMP_AISCENE_CTOR_DTOR_DEFINED 1 +#cmakedefine ASSIMP_AIMATERIAL_CTOR_DTOR_DEFINED 1 + #endif // #ifndef DART_CONFIG_H_ diff --git a/dart/dynamics/MeshShape.cpp b/dart/dynamics/MeshShape.cpp index a78344ecc34b5..0621a1edbb586 100644 --- a/dart/dynamics/MeshShape.cpp +++ b/dart/dynamics/MeshShape.cpp @@ -44,14 +44,16 @@ #include #include +#include "dart/config.h" #include "dart/renderer/RenderInterface.h" #include "dart/common/Console.h" #include "dart/dynamics/AssimpInputResourceAdaptor.h" #include "dart/common/LocalResourceRetriever.h" #include "dart/common/Uri.h" -// We define our own constructor for aiScene, because it seems to be missing -// from the standard assimp library +#ifndef ASSIMP_AISCENE_CTOR_DTOR_DEFINED +// We define our own constructor and destructor for aiScene, because it seems to +// be missing from the standard assimp library (see #451) aiScene::aiScene() : mFlags(0), mRootNode(nullptr), @@ -70,8 +72,6 @@ aiScene::aiScene() } -// We define our own destructor for aiScene, because it seems to be missing -// from the standard assimp library aiScene::~aiScene() { delete mRootNode; @@ -106,9 +106,11 @@ aiScene::~aiScene() delete mCameras[a]; delete[] mCameras; } +#endif // #ifndef ASSIMP_AISCENE_CTOR_DTOR_DEFINED -// We define our own constructor for aiMaterial, because it seems to be missing -// from the standard assimp library +// We define our own constructor and destructor for aiMaterial, because it seems +// to be missing from the standard assimp library (see #451) +#ifndef ASSIMP_AIMATERIAL_CTOR_DTOR_DEFINED aiMaterial::aiMaterial() { mNumProperties = 0; @@ -118,8 +120,6 @@ aiMaterial::aiMaterial() mProperties[i] = nullptr; } -// We define our own destructor for aiMaterial, because it seems to be missing -// from the standard assimp library aiMaterial::~aiMaterial() { for(size_t i=0; i= 9), libeigen3-dev, libfcl-dev (>= 0.2.7), libassimp-dev (>= 3), - libassimp-dev (<< 3.0~dfsg-4), freeglut3-dev, libxi-dev, libxmu-dev, @@ -32,7 +31,6 @@ Depends: ${misc:Depends}, libdart-core5.1 (= ${binary:Version}), libeigen3-dev, libassimp-dev (>= 3), - libassimp-dev (<< 3.0~dfsg-4), libfcl-dev, libboost-dev (>= 1.54.0.1ubuntu1) Description: Dynamic Animation and Robotics Toolkit, core development files