Skip to content

Commit 1d6f632

Browse files
committed
Revert "Remove boost from the build system when OPENVDB_USE_DELAYED_LOADING is OFF"
This reverts commit 828bea2. Signed-off-by: Dan Bailey <[email protected]>
1 parent 996b297 commit 1d6f632

File tree

4 files changed

+53
-26
lines changed

4 files changed

+53
-26
lines changed

cmake/FindOpenVDB.cmake

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -491,11 +491,37 @@ endif()
491491
# Add standard dependencies
492492

493493
find_package(TBB REQUIRED COMPONENTS tbb)
494+
find_package(Boost REQUIRED COMPONENTS iostreams)
494495

495496
# Add deps for pyopenvdb
497+
# @todo track for numpy
496498

497499
if(pyopenvdb IN_LIST OpenVDB_FIND_COMPONENTS)
498500
find_package(Python REQUIRED)
501+
502+
# Boost python handling - try and find both python and pythonXx (version suffixed).
503+
# Prioritize the version suffixed library, failing if neither exist.
504+
505+
find_package(Boost ${MINIMUM_BOOST_VERSION}
506+
QUIET COMPONENTS python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}
507+
)
508+
509+
if(TARGET Boost::python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR})
510+
set(BOOST_PYTHON_LIB "python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}")
511+
message(STATUS "Found boost_python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}")
512+
else()
513+
find_package(Boost ${MINIMUM_BOOST_VERSION} QUIET COMPONENTS python)
514+
if(TARGET Boost::python)
515+
set(BOOST_PYTHON_LIB "python")
516+
message(STATUS "Found non-suffixed boost_python, assuming to be python version "
517+
"\"${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}\" compatible"
518+
)
519+
else()
520+
message(FATAL_ERROR "Unable to find boost_python or "
521+
"boost_python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}."
522+
)
523+
endif()
524+
endif()
499525
endif()
500526

501527
# Add deps for openvdb_ax
@@ -630,10 +656,6 @@ if(OpenVDB_USES_IMATH_HALF)
630656
find_package(Imath REQUIRED CONFIG)
631657
endif()
632658

633-
if(OpenVDB_USES_DELAYED_LOADING)
634-
find_package(Boost REQUIRED COMPONENTS iostreams)
635-
endif()
636-
637659
if(UNIX)
638660
find_package(Threads REQUIRED)
639661
endif()
@@ -744,7 +766,7 @@ if(OpenVDB_pyopenvdb_LIBRARY)
744766
set_target_properties(OpenVDB::pyopenvdb PROPERTIES
745767
IMPORTED_LOCATION "${OpenVDB_pyopenvdb_LIBRARY}"
746768
INTERFACE_INCLUDE_DIRECTORIES "${OpenVDB_pyopenvdb_INCLUDE_DIR};${PYTHON_INCLUDE_DIR}"
747-
INTERFACE_LINK_LIBRARIES "OpenVDB::openvdb;${PYTHON_LIBRARIES}"
769+
INTERFACE_LINK_LIBRARIES "OpenVDB::openvdb;Boost::${BOOST_PYTHON_LIB};${PYTHON_LIBRARIES}"
748770
INTERFACE_COMPILE_FEATURES cxx_std_17
749771
)
750772
endif()

doc/build.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ PyBind11 | C++/python bindings
267267
NumPy | Scientific computing with Python | Optional (Python) |
268268
LLVM | Target-independent code generation | OpenVDB AX |
269269

270-
At a minimum a matching C++17 compiler and CMake will be required. See
270+
At a minimum, boost, a matching C++17 compiler and CMake will be required. See
271271
the full [dependency list](@ref dependencies) for help with downloading and
272272
installing the above software. Note that as Blosc and ZLib are provided as part
273273
of the Houdini installation `USE_BLOSC` and `USE_ZLIB` should be left `ON`.

doc/dependencies.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Reference Platform, but for those that do, their specified versions are
3636

