Skip to content

Commit

Permalink
Merge pull request #130 from mwestphal/adding_openvdb
Browse files Browse the repository at this point in the history
Adding openvdb to the superbuild
  • Loading branch information
mwestphal authored Jan 5, 2024
2 parents e57490a + cbe8a86 commit ffa71c9
Show file tree
Hide file tree
Showing 15 changed files with 206 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/actions/f3d-superbuild/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ runs:
echo VTK_COMMIT_SHA=`cat ./vtk_commit_sha` >> $GITHUB_ENV
# OCCT coloring is disabled on macOS because of f3d-app/f3d#792
# OpenVDB is disabled on macOS arm64 because boost project in common-superbuild does not support choosing architecture yet
- name: Configure
working-directory: ${{github.workspace}}/build
shell: bash
Expand All @@ -86,13 +87,15 @@ runs:
-DBUILD_SHARED_LIBS_imath=OFF
-DBUILD_SHARED_LIBS_occt=OFF
-DBUILD_SHARED_LIBS_openusd=ON
-DBUILD_SHARED_LIBS_openvdb=OFF
-DBUILD_SHARED_LIBS_vtk=OFF
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
-DCMAKE_C_COMPILER_LAUNCHER=sccache
-DENABLE_egl=${{ inputs.egl_label == 'egl' && 'ON' || 'OFF' }}
-DENABLE_ospray=${{ inputs.raytracing_label == 'raytracing' && 'ON' || 'OFF' }}
-DENABLE_exodus=${{ contains(env.CMAKE_OSX_ARCHITECTURES, 'arm64') && 'OFF' || 'ON' }}
-DENABLE_openvdb=${{ contains(env.CMAKE_OSX_ARCHITECTURES, 'arm64') && 'OFF' || 'ON' }}
-DOCCT_ENABLE_COLORING=${{ runner.os == 'macOS' && 'OFF' || 'ON' }}
-DUSE_SYSTEM_python3=ON
-Df3d_GIT_TAG=${{ inputs.f3d_version }}
Expand Down
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,21 @@ function (superbuild_find_projects var)
assimp
boost
cxx11
cxx17
boost
draco
embree
exodus
f3d
hdf5
imath
ispc
lz4
netcdf
occt
openexr
openimagedenoise
openvdb
openvkl
ospray
ospraymaterials
Expand All @@ -57,6 +61,8 @@ function (superbuild_find_projects var)
openusd
vtk
xz
blosc
zstd
zlib)

if (UNIX)
Expand Down Expand Up @@ -104,6 +110,12 @@ function (superbuild_add_packaging)

endfunction ()

if (NOT CMAKE_OSX_ARCHITECTURES EQUAL "arm64")
set(boost_libraries
iostreams # Required by openvdb
system)
endif ()

