Skip to content

Commit

Permalink
Merge pull request #1691 from Idclip/cmake_imp
Browse files Browse the repository at this point in the history
CMake/CI fixes
  • Loading branch information
Idclip authored Oct 26, 2023
2 parents 99bbd41 + 9ecdc8f commit b38c916
Show file tree
Hide file tree
Showing 14 changed files with 88 additions and 88 deletions.
26 changes: 15 additions & 11 deletions .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,25 @@ jobs:
runs-on: ${{ (github.repository_owner == 'AcademySoftwareFoundation' && 'ubuntu-20.04-8c-32g-300h') || 'ubuntu-latest' }}
name: linux-extra:${{ matrix.config.name }}
container:
image: aswf/ci-openvdb:2023-clang15
# @note we specifically use clang15.0 (not clang15) here as the newest
# versions of the clang15.X containers have some issues with the GLFW
# installation
image: aswf/ci-openvdb:2023-clang15.0
env:
CXX: clang++
strategy:
matrix:
config:
- { name: 'all', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DUSE_BLOSC=ON -DUSE_ZLIB=ON -DUSE_EXR=ON -DUSE_PNG=ON' }
- { name: 'lite', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DUSE_BLOSC=OFF -DUSE_ZLIB=OFF -DUSE_EXR=OFF -DUSE_PNG=OFF -DOPENVDB_USE_DELAYED_LOADING=OFF' }
- { name: 'half', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DUSE_BLOSC=OFF -DUSE_IMATH_HALF=ON' }
- { name: 'sse', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DOPENVDB_SIMD=SSE42' }
- { name: 'avx', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DOPENVDB_SIMD=AVX' }
- { name: 'numpy', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DUSE_NUMPY=ON -DOPENVDB_PYTHON_WRAP_ALL_GRID_TYPES=ON' }
- { name: 'asan', build: 'asan', components: 'core,test,axcore,axtest', cmake: '-DNANOVDB_USE_OPENVDB=ON -DOPENVDB_AX_STATIC=OFF -DOPENVDB_CORE_STATIC=OFF -DUSE_BLOSC=OFF' } # We never called blosc_destroy(), so disable blosc to silence these errors
- { name: 'ubsan', build: 'ubsan', components: 'core,test,axcore,axtest', cmake: '' }
- { name: 'c++20', build: 'Release', components: 'core,test,axcore,axtest', cmake: '-DCMAKE_CXX_STANDARD=20' }
- { name: 'all', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DUSE_BLOSC=ON -DUSE_ZLIB=ON -DUSE_EXR=ON -DUSE_PNG=ON' }
- { name: 'lite', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DUSE_BLOSC=OFF -DUSE_ZLIB=OFF -DUSE_EXR=OFF -DUSE_PNG=OFF -DOPENVDB_USE_DELAYED_LOADING=OFF' }
- { name: 'half', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DUSE_BLOSC=OFF -DUSE_IMATH_HALF=ON' }
- { name: 'sse', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DOPENVDB_SIMD=SSE42' }
- { name: 'avx', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DOPENVDB_SIMD=AVX' }
- { name: 'numpy', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DUSE_NUMPY=ON -DOPENVDB_PYTHON_WRAP_ALL_GRID_TYPES=ON' }
- { name: 'asan', build: 'asan', components: 'core,test,axcore,axtest', cmake: '-DNANOVDB_USE_OPENVDB=ON -DOPENVDB_AX_STATIC=OFF -DOPENVDB_CORE_STATIC=OFF -DUSE_BLOSC=OFF' } # We never called blosc_destroy(), so disable blosc to silence these errors
- { name: 'ubsan', build: 'ubsan', components: 'core,test,axcore,axtest', cmake: '' }
- { name: 'c++20', build: 'Release', components: 'core,test,axcore,axtest', cmake: '-DCMAKE_CXX_STANDARD=20' }
- { name: 'conf', build: 'Release', components: 'core,python,bin,view,render,test,axcore,axtest', cmake: '-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON' }
fail-fast: false
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -352,7 +356,7 @@ jobs:
runs-on: ${{ (github.repository_owner == 'AcademySoftwareFoundation' && 'ubuntu-20.04-8c-32g-300h') || 'ubuntu-latest' }}
name: linux-blosc:${{ matrix.blosc }}
container:
image: aswf/ci-base:2021
image: aswf/ci-base:2023
strategy:
matrix:
blosc: ['1.18.0','1.19.0','1.20.0','1.21.0']
Expand Down
32 changes: 5 additions & 27 deletions cmake/FindOpenVDB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -491,37 +491,11 @@ endif()
# Add standard dependencies

find_package(TBB REQUIRED COMPONENTS tbb)
find_package(Boost REQUIRED COMPONENTS iostreams)

# Add deps for pyopenvdb
# @todo track for numpy

if(pyopenvdb IN_LIST OpenVDB_FIND_COMPONENTS)
find_package(Python REQUIRED)

# Boost python handling - try and find both python and pythonXx (version suffixed).
# Prioritize the version suffixed library, failing if neither exist.

find_package(Boost ${MINIMUM_BOOST_VERSION}
QUIET COMPONENTS python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}
)

if(TARGET Boost::python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR})
set(BOOST_PYTHON_LIB "python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}")
message(STATUS "Found boost_python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}")
else()
find_package(Boost ${MINIMUM_BOOST_VERSION} QUIET COMPONENTS python)
if(TARGET Boost::python)
set(BOOST_PYTHON_LIB "python")
message(STATUS "Found non-suffixed boost_python, assuming to be python version "
"\"${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}\" compatible"
)
else()
message(FATAL_ERROR "Unable to find boost_python or "
"boost_python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}."
)
endif()
endif()
endif()

# Add deps for openvdb_ax
Expand Down Expand Up @@ -656,6 +630,10 @@ if(OpenVDB_USES_IMATH_HALF)
find_package(Imath REQUIRED CONFIG)
endif()

if(OpenVDB_USES_DELAYED_LOADING)
find_package(Boost REQUIRED COMPONENTS iostreams)
endif()

if(UNIX)
find_package(Threads REQUIRED)
endif()
Expand Down Expand Up @@ -766,7 +744,7 @@ if(OpenVDB_pyopenvdb_LIBRARY)
set_target_properties(OpenVDB::pyopenvdb PROPERTIES
IMPORTED_LOCATION "${OpenVDB_pyopenvdb_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${OpenVDB_pyopenvdb_INCLUDE_DIR};${PYTHON_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "OpenVDB::openvdb;Boost::${BOOST_PYTHON_LIB};${PYTHON_LIBRARIES}"
INTERFACE_LINK_LIBRARIES "OpenVDB::openvdb;${PYTHON_LIBRARIES}"
INTERFACE_COMPILE_FEATURES cxx_std_17
)
endif()
Expand Down
4 changes: 3 additions & 1 deletion cmake/FindTBB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This will define the following variables:
``Tbb_FOUND``
True if the system has the Tbb library.
``Tbb_VERSION``
``Tbb_VERSION`` ``TBB_VERSION``
The version of the Tbb library which was found.
``Tbb_INCLUDE_DIRS``
Include directories needed to use Tbb.
Expand Down Expand Up @@ -220,7 +220,9 @@ if(EXISTS ${_tbb_version_file})
unset(_tbb_version_minor_string)
unset(_tbb_binary_version_string)

# Set both for compatibility reasons, TBB's CONFIG files only set the latter
set(Tbb_VERSION ${Tbb_VERSION_MAJOR}.${Tbb_VERSION_MINOR})
set(TBB_VERSION ${Tbb_VERSION})
endif()

unset(_tbb_version_file)
Expand Down
3 changes: 2 additions & 1 deletion cmake/config/OpenVDBVersions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ if(NOT DISABLE_DEPENDENCY_VERSION_CHECKS)
set(MINIMUM_ICC_VERSION 19)
set(MINIMUM_MSVC_VERSION 19.28) # 1928 (Visual Studio 2019 Version 16.8 + 16.9)

set(MINIMUM_BOOST_VERSION 1.76)
# Should be 1.76 for VFX 22, but only version in apt is 1.73
set(MINIMUM_BOOST_VERSION 1.73)
set(MINIMUM_PYBIND_VERSION 2.9.1)
set(MINIMUM_IMATH_VERSION 3.1)
set(MINIMUM_OPENEXR_VERSION 3.1)
Expand Down
2 changes: 1 addition & 1 deletion doc/build.txt
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ PyBind11 | C++/python bindings
NumPy | Scientific computing with Python | Optional (Python) |
LLVM | Target-independent code generation | OpenVDB AX |

At a minimum, boost, a matching C++17 compiler and CMake will be required. See
At a minimum a matching C++17 compiler and CMake will be required. See
the full [dependency list](@ref dependencies) for help with downloading and
installing the above software. Note that as Blosc and ZLib are provided as part
of the Houdini installation `USE_BLOSC` and `USE_ZLIB` should be left `ON`.
Expand Down
4 changes: 2 additions & 2 deletions doc/dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Reference Platform, but for those that do, their specified versions are

Component | Requirements | Optional
----------------------- | ----------------------------------------------- | --------
OpenVDB Core Library | CMake, C++17 compiler, TBB::tbb, Boost::headers | Blosc, ZLib, Log4cplus, Imath::Imath, Boost::iostream
OpenVDB Core Library | CMake, C++17 compiler, TBB::tbb | Blosc, ZLib, Log4cplus, Imath::Imath, Boost::iostream
OpenVDB Print | Core Library dependencies | -
OpenVDB LOD | Core Library dependencies | -
OpenVDB Render | Core Library dependencies | OpenEXR, Imath::Imath, libpng
Expand Down Expand Up @@ -65,7 +65,7 @@ Imath | 3.1 | Latest | Half precision floating points
OpenEXR | 3.1 | Latest | EXR serialization support | Y | Y | http://www.openexr.com
TBB | 2020.2 | 2020.3 | Threading Building Blocks - template library for task parallelism | Y | Y | https://www.threadingbuildingblocks.org
ZLIB | 1.2.7 | Latest | Compression library for disk serialization compression | Y | Y | https://www.zlib.net
Boost | 1.76 | 1.80 | Components: headers, iostreams | Y | Y | https://www.boost.org
Boost | 1.73 | 1.80 | Components: iostreams | Y | Y | https://www.boost.org
LLVM | 10.0.0 | 13.0.0* | Target-independent code generation | Y | Y | https://llvm.org/
Bison | 3.0.0 | 3.7.0 | General-purpose parser generator | Y | Y | https://www.gnu.org/software/gcc
Flex | 2.6.0 | 2.6.4 | Fast lexical analyzer generator | Y | Y | https://github.com/westes/flex
Expand Down
43 changes: 19 additions & 24 deletions openvdb/openvdb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,22 +110,20 @@ endif()

if(OPENVDB_USE_DELAYED_LOADING)
find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS iostreams)
else()
find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS headers)
endif()

if(OPENVDB_FUTURE_DEPRECATION AND FUTURE_MINIMUM_BOOST_VERSION)
# The X.Y.Z boost version value isn't available until CMake 3.14
set(FULL_BOOST_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
if(${FULL_BOOST_VERSION} VERSION_LESS FUTURE_MINIMUM_BOOST_VERSION)
message(DEPRECATION "Support for Boost versions < ${FUTURE_MINIMUM_BOOST_VERSION} "
"is deprecated and will be removed.")
if(OPENVDB_FUTURE_DEPRECATION AND FUTURE_MINIMUM_BOOST_VERSION)
# The X.Y.Z boost version value isn't available until CMake 3.14
set(FULL_BOOST_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
if(${FULL_BOOST_VERSION} VERSION_LESS FUTURE_MINIMUM_BOOST_VERSION)
message(DEPRECATION "Support for Boost versions < ${FUTURE_MINIMUM_BOOST_VERSION} "
"is deprecated and will be removed.")
endif()
endif()
endif()

find_package(TBB ${MINIMUM_TBB_VERSION} REQUIRED COMPONENTS tbb)
if(OPENVDB_FUTURE_DEPRECATION AND FUTURE_MINIMUM_TBB_VERSION)
if(${Tbb_VERSION} VERSION_LESS FUTURE_MINIMUM_TBB_VERSION)
if(${TBB_VERSION} VERSION_LESS FUTURE_MINIMUM_TBB_VERSION)
message(DEPRECATION "Support for TBB versions < ${FUTURE_MINIMUM_TBB_VERSION} "
"is deprecated and will be removed.")
endif()
Expand Down Expand Up @@ -246,20 +244,17 @@ endif()

if(OPENVDB_USE_DELAYED_LOADING)
list(APPEND OPENVDB_CORE_DEPENDENT_LIBS Boost::iostreams)
else()
list(APPEND OPENVDB_CORE_DEPENDENT_LIBS Boost::headers)
endif()

if(WIN32)
# Boost headers contain #pragma commands on Windows which causes Boost
# libraries to be linked in automatically. Custom boost installations
# may find that these naming conventions don't always match and can
# cause linker errors. This option disables this feature of Boost. Note
# -DBOOST_ALL_NO_LIB can also be provided manually.
if(OPENVDB_DISABLE_BOOST_IMPLICIT_LINKING)
list(APPEND OPENVDB_CORE_DEPENDENT_LIBS
Boost::disable_autolinking # add -DBOOST_ALL_NO_LIB
)
if(WIN32)
# Boost headers contain #pragma commands on Windows which causes Boost
# libraries to be linked in automatically. Custom boost installations
# may find that these naming conventions don't always match and can
# cause linker errors. This option disables this feature of Boost. Note
# -DBOOST_ALL_NO_LIB can also be provided manually.
if(OPENVDB_DISABLE_BOOST_IMPLICIT_LINKING)
list(APPEND OPENVDB_CORE_DEPENDENT_LIBS
Boost::disable_autolinking # add -DBOOST_ALL_NO_LIB
)
endif()
endif()
endif()

Expand Down
15 changes: 10 additions & 5 deletions openvdb/openvdb/unittest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,18 @@ else()
set(OPENVDB_LIB openvdb)
endif()

set(OPENVDB_TEST_DEPENDENT_LIBS ${OPENVDB_LIB})

find_package(GTest ${MINIMUM_GOOGLETEST_VERSION} REQUIRED)

set(OPENVDB_TEST_DEPENDENT_LIBS
${OPENVDB_LIB}
GTest::GTest
GTest::Main
)
if(TARGET GTest::gtest_main)
# New gtest targets as of CMake 3.20. Defined by both the Config and Module
# find modes
list(APPEND OPENVDB_TEST_DEPENDENT_LIBS GTest::gtest GTest::gtest_main)
else()
# Older targets, only defined by the Module find_package calls
list(APPEND OPENVDB_TEST_DEPENDENT_LIBS GTest::GTest GTest::Main)
endif()

if(CONCURRENT_MALLOC STREQUAL "Jemalloc")
find_package(Jemalloc REQUIRED)
Expand Down
2 changes: 1 addition & 1 deletion openvdb/openvdb/unittest/TestCount.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ TEST_F(TestCount, testMemUsage)

Index64 internalNodeMemUsage(0);
Index64 expectedMaxMem(sizeof(tree) + sizeof(root));
Index64 leafCount(0);
[[maybe_unused]] Index64 leafCount(0);

for (auto internal1Iter = root.cbeginChildOn(); internal1Iter; ++internal1Iter) {
internalNodeMemUsage += Internal1NodeT::NUM_VALUES * sizeof(Internal1NodeT::UnionType);
Expand Down
2 changes: 2 additions & 0 deletions openvdb_maya/openvdb_maya/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
cmake_minimum_required(VERSION 3.18)
project(OpenVDBMaya LANGUAGES CXX)

message(WARNING "The OpenVDB Maya plugin is currently unmaintained. The plugin "
"exists as a reference and may not compile or run correctly.")

###### OpenVDB Maya Options

Expand Down
2 changes: 0 additions & 2 deletions openvdb_maya/openvdb_maya/OpenVDBCopyNode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#include <maya/MFnNumericAttribute.h>
#include <maya/MFloatVector.h>

#include <boost/math/constants/constants.hpp> // boost::math::constants::pi


namespace mvdb = openvdb_maya;

Expand Down
5 changes: 2 additions & 3 deletions openvdb_maya/openvdb_maya/OpenVDBTransformNode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/// @author FX R&D OpenVDB team

#include "OpenVDBPlugin.h"
#include <openvdb/math/Math.h>
#include <openvdb_maya/OpenVDBData.h>
#include <openvdb_maya/OpenVDBUtil.h>

Expand All @@ -15,8 +16,6 @@
#include <maya/MFnNumericAttribute.h>
#include <maya/MFloatVector.h>

#include <boost/math/constants/constants.hpp> // boost::math::constants::pi


namespace mvdb = openvdb_maya;

Expand Down Expand Up @@ -216,7 +215,7 @@ MStatus OpenVDBTransformNode::compute(const MPlug& plug, MDataBlock& data)

mat.preTranslate(openvdb::Vec3R(p[0], p[1], p[2]));

const double deg2rad = boost::math::constants::pi<double>() / 180.0;
const double deg2rad = openvdb::math::pi<double>() / 180.0;
mat.preRotate(openvdb::math::X_AXIS, deg2rad*r[0]);
mat.preRotate(openvdb::math::Y_AXIS, deg2rad*r[1]);
mat.preRotate(openvdb::math::Z_AXIS, deg2rad*r[2]);
Expand Down
28 changes: 18 additions & 10 deletions openvdb_maya/openvdb_maya/OpenVDBUtil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@

#include "OpenVDBUtil.h"
#include <openvdb/math/Math.h>
#include <openvdb/util/Name.h>

#include <maya/MGlobal.h>

#include <boost/algorithm/string.hpp>

#include <iomanip> // std::setw, std::setfill, std::left
#include <sstream> // std::stringstream
#include <string> // std::string, std::getline
Expand Down Expand Up @@ -64,12 +63,13 @@ void getGrids(std::vector<openvdb::GridBase::ConstPtr>& grids,

std::string getGridNames(const OpenVDBData& vdb)
{
std::vector<std::string> names;
std::string names;
for (size_t n = 0, N = vdb.numberOfGrids(); n < N; ++n) {
names.push_back(vdb.grid(n).getName());
names += std::string(vdb.grid(n).getName());
names += " ";
}

return boost::algorithm::join(names, " ");
if (!names.empty()) names.pop_back();
return names;
}


Expand Down Expand Up @@ -111,8 +111,12 @@ getSelectedGrids(GridCPtrVec& grids, const std::string& selection,
{
grids.clear();

std::vector<std::string> selectionList;
boost::split(selectionList, selection, boost::is_any_of(" "));
std::string input(selection);
size_t pos = 0;
while ((pos = input.find(" ")) != std::string::npos) {
selectionList.emplace_back(input.substr(0, pos));
input.erase(0, pos + 1);
}

for (size_t n = 0, N = inputVdb.numberOfGrids(); n < N; ++n) {

Expand All @@ -135,8 +139,12 @@ getSelectedGrids(GridCPtrVec& grids, const std::string& selection,
{
grids.clear();

std::vector<std::string> selectionList;
boost::split(selectionList, selection, boost::is_any_of(" "));
std::string input(selection);
size_t pos = 0;
while ((pos = input.find(" ")) != std::string::npos) {
selectionList.emplace_back(input.substr(0, pos));
input.erase(0, pos + 1);
}

for (size_t n = 0, N = inputVdb.numberOfGrids(); n < N; ++n) {

Expand Down
8 changes: 8 additions & 0 deletions pendingchanges/vdb11.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
OpenVDB:
Improvements:
- Removed last traces of Boost when OPENVDB_USE_DELAYED_LOADING is OFF
[Contributed by Brian McKinnon]

Build:
- Support for OpenEXR 2.X has been removed.
- Boost is no longer required if OPENVDB_USE_DELAYED_LOADING is OFF
- Better support for building with external package configurations
with CMAKE_FIND_PACKAGE_PREFER_CONFIG=ON.

0 comments on commit b38c916

Please sign in to comment.