3737
Component | Requirements | Optional
3838
----------------------- | ----------------------------------------------- | --------
39-
OpenVDB Core Library | CMake, C++17 compiler, TBB::tbb | Blosc, ZLib, Log4cplus, Imath::Imath, Boost::iostream
39+
OpenVDB Core Library | CMake, C++17 compiler, TBB::tbb, Boost::headers | Blosc, ZLib, Log4cplus, Imath::Imath, Boost::iostream
4040
OpenVDB Print | Core Library dependencies | -
4141
OpenVDB LOD | Core Library dependencies | -
4242
OpenVDB Render | Core Library dependencies | OpenEXR, Imath::Imath, libpng
@@ -65,7 +65,7 @@ Imath | 3.1 | Latest | Half precision floating points
6565
OpenEXR | 3.1 | Latest | EXR serialization support | Y | Y | http://www.openexr.com
6666
TBB | 2020.2 | 2020.3 | Threading Building Blocks - template library for task parallelism | Y | Y | https://www.threadingbuildingblocks.org
6767
ZLIB | 1.2.7 | Latest | Compression library for disk serialization compression | Y | Y | https://www.zlib.net
68-
Boost | 1.73 | 1.80 | Components: iostreams | Y | Y | https://www.boost.org
68+
Boost | 1.73 | 1.80 | Components: headers, iostreams | Y | Y | https://www.boost.org
6969
LLVM | 10.0.0 | 13.0.0* | Target-independent code generation | Y | Y | https://llvm.org/
7070
Bison | 3.0.0 | 3.7.0 | General-purpose parser generator | Y | Y | https://www.gnu.org/software/gcc
7171
Flex | 2.6.0 | 2.6.4 | Fast lexical analyzer generator | Y | Y | https://github.com/westes/flex

openvdb/openvdb/CMakeLists.txt

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,16 @@ endif()
110110

111111
if(OPENVDB_USE_DELAYED_LOADING)
112112
find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS iostreams)
113+
else()
114+
find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS headers)
115+
endif()
113116

114-
if(OPENVDB_FUTURE_DEPRECATION AND FUTURE_MINIMUM_BOOST_VERSION)
115-
# The X.Y.Z boost version value isn't available until CMake 3.14
116-
set(FULL_BOOST_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
117-
if(${FULL_BOOST_VERSION} VERSION_LESS FUTURE_MINIMUM_BOOST_VERSION)
118-
message(DEPRECATION "Support for Boost versions < ${FUTURE_MINIMUM_BOOST_VERSION} "
119-
"is deprecated and will be removed.")
120-
endif()
117+
if(OPENVDB_FUTURE_DEPRECATION AND FUTURE_MINIMUM_BOOST_VERSION)
118+
# The X.Y.Z boost version value isn't available until CMake 3.14
119+
set(FULL_BOOST_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
120+
if(${FULL_BOOST_VERSION} VERSION_LESS FUTURE_MINIMUM_BOOST_VERSION)
121+
message(DEPRECATION "Support for Boost versions < ${FUTURE_MINIMUM_BOOST_VERSION} "
122+
"is deprecated and will be removed.")
121123
endif()
122124
endif()
123125

@@ -244,17 +246,20 @@ endif()
244246

245247
if(OPENVDB_USE_DELAYED_LOADING)
246248
list(APPEND OPENVDB_CORE_DEPENDENT_LIBS Boost::iostreams)
247-
if(WIN32)
248-
# Boost headers contain #pragma commands on Windows which causes Boost
249-
# libraries to be linked in automatically. Custom boost installations
250-
# may find that these naming conventions don't always match and can
251-
# cause linker errors. This option disables this feature of Boost. Note
252-
# -DBOOST_ALL_NO_LIB can also be provided manually.
253-
if(OPENVDB_DISABLE_BOOST_IMPLICIT_LINKING)
254-
list(APPEND OPENVDB_CORE_DEPENDENT_LIBS
255-
Boost::disable_autolinking # add -DBOOST_ALL_NO_LIB
256-
)
257-
endif()
249+
else()
250+
list(APPEND OPENVDB_CORE_DEPENDENT_LIBS Boost::headers)
251+
endif()
252+
253+
if(WIN32)
254+
# Boost headers contain #pragma commands on Windows which causes Boost
255+
# libraries to be linked in automatically. Custom boost installations
256+
# may find that these naming conventions don't always match and can
257+
# cause linker errors. This option disables this feature of Boost. Note
258+
# -DBOOST_ALL_NO_LIB can also be provided manually.
259+
if(OPENVDB_DISABLE_BOOST_IMPLICIT_LINKING)
260+
list(APPEND OPENVDB_CORE_DEPENDENT_LIBS
261+
Boost::disable_autolinking # add -DBOOST_ALL_NO_LIB
262+
)
258263
endif()
259264
endif()
260265

0 commit comments

Comments
 (0)