function (superbuild_add_tests)
add_subdirectory("${CMAKE_SOURCE_DIR}/testing" "${CMAKE_BINARY_DIR}/Testing")
endfunction ()
Expand All @@ -123,6 +135,7 @@ set(_superbuild_default_assimp ON)
set(_superbuild_default_draco ON)
set(_superbuild_default_exodus ON)
set(_superbuild_default_occt ON)
set(_superbuild_default_openvdb ON)
set(_superbuild_default_openexr ON)
set(_superbuild_default_ospray ON)
set(_superbuild_default_pybind11 OFF)
Expand Down
3 changes: 2 additions & 1 deletion projects/f3d.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ superbuild_add_project(f3d
LICENSE.md
doc/THIRD_PARTY_LICENSES.md
DEPENDS vtk
DEPENDS_OPTIONAL pybind11 alembic assimp draco occt openexr openusd
DEPENDS_OPTIONAL pybind11 alembic assimp draco occt openexr openusd openvdb
CMAKE_ARGS
-Werror=dev
-Werror=deprecated
Expand All @@ -39,6 +39,7 @@ superbuild_add_project(f3d
-DF3D_PLUGIN_BUILD_EXODUS:BOOL=${exodus_enabled}
-DF3D_PLUGIN_BUILD_OCCT:BOOL=${occt_enabled}
-DF3D_PLUGIN_BUILD_USD:BOOL=${openusd_enabled}
-DF3D_PLUGIN_BUILD_VDB:BOOL=${openvdb_enabled}
-DF3D_BINDINGS_PYTHON:BOOL=${f3d_build_python_bindings}
-DF3D_STRICT_BUILD:BOOL=ON
-DF3D_WINDOWS_GUI:BOOL=${f3d_build_for_windows}
Expand Down
53 changes: 53 additions & 0 deletions projects/openvdb.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
if (NOT BUILD_SHARED_LIBS_openvdb STREQUAL "<same>")
set(openvdb_build_shared ${BUILD_SHARED_LIBS_openvdb})
else ()
set(openvdb_build_shared ${BUILD_SHARED_LIBS})
endif ()
if (openvdb_build_shared)
set(openvdb_build_static OFF)
else ()
set(openvdb_build_static ON)
endif ()

# CMAKE_MSVC_RUNTIME_LIBRARY is needed because of https://github.com/AcademySoftwareFoundation/openvdb/issues/1131
superbuild_add_project(openvdb
BUILD_SHARED_LIBS_INDEPENDENT
DEPENDS tbb cxx17 blosc zlib boost lz4 zstd
LICENSE_FILES
LICENSE
CMAKE_ARGS
-DCMAKE_INSTALL_LIBDIR:PATH=lib
-DCMAKE_MSVC_RUNTIME_LIBRARY:STRING=MultiThreadedDLL
-DOPENVDB_BUILD_VDB_PRINT:BOOL=OFF
-DOPENVDB_CORE_SHARED:BOOL=${openvdb_build_shared}
-DOPENVDB_CORE_STATIC:BOOL=${openvdb_build_static}
-DUSE_BLOSC:BOOL=ON
-DUSE_CCACHE:BOOL=OFF
-DUSE_EXPLICIT_INSTANTIATION:BOOL=OFF
-DUSE_ZLIB:BOOL=ON)

# Boost_USE_STATIC_LIBS is needed on Windows because FindBoost.cmake default to static there
# OPENVDB_USE_STATIC_LIBS is needed because FindOpenVDB.cmake is not smart enough to find it out itself
# CMAKE_MODULE_PATH is needed because of https://github.com/AcademySoftwareFoundation/openvdb/issues/1160
superbuild_add_extra_cmake_args(
-DBoost_USE_STATIC_LIBS:BOOL=OFF
-DCMAKE_MODULE_PATH:PATH=<INSTALL_DIR>/lib/cmake/OpenVDB
-DOPENVDB_USE_STATIC_LIBS:BOOL=${openvdb_build_static}
)

# https://github.com/AcademySoftwareFoundation/openvdb/issues/1747
superbuild_apply_patch(openvdb decrease-gcc-min-ver
"Decrease GCC minimum version")

# https://github.com/AcademySoftwareFoundation/openvdb/issues/1741
# https://github.com/AcademySoftwareFoundation/openvdb/issues/1740
superbuild_apply_patch(openvdb remove-not-needed-cmake-modules
"Remove not needed cmake modules")

# https://github.com/AcademySoftwareFoundation/openvdb/issues/1630
superbuild_apply_patch(openvdb fix-visible-dependencies-link
"Fix visible dependencies link")

# https://github.com/AcademySoftwareFoundation/openvdb/issues/1630
superbuild_apply_patch(openvdb remove-lib-prefix-static
"Remove lib prefix with static lib")
25 changes: 25 additions & 0 deletions projects/patches/openvdb-decrease-gcc-min-ver.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From ef0a2522977d76bfe760c2506084a7da733d3890 Mon Sep 17 00:00:00 2001
From: Mathieu Westphal <[email protected]>
Date: Thu, 21 Dec 2023 07:51:00 +0100
Subject: [PATCH] Decrease gcc version

---
cmake/config/OpenVDBVersions.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmake/config/OpenVDBVersions.cmake b/cmake/config/OpenVDBVersions.cmake
index 7caace6..f956b8f 100644
--- a/cmake/config/OpenVDBVersions.cmake
+++ b/cmake/config/OpenVDBVersions.cmake
@@ -34,7 +34,7 @@ if(NOT DISABLE_DEPENDENCY_VERSION_CHECKS)
# What's usually important is that the version of libstdc++ and glibc in use
# matches. Compilers other than GCC should provide options to ensure this
# targetting e.g. --gcc-toolchain and -fgnuc-version with Clang.
- set(MINIMUM_GCC_VERSION 9.3.1)
+ set(MINIMUM_GCC_VERSION 8.4.0)
set(MINIMUM_CLANG_VERSION 5.0)
set(MINIMUM_ICC_VERSION 19)
set(MINIMUM_MSVC_VERSION 19.28) # 1928 (Visual Studio 2019 Version 16.8 + 16.9)
--
2.43.0

35 changes: 35 additions & 0 deletions projects/patches/openvdb-fix-visible-dependencies-link.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From 2da63bf76ba370840c5f3cb2f88b2a28c47bf2d7 Mon Sep 17 00:00:00 2001
From: Mathieu Westphal <[email protected]>
Date: Wed, 3 Jan 2024 19:46:04 +0100
Subject: [PATCH] visible deps

---
cmake/FindOpenVDB.cmake | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/cmake/FindOpenVDB.cmake b/cmake/FindOpenVDB.cmake
index c4213c8..d988db6 100644
--- a/cmake/FindOpenVDB.cmake
+++ b/cmake/FindOpenVDB.cmake
@@ -692,13 +692,11 @@ endif()

set(_OPENVDB_HIDDEN_DEPENDENCIES)

-if(NOT OPENVDB_USE_STATIC_LIBS)
- if(OpenVDB_USES_BLOSC)
- list(APPEND _OPENVDB_HIDDEN_DEPENDENCIES Blosc::blosc)
- endif()
- if(OpenVDB_USES_ZLIB)
- list(APPEND _OPENVDB_HIDDEN_DEPENDENCIES ZLIB::ZLIB)
- endif()
+if(OpenVDB_USES_BLOSC)
+ list(APPEND _OPENVDB_VISIBLE_DEPENDENCIES Blosc::blosc)
+endif()
+if(OpenVDB_USES_ZLIB)
+ list(APPEND _OPENVDB_VISIBLE_DEPENDENCIES ZLIB::ZLIB)
endif()

if(openvdb_je IN_LIST OpenVDB_FIND_COMPONENTS)
--
2.43.0

24 changes: 24 additions & 0 deletions projects/patches/openvdb-remove-lib-prefix-static.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From 1f41a0d72b6f51f117888adece18a61a2a11c6e7 Mon Sep 17 00:00:00 2001
From: Mathieu Westphal <[email protected]>
Date: Mon, 1 Jan 2024 14:59:26 +0100
Subject: [PATCH] openvdb remove lib prefix static

---
openvdb/openvdb/CMakeLists.txt | 1 -
1 file changed, 1 deletion(-)

diff --git a/openvdb/openvdb/CMakeLists.txt b/openvdb/openvdb/CMakeLists.txt
index 33d4e5c..2c16443 100644
--- a/openvdb/openvdb/CMakeLists.txt
+++ b/openvdb/openvdb/CMakeLists.txt
@@ -678,7 +678,6 @@ if(OPENVDB_CORE_STATIC)
target_compile_options(openvdb_static PUBLIC
"$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/MT$<$<CONFIG:Debug>:d>>")
endif()
- set_target_properties(openvdb_static PROPERTIES PREFIX "lib")
endif()
endif()

--
2.35.1.windows.2

28 changes: 28 additions & 0 deletions projects/patches/openvdb-remove-not-needed-cmake-modules.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From 6fdc28ccdc156535b20f8f446d7a6f21e3f0973c Mon Sep 17 00:00:00 2001
From: Mathieu Westphal <[email protected]>
Date: Sun, 24 Dec 2023 00:45:04 +0800
Subject: [PATCH] Remove not needed cmake modules

---
CMakeLists.txt | 4 ----
1 file changed, 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8329dda..fe1dd23 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -285,11 +285,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
if(OPENVDB_INSTALL_CMAKE_MODULES)
set(OPENVDB_CMAKE_MODULES
cmake/FindBlosc.cmake
- cmake/FindJemalloc.cmake
- cmake/FindLog4cplus.cmake
- cmake/FindOpenEXR.cmake
cmake/FindOpenVDB.cmake
- cmake/FindTBB.cmake
cmake/OpenVDBGLFW3Setup.cmake
cmake/OpenVDBHoudiniSetup.cmake
cmake/OpenVDBMayaSetup.cmake
--
2.43.0

Binary file added projects/patches/openvdb.zip
Binary file not shown.
8 changes: 7 additions & 1 deletion projects/vtk.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ if (exodus_enabled)
set(vtk_ioexodus_enabled YES)
endif ()

set(vtk_ioopenvdb_enabled NO)
if (openvdb_enabled)
set(vtk_ioopenvdb_enabled YES)
endif ()

set(vtk_use_x NO)
set(vtk_platform_dependencies)
if (UNIX)
Expand All @@ -32,7 +37,7 @@ superbuild_add_project(vtk
LICENSE_FILES
Copyright.txt
DEPENDS cxx11
DEPENDS_OPTIONAL tbb ospray exodus ${vtk_platform_dependencies}
DEPENDS_OPTIONAL tbb ospray exodus openvdb ${vtk_platform_dependencies}
CMAKE_ARGS
-DVTKOSPRAY_ENABLE_DENOISER:BOOL=${ospray_enabled}
-DVTK_BUILD_TESTING:BOOL=OFF
Expand All @@ -51,6 +56,7 @@ superbuild_add_project(vtk
-DVTK_MODULE_ENABLE_VTK_IOImage:STRING=YES
-DVTK_MODULE_ENABLE_VTK_IOImport:STRING=YES
-DVTK_MODULE_ENABLE_VTK_IOPLY:STRING=YES
-DVTK_MODULE_ENABLE_VTK_IOOpenVDB:STRING=${vtk_ioopenvdb_enabled}
-DVTK_MODULE_ENABLE_VTK_IOParallel:STRING=YES
-DVTK_MODULE_ENABLE_VTK_IOXML:STRING=YES
-DVTK_MODULE_ENABLE_VTK_ImagingCore:STRING=YES
Expand Down
2 changes: 1 addition & 1 deletion superbuild
Submodule superbuild updated from 5dd2ff to 8bd27b
4 changes: 4 additions & 0 deletions testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,7 @@ endif ()
if (openusd_enabled)
f3d_add_test(TestUSD primitives.usda)
endif ()

if (openvdb_enabled)
f3d_add_test(TestVDB icosahedron.vdb)
endif ()
3 changes: 3 additions & 0 deletions testing/baselines/TestVDB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions testing/data/icosahedron.vdb
Git LFS file not shown
5 changes: 5 additions & 0 deletions versions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ superbuild_set_revision(openusd
DOWNLOAD_NAME openusd-v23.05.tar.gz
URL_MD5 7318076a73ee76ac4221c63f01b2906f)

superbuild_set_revision(openvdb
URL "https://github.com/AcademySoftwareFoundation/openvdb/archive/refs/tags/v11.0.0.tar.gz"
DOWNLOAD_NAME openvdb-v11.0.0.tar.gz
URL_MD5 025f4fc4db58419341a4991f1a16174a)

superbuild_set_selectable_source(vtk
SELECT 9.3.0 DEFAULT
URL "https://www.vtk.org/files/release/9.3/VTK-9.3.0.tar.gz"
Expand Down

0 comments on commit ffa71c9

Please sign in to comment.