Skip to content

Commit 659ef6d

Browse files
authored
Merge pull request #1723 from Idclip/remove_boost_promote
Replace boost conversion_traits with std::common_type
2 parents 5331ae5 + 82ec5a0 commit 659ef6d

File tree

6 files changed

+32
-57
lines changed

6 files changed

+32
-57
lines changed

cmake/FindOpenVDB.cmake

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

493493
find_package(TBB REQUIRED COMPONENTS tbb)
494-
find_package(Boost REQUIRED COMPONENTS iostreams)
495494

496495
# Add deps for pyopenvdb
497-
# @todo track for numpy
498496

499497
if(pyopenvdb IN_LIST OpenVDB_FIND_COMPONENTS)
500498
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()
525499
endif()
526500

527501
# Add deps for openvdb_ax
@@ -656,6 +630,10 @@ if(OpenVDB_USES_IMATH_HALF)
656630
find_package(Imath REQUIRED CONFIG)
657631
endif()
658632

633+
if(OpenVDB_USES_DELAYED_LOADING)
634+
find_package(Boost REQUIRED COMPONENTS iostreams)
635+
endif()
636+
659637
if(UNIX)
660638
find_package(Threads REQUIRED)
661639
endif()
@@ -766,7 +744,7 @@ if(OpenVDB_pyopenvdb_LIBRARY)
766744
set_target_properties(OpenVDB::pyopenvdb PROPERTIES
767745
IMPORTED_LOCATION "${OpenVDB_pyopenvdb_LIBRARY}"
768746
INTERFACE_INCLUDE_DIRECTORIES "${OpenVDB_pyopenvdb_INCLUDE_DIR};${PYTHON_INCLUDE_DIR}"
769-
INTERFACE_LINK_LIBRARIES "OpenVDB::openvdb;Boost::${BOOST_PYTHON_LIB};${PYTHON_LIBRARIES}"
747+
INTERFACE_LINK_LIBRARIES "OpenVDB::openvdb;${PYTHON_LIBRARIES}"
770748
INTERFACE_COMPILE_FEATURES cxx_std_17
771749
)
772750
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, boost, a matching C++17 compiler and CMake will be required. See
270+
At a minimum 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, Boost::headers | Blosc, ZLib, Log4cplus, Imath::Imath, Boost::iostream
39+
OpenVDB Core Library | CMake, C++17 compiler, TBB::tbb | 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: headers, iostreams | Y | Y | https://www.boost.org
68+
Boost | 1.73 | 1.80 | Components: 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: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,14 @@ 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()
116113

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.")
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()
123121
endif()
124122
endif()
125123

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

247245
if(OPENVDB_USE_DELAYED_LOADING)
248246
list(APPEND OPENVDB_CORE_DEPENDENT_LIBS Boost::iostreams)
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-
)
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()
263258
endif()
264259
endif()
265260

openvdb/openvdb/math/Math.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <openvdb/Platform.h>
1212
#include <openvdb/version.h>
1313
#include <openvdb/util/Assert.h>
14-
#include <boost/numeric/conversion/conversion_traits.hpp>
1514
#include <algorithm> // for std::max()
1615
#include <cassert>
1716
#include <cmath> // for std::ceil(), std::fabs(), std::pow(), std::sqrt(), etc.
@@ -917,10 +916,9 @@ enum RotationOrder {
917916
ZXZ_ROTATION
918917
};
919918

920-
921-
template <typename S, typename T>
919+
template <typename S, typename T, typename = std::enable_if_t<std::is_arithmetic_v<S>&& std::is_arithmetic_v<T>>>
922920
struct promote {
923-
using type = typename boost::numeric::conversion_traits<S, T>::supertype;
921+
using type = typename std::common_type_t<S,T>;
924922
};
925923

926924
/// @brief Return the index [0,1,2] of the smallest value in a 3D vector.

pendingchanges/boost_promote.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
OpenVDB:
2+
Improvements:
3+
- Removed last traces of Boost when OPENVDB_USE_DELAYED_LOADING is OFF
4+
[Reported by Brian McKinnon]

0 commit comments

Comments
 (0)