Build: add WITH_OPENVDB_3_ABI_COMPATIBLE option.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 2 Apr 2018 16:55:10 +0000 (18:55 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 2 Apr 2018 17:13:04 +0000 (19:13 +0200)
Better fix for T54457. It seems Debian compiles OpenVDB without ABI 3
compatibility, while Arch does enable it as is the default in the OpeVDB
CMake build system.

So now there's an option that the distribution can set depending on how
they compile their OpenVDB package.

CMakeLists.txt
intern/openvdb/CMakeLists.txt
intern/openvdb/intern/openvdb_writer.cc

index 566754d..f093086 100644 (file)
@@ -251,6 +251,8 @@ option(WITH_OPENSUBDIV    "Enable OpenSubdiv for surface subdivision" _init_OPEN
 
 option(WITH_OPENVDB       "Enable features relying on OpenVDB" OFF)
 option(WITH_OPENVDB_BLOSC "Enable blosc compression for OpenVDB, only enable if OpenVDB was built with blosc support" OFF)
+option(WITH_OPENVDB_3_ABI_COMPATIBLE "Assume OpenVDB library has been compiled with version 3 ABI compatibility" OFF)
+mark_as_advanced(WITH_OPENVDB_3_ABI_COMPATIBLE)
 
 # GHOST Windowing Library Options
 option(WITH_GHOST_DEBUG   "Enable debugging output for the GHOST library" OFF)
index 4b872f2..f666dc7 100644 (file)
@@ -38,9 +38,14 @@ set(SRC
 if(WITH_OPENVDB)
        add_definitions(
                -DWITH_OPENVDB
-               -DOPENVDB_3_ABI_COMPATIBLE
        )
 
+       if(WITH_OPENVDB_3_ABI_COMPATIBLE)
+               add_definitions(
+                       -DOPENVDB_3_ABI_COMPATIBLE
+               )
+       endif()
+
        list(APPEND INC_SYS
                ${BOOST_INCLUDE_DIR}
                ${TBB_INCLUDE_DIRS}
index b83691a..bedcfe6 100644 (file)
@@ -45,7 +45,7 @@ void OpenVDBWriter::insert(const openvdb::GridBase::Ptr &grid)
 
 void OpenVDBWriter::insert(const openvdb::GridBase &grid)
 {
-#if (OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER >= 3)
+#if (OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER <= 3) || defined(OPENVDB_3_ABI_COMPATIBLE)
        m_grids->push_back(grid.copyGrid());
 #else
        m_grids->push_back(grid.copyGridWithNewTree());