0003_openvdb.patch 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. commit 5fbaf5a402b4e54b4cc9803c1da6ee01ffa939a4
  2. Author: CYBERDEViL <cyberdevil@notabug.org>
  3. Date: Sat Dec 16 15:13:10 2023 +0100
  4. openvdb: compile with C++17 (openvdb 11)
  5. commit ffa4ddd68e586a7cce81a79e8fc95413268d73a7
  6. Author: CYBERDEViL <cyberdevil@notabug.org>
  7. Date: Sat Dec 16 15:09:21 2023 +0100
  8. openvdb: "Cleanup: fix compiler warnings"
  9. Partially applied Blender upstream ref: 37889011070ff2ec52159690f652238d2b325185
  10. commit 73a16ea250d7cd8b46fc16b824a54d238de66f0d
  11. Author: CYBERDEViL <cyberdevil@notabug.org>
  12. Date: Sat Dec 16 15:03:43 2023 +0100
  13. openvdb: "Build: add WITH_OPENVDB_3_ABI_COMPATIBLE option."
  14. Fully applied Blender upstream ref: 71d7d6cd8c431b7f4fac8d65a4eaedf3cff6c8f6
  15. diff --git a/blender-2.79b/CMakeLists.txt b/blender-2.79b/CMakeLists.txt
  16. index bfea2dd..6ad2480 100644
  17. --- a/blender-2.79b/CMakeLists.txt
  18. +++ b/blender-2.79b/CMakeLists.txt
  19. @@ -98,6 +98,9 @@ cmake_policy(SET CMP0010 NEW)
  20. # Input directories must have CMakeLists.txt
  21. cmake_policy(SET CMP0014 NEW)
  22. +# Silence draco warning on macOS, new policy works fine.
  23. +cmake_policy(SET CMP0068 NEW)
  24. +
  25. #-----------------------------------------------------------------------------
  26. # Load some macros.
  27. include(build_files/cmake/macros.cmake)
  28. @@ -251,6 +254,8 @@ option(WITH_OPENSUBDIV "Enable OpenSubdiv for surface subdivision" _init_OPEN
  29. option(WITH_OPENVDB "Enable features relying on OpenVDB" OFF)
  30. option(WITH_OPENVDB_BLOSC "Enable blosc compression for OpenVDB, only enable if OpenVDB was built with blosc support" OFF)
  31. +option(WITH_OPENVDB_3_ABI_COMPATIBLE "Assume OpenVDB library has been compiled with version 3 ABI compatibility" OFF)
  32. +mark_as_advanced(WITH_OPENVDB_3_ABI_COMPATIBLE)
  33. # GHOST Windowing Library Options
  34. option(WITH_GHOST_DEBUG "Enable debugging output for the GHOST library" OFF)
  35. diff --git a/blender-2.79b/intern/opensubdiv/CMakeLists.txt b/blender-2.79b/intern/opensubdiv/CMakeLists.txt
  36. index 876b5c0..bf23acf 100644
  37. --- a/blender-2.79b/intern/opensubdiv/CMakeLists.txt
  38. +++ b/blender-2.79b/intern/opensubdiv/CMakeLists.txt
  39. @@ -69,6 +69,7 @@ data_to_c_simple(gpu_shader_opensubdiv_geometry.glsl SRC)
  40. data_to_c_simple(gpu_shader_opensubdiv_fragment.glsl SRC)
  41. add_definitions(-DGLEW_STATIC)
  42. +add_definitions(-DOSD_USES_GLEW)
  43. if(WIN32)
  44. add_definitions(-DNOMINMAX)
  45. diff --git a/blender-2.79b/intern/openvdb/CMakeLists.txt b/blender-2.79b/intern/openvdb/CMakeLists.txt
  46. index e0ecdb5..1695dc6 100644
  47. --- a/blender-2.79b/intern/openvdb/CMakeLists.txt
  48. +++ b/blender-2.79b/intern/openvdb/CMakeLists.txt
  49. @@ -23,6 +23,8 @@
  50. #
  51. # ***** END GPL LICENSE BLOCK *****
  52. +set(CMAKE_CXX_STANDARD 17)
  53. +
  54. set(INC
  55. .
  56. intern
  57. @@ -40,6 +42,12 @@ if(WITH_OPENVDB)
  58. -DWITH_OPENVDB
  59. )
  60. + if(WITH_OPENVDB_3_ABI_COMPATIBLE)
  61. + add_definitions(
  62. + -DOPENVDB_3_ABI_COMPATIBLE
  63. + )
  64. + endif()
  65. +
  66. list(APPEND INC_SYS
  67. ${BOOST_INCLUDE_DIR}
  68. ${TBB_INCLUDE_DIRS}
  69. diff --git a/blender-2.79b/intern/openvdb/intern/openvdb_writer.cc b/blender-2.79b/intern/openvdb/intern/openvdb_writer.cc
  70. index e886c5a..bedcfe6 100644
  71. --- a/blender-2.79b/intern/openvdb/intern/openvdb_writer.cc
  72. +++ b/blender-2.79b/intern/openvdb/intern/openvdb_writer.cc
  73. @@ -45,7 +45,7 @@ void OpenVDBWriter::insert(const openvdb::GridBase::Ptr &grid)
  74. void OpenVDBWriter::insert(const openvdb::GridBase &grid)
  75. {
  76. -#if (OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER == 3)
  77. +#if (OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER <= 3) || defined(OPENVDB_3_ABI_COMPATIBLE)
  78. m_grids->push_back(grid.copyGrid());
  79. #else
  80. m_grids->push_back(grid.copyGridWithNewTree());
  81. diff --git a/blender-2.79b/intern/openvdb/openvdb_util.cc b/blender-2.79b/intern/openvdb/openvdb_util.cc
  82. index d187f55..a09122d 100644
  83. --- a/blender-2.79b/intern/openvdb/openvdb_util.cc
  84. +++ b/blender-2.79b/intern/openvdb/openvdb_util.cc
  85. @@ -34,5 +34,10 @@ ScopeTimer::ScopeTimer(const std::string &message)
  86. ScopeTimer::~ScopeTimer()
  87. {
  88. - std::printf("%s: %fms\n", m_message.c_str(), m_timer.delta());
  89. +#if OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER >= 7
  90. + double delta = m_timer.milliseconds();
  91. +#else
  92. + double delta = m_timer.delta(); /* Deprecated in OpenVDB 7. */
  93. +#endif
  94. + std::printf("%s: %fms\n", m_message.c_str(), delta);
  95. }