diff options
Diffstat (limited to 'media-gfx/openvdb')
-rw-r--r-- | media-gfx/openvdb/Manifest | 6 | ||||
-rw-r--r-- | media-gfx/openvdb/files/openvdb-11.0.0-cmake_fixes.patch | 84 | ||||
-rw-r--r-- | media-gfx/openvdb/files/openvdb-11.0.0-constexpr-version.patch | 55 | ||||
-rw-r--r-- | media-gfx/openvdb/metadata.xml | 10 | ||||
-rw-r--r-- | media-gfx/openvdb/openvdb-11.0.0.ebuild | 368 |
5 files changed, 522 insertions, 1 deletions
diff --git a/media-gfx/openvdb/Manifest b/media-gfx/openvdb/Manifest index e25262618d40..fd3aafc0bfb9 100644 --- a/media-gfx/openvdb/Manifest +++ b/media-gfx/openvdb/Manifest @@ -1,8 +1,12 @@ AUX openvdb-10.0.1-drop-failing-tests.patch 2052 BLAKE2B a2235d9e148850ab5e29c736ce1dc0c603da5bcd32e3086befb0a07fbcf8bfd2d6513545527c9f142028cbfd7c8535a9507ce83d19a3279586227077a4593ed0 SHA512 903e0cf829036dd1e038341c8468141db542a530b42c71b4e439a898b9c760ee9aade537d0e1922106f9108f93a809b2415550b954e7e9ea046a258e2f4408c1 AUX openvdb-10.0.1-fix-linking-of-vdb_tool-with-OpenEXR.patch 1007 BLAKE2B 3dd8f5aae5047e95893db8ec62e0626bd2c0bdc50463f4111e3dbe2dcb34da5b1455fb1eb14d4c4676a5831b21223f6d0d2395d66908a493c78d845bce22ab39 SHA512 0e1371b3d45db16c62bb28116c9a41d956b7ea9e58fc814474e10b4d4220b29516bc2642fbd7e35bf66d1b93e3346b80611da40b2a0c97ab6e25c0821dd7b7b7 AUX openvdb-10.0.1-log4cplus-version.patch 755 BLAKE2B f5202615f82edfa50b5e9bd6cd89bad6f123c6595bd68d03f53dcac420f11e19c2c777533816cf6bc56efa135c01f4fe04fcc2eedb2e5473afa41398d249883e SHA512 6686ad0a1245bbfa83b532e701a3c163a6b9c51cf01fffc74f9bd20f2df1c8c6cea25f9c8fd72f92964a4d9edd798c918c1d962320871f0ca8112288a2c4b201 +AUX openvdb-11.0.0-cmake_fixes.patch 3993 BLAKE2B 28dbc929160c2f6e0e9358c8ba952cd5bed120551443592416398b04b3bc1745168dc74179ce0eb03bab0aa1a54b4992c66866f301af9d7a2ffcad78b933c22d SHA512 889b951196b2978818e8bd5750696254705101b974dabf460122901b80a795baef164ade1878a8059bd35d02f7071f5029b8d52c3032231689bb397cb497d53a +AUX openvdb-11.0.0-constexpr-version.patch 3661 BLAKE2B 5c0de6186d31ab4eba801d2699660a730e67ba0d6957383757389c1e88fa0a73fb1e82035e6d18d6384e3b5a16bf829cbcded3d9979ccab94f9568632b6bc533 SHA512 77da0c36b55392283fd0bda6f05f2aec9da5e7b9dd52baea7a0d51d0768cc842a4aa8f23bd3401892dd7b573d61c1f86db71c3320a270c2464291e66944eab1e AUX openvdb-8.1.0-glfw-libdir.patch 742 BLAKE2B 2ab1de05da49480584e373dba0f4a8504f6116ee22c46247f72802a9d412df43603b79b9620d0be2efe9745c30d962d1404325f3b09cae4ac9fe1e3bc0052d42 SHA512 beebad98890dc05c7c34594155fcdb163353b3a92c1571c7b017481b1fa167735ec54df019ed5d154e7d0973d3c1d9fd779508d2360f3306eefa6e45d3240d0b AUX openvdb-9.0.0-fix-atomic.patch 1548 BLAKE2B 718d9eb0511ea50733d7f11b6720a90fd052452f049afbeceecedb2612963f8dfa53d81030671dd426acb1b8d9280e780bfe39030660152b933c80c21c5e1fbd SHA512 316eb3253d53f7fda43f90e3e6f432aa8e5a687c535cefee04c5af682ede05e744513394f16569c50b4cb2baf142750ed19ae815141738d25babad41699e8a46 DIST openvdb-10.0.1.tar.gz 3461352 BLAKE2B 506168a4bb29bab2a3a3cb37002858517000dc1682f04d95387fd1e250b61c61d92d2ffdf9b679d83ef1ce270909693ebd46224b732ce264685004d1e47b3027 SHA512 361cef8932b69b19ee94c47fe78f665a1acabfabc3f45ff9f490e830f73ff092c42f56ce698677476a8ccf062c89e3e4dc6d4c550aa6842438cbd4d404ee83bb +DIST openvdb-11.0.0.tar.gz 4620858 BLAKE2B b970167fffa10f28f89c0a3497c7a6076462702c7ede6aacc098239a81f5f09f408b56c37f84ea68e301cedff24920f02a6d08c1f00a2b9ca48925ef7cdc85c7 SHA512 f2c90ca8435ecbacefda429341000ecb555385c746a3e0233220cd78540cee2a26cc17df7b560fdfe2dc03f2b2e960a2fa226a85980189c3e018164ccc037bd4 EBUILD openvdb-10.0.1.ebuild 5111 BLAKE2B cd12c0484e98b98486c9d19d14a9f58fc7ce0c67514045295541ec116e7e0930ea7feb246fb42adcd356b47833114192341e7b1d76855473190424ef379509b8 SHA512 db706a6f488a0d26b58e0e54c675da319bf185cb6114f99e6a70f05afdec950a46ca81791483e4e09a1f21910b4241f9a024827043140c8f30b970f9b719080a -MISC metadata.xml 1610 BLAKE2B 71b91579875d9f8faabae757af3d529b81f1579aef0fab020a439e53bfbbbe6ae210de6b4bf8a2f32a2c535b99a90390ff2c04b894ee64f2467ba18e990eb2c8 SHA512 35cf42af6b53fa086eca70554ce834fd3134c5178f6c89722326add4dbbbff932ce9c4edf01b215aacad8bbd90b5d3b984af14f1a4b435973387bb8ebcde9171 +EBUILD openvdb-11.0.0.ebuild 9615 BLAKE2B f167b204ed1758cf74cc5b1c9f33336a322d8dabec65dc003ace1c0623affcfe103a44e36f8ef05a5627aea7ba46f1dd86bd4c33f29a2d91875f80e8757a82b7 SHA512 255accf8149f1899369a238cc6c417fd255b4d34b96c70875d3af79f5a3a047f7e40bfa7f4d0f05d1053ea417ee11963990fce99a0946959853aac5cdd8d86fe +MISC metadata.xml 1918 BLAKE2B 48ba691427f080ca3c1bfc961b9eefa2e27d2902249ea5961e36b79a3ae4afddeaa9ec6efd01f68ca9b8fb77b197be0e576984820c324e9569a81ce5da29eaa1 SHA512 8207125e93719cb591abc4437e1e803202bad79b70e4a71925526d215f0d845f2f15d2d6322fe1f2f38cdd21b3573adc4fe2dd974e4d610884b69fa4873393c1 diff --git a/media-gfx/openvdb/files/openvdb-11.0.0-cmake_fixes.patch b/media-gfx/openvdb/files/openvdb-11.0.0-cmake_fixes.patch new file mode 100644 index 000000000000..491a3781ba7c --- /dev/null +++ b/media-gfx/openvdb/files/openvdb-11.0.0-cmake_fixes.patch @@ -0,0 +1,84 @@ +From: Paul Zander <negril.nx+gentoo@gmail.com> + +remove redundant Find*.cmake files +use CMake 3.20 GTest targets for nanovdb +change vdb_ax_test WORKING_DIRECTORY so testfiles can be found +fix syntax for OpenVDBCXX.cmake + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9ecdaef..9dd416e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -287,9 +287,7 @@ if(OPENVDB_INSTALL_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 +diff --git a/nanovdb/nanovdb/unittest/CMakeLists.txt b/nanovdb/nanovdb/unittest/CMakeLists.txt +index b0a32be..4d294f4 100644 +--- a/nanovdb/nanovdb/unittest/CMakeLists.txt ++++ b/nanovdb/nanovdb/unittest/CMakeLists.txt +@@ -20,7 +20,7 @@ message(STATUS "----------------------------------------------------") + + ############################################################################### + # TODO: Benchmark should probably not require gtest. +-if(NOT TARGET GTest::GTest) ++if(NOT TARGET GTest::gtest_main) + message(WARNING " - GTest required to build unittests. Skipping.") + return() + endif() +@@ -36,14 +36,14 @@ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/data") + # ----------------------------------------------------------------------------- + + add_executable(nanovdb_test_nanovdb "TestNanoVDB.cc") +-target_link_libraries(nanovdb_test_nanovdb PRIVATE nanovdb GTest::GTest GTest::Main) ++target_link_libraries(nanovdb_test_nanovdb PRIVATE nanovdb GTest::gtest GTest::gtest_main) + add_test(nanovdb_unit_test nanovdb_test_nanovdb) + + # ----------------------------------------------------------------------------- + + if(NANOVDB_USE_CUDA) + add_executable(nanovdb_test_cuda "TestNanoVDB.cu") +- target_link_libraries(nanovdb_test_cuda PRIVATE nanovdb GTest::GTest GTest::Main) ++ target_link_libraries(nanovdb_test_cuda PRIVATE nanovdb GTest::gtest GTest::gtest_main) + add_test(nanovdb_cuda_unit_test nanovdb_test_cuda) + endif() + +@@ -55,5 +55,5 @@ if(NOT (NANOVDB_USE_TBB AND NANOVDB_USE_OPENVDB)) + endif() + + add_executable(nanovdb_test_openvdb "TestOpenVDB.cc") +-target_link_libraries(nanovdb_test_openvdb PRIVATE nanovdb GTest::GTest GTest::Main) ++target_link_libraries(nanovdb_test_openvdb PRIVATE nanovdb GTest::gtest GTest::gtest_main) + add_test(nanovdb_openvdb_unit_test nanovdb_test_openvdb) +diff --git a/openvdb_ax/openvdb_ax/test/CMakeLists.txt b/openvdb_ax/openvdb_ax/test/CMakeLists.txt +index e403f71..91774f8 100644 +--- a/openvdb_ax/openvdb_ax/test/CMakeLists.txt ++++ b/openvdb_ax/openvdb_ax/test/CMakeLists.txt +@@ -131,7 +131,7 @@ if(OPENVDB_AX_TEST_PROFILE) + target_compile_definitions(vdb_ax_test PRIVATE "-DPROFILE") + endif() + +-add_test(NAME vdb_ax_unit_test COMMAND vdb_ax_test -v WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../) ++add_test(NAME vdb_ax_unit_test COMMAND vdb_ax_test -v WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + + # For the undefined behaviour sanitizer, add the suppression file and + # additional options +diff --git a/cmake/config/OpenVDBCXX.cmake b/cmake/config/OpenVDBCXX.cmake +index 5ad5d18..a6c4ebe 100644 +--- a/cmake/config/OpenVDBCXX.cmake ++++ b/cmake/config/OpenVDBCXX.cmake +@@ -252,7 +252,7 @@ set(EXTRA_BUILD_TYPES coverage tsan asan lsan msan ubsan) + # DebugNoInfo - An internal build type only used by the OpenVDB CI. no optimizations, no symbols, asserts enabled + set(CMAKE_CXX_FLAGS_DebugNoInfo "" CACHE STRING "Flags used by the C++ compiler during DebugNoInfo builds.") + +-foreach(TYPE ${EXTRA_BUILD_TYPES}) ++foreach(TYPE IN LISTS EXTRA_BUILD_TYPES) + set(CMAKE_CXX_FLAGS_${U_TYPE} "" CACHE STRING "Flags used by the C++ compiler during ${TYPE} builds.") + set(CMAKE_SHARED_LINKER_FLAGS_${U_TYPE} "" CACHE STRING "Flags used by the linker during ${TYPE} builds.") + set(CMAKE_EXE_LINKER_FLAGS_${U_TYPE} "" CACHE STRING "Flags used by the linker during ${TYPE} builds.") diff --git a/media-gfx/openvdb/files/openvdb-11.0.0-constexpr-version.patch b/media-gfx/openvdb/files/openvdb-11.0.0-constexpr-version.patch new file mode 100644 index 000000000000..17377a411d2c --- /dev/null +++ b/media-gfx/openvdb/files/openvdb-11.0.0-constexpr-version.patch @@ -0,0 +1,55 @@ +From: Paul Zander <negril.nx+gentoo@gmail.com> + +make Version constexpr so it can be used to decern the API at runtime (see Blender) + +--- a/nanovdb/nanovdb/NanoVDB.h 2023-11-23 15:03:52.227292525 +0100 ++++ b/nanovdb/nanovdb/NanoVDB.h 2023-11-23 15:05:10.508818683 +0100 +@@ -948,34 +948,34 @@ + { + uint32_t mData; // 11 + 11 + 10 bit packing of major + minor + patch + public: +- __hostdev__ Version() ++ __hostdev__ constexpr Version() + : mData(uint32_t(NANOVDB_MAJOR_VERSION_NUMBER) << 21 | + uint32_t(NANOVDB_MINOR_VERSION_NUMBER) << 10 | + uint32_t(NANOVDB_PATCH_VERSION_NUMBER)) + { + } +- __hostdev__ Version(uint32_t data) : mData(data) {} +- __hostdev__ Version(uint32_t major, uint32_t minor, uint32_t patch) ++ __hostdev__ constexpr Version(uint32_t data) : mData(data) {} ++ __hostdev__ constexpr Version(uint32_t major, uint32_t minor, uint32_t patch) + : mData(major << 21 | minor << 10 | patch) + { + NANOVDB_ASSERT(major < (1u << 11)); // max value of major is 2047 + NANOVDB_ASSERT(minor < (1u << 11)); // max value of minor is 2047 + NANOVDB_ASSERT(patch < (1u << 10)); // max value of patch is 1023 + } +- __hostdev__ bool operator==(const Version& rhs) const { return mData == rhs.mData; } +- __hostdev__ bool operator<( const Version& rhs) const { return mData < rhs.mData; } +- __hostdev__ bool operator<=(const Version& rhs) const { return mData <= rhs.mData; } +- __hostdev__ bool operator>( const Version& rhs) const { return mData > rhs.mData; } +- __hostdev__ bool operator>=(const Version& rhs) const { return mData >= rhs.mData; } +- __hostdev__ uint32_t id() const { return mData; } +- __hostdev__ uint32_t getMajor() const { return (mData >> 21) & ((1u << 11) - 1); } +- __hostdev__ uint32_t getMinor() const { return (mData >> 10) & ((1u << 11) - 1); } +- __hostdev__ uint32_t getPatch() const { return mData & ((1u << 10) - 1); } +- __hostdev__ bool isCompatible() const { return this->getMajor() == uint32_t(NANOVDB_MAJOR_VERSION_NUMBER);} ++ __hostdev__ constexpr bool operator==(const Version& rhs) const { return mData == rhs.mData; } ++ __hostdev__ constexpr bool operator<( const Version& rhs) const { return mData < rhs.mData; } ++ __hostdev__ constexpr bool operator<=(const Version& rhs) const { return mData <= rhs.mData; } ++ __hostdev__ constexpr bool operator>( const Version& rhs) const { return mData > rhs.mData; } ++ __hostdev__ constexpr bool operator>=(const Version& rhs) const { return mData >= rhs.mData; } ++ __hostdev__ constexpr uint32_t id() const { return mData; } ++ __hostdev__ constexpr uint32_t getMajor() const { return (mData >> 21) & ((1u << 11) - 1); } ++ __hostdev__ constexpr uint32_t getMinor() const { return (mData >> 10) & ((1u << 11) - 1); } ++ __hostdev__ constexpr uint32_t getPatch() const { return mData & ((1u << 10) - 1); } ++ __hostdev__ constexpr bool isCompatible() const { return this->getMajor() == uint32_t(NANOVDB_MAJOR_VERSION_NUMBER);} + /// @brief Check the major version of this instance relative to NANOVDB_MAJOR_VERSION_NUMBER + /// @return return 0 if the major version equals NANOVDB_MAJOR_VERSION_NUMBER, else a negative age if it is + /// older, i.e. smaller, and a positive age if it's newer, i.e.e larger. +- __hostdev__ int age() const {return int(this->getMajor()) - int(NANOVDB_MAJOR_VERSION_NUMBER);} ++ __hostdev__ constexpr int age() const {return int(this->getMajor()) - int(NANOVDB_MAJOR_VERSION_NUMBER);} + + #ifndef __CUDACC_RTC__ + const char* c_str() const diff --git a/media-gfx/openvdb/metadata.xml b/media-gfx/openvdb/metadata.xml index 888390378264..c0e6c1dda969 100644 --- a/media-gfx/openvdb/metadata.xml +++ b/media-gfx/openvdb/metadata.xml @@ -15,6 +15,12 @@ Chance of Meatballs2' and 'How to Train Your Dragon 2'. </longdescription> <use> + <flag name="abi12-compat"> + Disables newer features to maintain compatibility with ABI12 + </flag> + <flag name="abi11-compat"> + Disables newer features to maintain compatibility with ABI11 + </flag> <flag name="abi10-compat"> Disables newer features to maintain compatibility with ABI10 </flag> @@ -24,6 +30,10 @@ <flag name="abi9-compat"> Disables newer features to maintain compatibility with ABI9 </flag> + <flag name="alembic"> + Add support for Alembic through + <pkg>media-gfx/alembic</pkg>. + </flag> <flag name="ax"> Build the OpenVDB AX module to perform custom manipulation of OpenVDB data via an expression language: AX diff --git a/media-gfx/openvdb/openvdb-11.0.0.ebuild b/media-gfx/openvdb/openvdb-11.0.0.ebuild new file mode 100644 index 000000000000..056d464f7218 --- /dev/null +++ b/media-gfx/openvdb/openvdb-11.0.0.ebuild @@ -0,0 +1,368 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..12} ) + +LLVM_MAX_SLOT=15 + +inherit cmake cuda flag-o-matic llvm multibuild python-single-r1 toolchain-funcs + +DESCRIPTION="Library for the efficient manipulation of volumetric data" +HOMEPAGE="https://www.openvdb.org" +SRC_URI="https://github.com/AcademySoftwareFoundation/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MPL-2.0" +OPENVDB_ABI=$(ver_cut 1) +SLOT="0/$PV" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86" +IUSE="abi$((OPENVDB_ABI + 1))-compat +abi${OPENVDB_ABI}-compat abi$((OPENVDB_ABI - 1))-compat abi$((OPENVDB_ABI - 2))-compat alembic ax +blosc cpu_flags_x86_avx cpu_flags_x86_sse4_2 + cuda doc examples jpeg +nanovdb numpy openexr png python static-libs test utils zlib" +RESTRICT="!test? ( test )" + +REQUIRED_USE=" + ?? ( + abi$((OPENVDB_ABI + 1))-compat + abi${OPENVDB_ABI}-compat + abi$((OPENVDB_ABI - 1))-compat + abi$((OPENVDB_ABI - 2))-compat + ) + cpu_flags_x86_avx? ( cpu_flags_x86_sse4_2 ) + python? ( ${PYTHON_REQUIRED_USE} ) + blosc? ( zlib ) +" + +# OPTDEPEND=( +# dev-util/gcovr +# ) + +RDEPEND=" + >=dev-cpp/tbb-2020.3:= + dev-libs/boost:= + dev-libs/jemalloc:= + dev-libs/imath:= + ax? ( + <sys-devel/llvm-$(( LLVM_MAX_SLOT + 1 )):= + ) + blosc? ( + dev-libs/c-blosc:= + sys-libs/zlib:= + ) + nanovdb? ( + zlib? ( + sys-libs/zlib:= + ) + cuda? ( + >=dev-util/nvidia-cuda-toolkit-11 + ) + ) + python? ( + ${PYTHON_DEPS} + $(python_gen_cond_dep ' + dev-libs/boost:=[numpy?,${PYTHON_USEDEP}] + dev-python/pybind11[${PYTHON_USEDEP}] + numpy? ( dev-python/numpy[${PYTHON_USEDEP}] ) + ') + ) + utils? ( + x11-libs/libXcursor + x11-libs/libXi + x11-libs/libXinerama + x11-libs/libXrandr + media-libs/glfw + media-libs/glu + alembic? ( media-gfx/alembic ) + jpeg? ( media-libs/libjpeg-turbo:= ) + png? ( media-libs/libpng:= ) + openexr? ( >=media-libs/openexr-3:= ) + media-libs/libglvnd + ) + !ax? ( + dev-libs/log4cplus:= + ) +" + +DEPEND="${RDEPEND}" +BDEPEND=" + virtual/pkgconfig + doc? ( + app-text/doxygen + dev-texlive/texlive-bibtexextra + dev-texlive/texlive-fontsextra + dev-texlive/texlive-fontutils + dev-texlive/texlive-latex + dev-texlive/texlive-latexextra + ) + test? ( + dev-cpp/gtest + dev-util/cppunit + ) +" + +PATCHES=( + "${FILESDIR}/${PN}-8.1.0-glfw-libdir.patch" + + "${FILESDIR}/${PN}-9.0.0-fix-atomic.patch" + + "${FILESDIR}/${PN}-10.0.1-fix-linking-of-vdb_tool-with-OpenEXR.patch" + "${FILESDIR}/${PN}-10.0.1-log4cplus-version.patch" + + "${FILESDIR}/${PN}-11.0.0-constexpr-version.patch" + "${FILESDIR}/${PN}-11.0.0-cmake_fixes.patch" +) + +cuda_set_CUDAHOSTCXX() { + local compiler + tc-is-gcc && compiler="gcc" + tc-is-clang && compiler="clang" + [[ -z "$compiler" ]] && die "no compiler specified" + + local package="sys-devel/${compiler}" + local version="${package}" + local CUDAHOSTCXX_test + while + CUDAHOSTCXX="${CUDAHOSTCXX_test}" + version=$(best_version "${version}") + if [[ -z "${version}" ]]; then + if [[ -z "${CUDAHOSTCXX}" ]]; then + die "could not find supported version of ${package}" + fi + break + fi + CUDAHOSTCXX_test="$( + dirname "$( + realpath "$( + which "${compiler}-$(echo "${version}" | grep -oP "(?<=${package}-)[0-9]*")" + )" + )" + )" + version="<${version}" + do ! echo "int main(){}" | nvcc "-ccbin ${CUDAHOSTCXX_test}" - -x cu &>/dev/null; done + + export CUDAHOSTCXX +} + +cuda_get_host_arch() { + [[ -z "${CUDAARCHS}" ]] && einfo "trying to determine host CUDAARCHS" + : "${CUDAARCHS:=$(__nvcc_device_query)}" + einfo "building for CUDAARCHS = ${CUDAARCHS}" + + export CUDAARCHS +} + +pkg_setup() { + use ax && llvm_pkg_setup + use python && python-single-r1_pkg_setup +} + +src_prepare() { + MULTIBUILD_VARIANTS=( install ) + use test && MULTIBUILD_VARIANTS+=( test ) + + rm "cmake/Find"{OpenEXR,TBB}".cmake" || die + + if use nanovdb; then + sed \ + -e 's#message(WARNING " - OpenVDB required to build#message(VERBOSE " - OpenVDB required to build#g' \ + -i "nanovdb/nanovdb/"*"/CMakeLists.txt" || die + fi + + cmake_src_prepare + + sed -e 's|/usr/local/bin/python|/usr/bin/python|' \ + -i "${S}"/openvdb/openvdb/python/test/TestOpenVDB.py || die +} + +my_src_configure() { + local version + version=$(ver_cut 1) + if use "abi$(( version + 1 ))-compat"; then + version=$(( version + 1 )) + elif use "abi$(( version - 1 ))-compat"; then + version=$(( version - 1 )) + elif use "abi$(( version - 2 ))-compat"; then + version=$(( version - 2 )) + fi + + local mycmakeargs=( + -DCMAKE_FIND_PACKAGE_PREFER_CONFIG="yes" + -DCMAKE_INSTALL_DOCDIR="share/doc/${PF}/" + + -DOPENVDB_ABI_VERSION_NUMBER="${version}" + -DOPENVDB_BUILD_DOCS="$(usex doc)" + -DOPENVDB_BUILD_UNITTESTS="$(usex test)" + -DOPENVDB_BUILD_VDB_LOD="$(usex utils)" + -DOPENVDB_BUILD_VDB_RENDER="$(usex utils)" + -DOPENVDB_BUILD_VDB_TOOL="$(usex utils)" + -DOPENVDB_BUILD_VDB_VIEW="$(usex utils)" + -DOPENVDB_CORE_SHARED="yes" + -DOPENVDB_CORE_STATIC="$(usex static-libs)" + # -DOPENVDB_CXX_STRICT="yes" + -DOPENVDB_ENABLE_UNINSTALL="no" + + -DUSE_AX="$(usex ax)" + + -DOPENVDB_BUILD_HOUDINI_PLUGIN="no" + # -DOPENVDB_DOXYGEN_HOUDINI="no" + + -DUSE_BLOSC="$(usex blosc)" + # -DUSE_CCACHE="no" + -DUSE_COLORED_OUTPUT="yes" + # OpenEXR is only needed by the vdb_render tool and defaults to OFF + -DUSE_EXR="$(usex openexr "$(usex utils)")" + # not packaged + -DUSE_HOUDINI="no" + # replaces openexr half + -DUSE_IMATH_HALF="yes" + -DUSE_LOG4CPLUS="$(usex !ax)" + -DUSE_PKGCONFIG="yes" + # PNG is only needed by the vdb_render tool and defaults to OFF + -DUSE_PNG="$(usex png "$(usex utils)")" + -DUSE_TBB="yes" + -DUSE_ZLIB="$(usex zlib)" + + "-DOPENVDB_USE_FUTURE_ABI_$(( version + 1 ))=$(usex "abi$(( version + 1 ))-compat")" + "-DOPENVDB_USE_DEPRECATED_ABI_$(( version - 1 ))=$(usex "abi$(( version - 1 ))-compat")" + "-DOPENVDB_USE_DEPRECATED_ABI_$(( version - 2 ))=$(usex "abi$(( version - 2 ))-compat")" + ) + + if use ax; then + mycmakeargs+=( + -DOPENVDB_AX_STATIC="$(usex static-libs)" + -DOPENVDB_DOXYGEN_AX="$(usex doc)" + # due to multibuild + # -DOPENVDB_AX_TEST_CMD="$(usex test)" + # -DOPENVDB_AX_TEST_CMD_DOWNLOADS="$(usex test)" + -DOPENVDB_BUILD_AX_UNITTESTS="$(usex test)" # FIXME: log4cplus init and other errors + -DOPENVDB_BUILD_VDB_AX="$(usex utils)" + ) + fi + + if use nanovdb; then + mycmakeargs+=( + -DUSE_NANOVDB="yes" + # NOTE intentional so it breaks in sandbox if files are missing + -DNANOVDB_ALLOW_FETCHCONTENT="yes" + -DNANOVDB_BUILD_EXAMPLES="$(usex examples)" + -DNANOVDB_BUILD_TOOLS="$(usex utils)" + -DNANOVDB_BUILD_UNITTESTS="$(usex test)" + -DNANOVDB_USE_BLOSC="$(usex blosc)" + -DNANOVDB_USE_CUDA="$(usex cuda)" + -DNANOVDB_USE_ZLIB="$(usex zlib)" + + # TODO add openvdb use flag or split nanovdb as they can be build independent of each other + -DNANOVDB_USE_OPENVDB="yes" + ) + if use cpu_flags_x86_avx || use cpu_flags_x86_sse4_2; then + mycmakeargs+=( + -DNANOVDB_USE_INTRINSICS="yes" + ) + fi + + if use cuda; then + cuda_add_sandbox -w + cuda_set_CUDAHOSTCXX + cuda_get_host_arch + + # NOTE tbb includes immintrin.h, which breaks nvcc so we pretend they are already included + export CUDAFLAGS="-D_AVX512BF16VLINTRIN_H_INCLUDED -D_AVX512BF16INTRIN_H_INCLUDED" + fi + + if use utils; then + mycmakeargs+=( + -DOPENVDB_TOOL_USE_NANO="yes" + -DOPENVDB_TOOL_NANO_USE_BLOSC="$(usex blosc)" + -DOPENVDB_TOOL_NANO_USE_ZIP="$(usex zlib)" + ) + fi + fi + + if use python; then + mycmakeargs+=( + -DOPENVDB_BUILD_PYTHON_MODULE="yes" + -DUSE_NUMPY="$(usex numpy)" + -DPYOPENVDB_INSTALL_DIRECTORY="$(python_get_sitedir)" + -DPython_INCLUDE_DIR="$(python_get_includedir)" + ) + use test && mycmakeargs+=( + -DPython_EXECUTABLE="${PYTHON}" + -DOPENVDB_BUILD_PYTHON_UNITTESTS="yes" + ) + fi + + # options for the new vdb_tool binary + if use utils; then + mycmakeargs+=( + -DBUILD_TEST="$(usex test)" + -DOPENVDB_BUILD_VDB_AX="$(usex ax)" + + -DOPENVDB_TOOL_USE_ABC="$(usex alembic)" # Alembic + -DOPENVDB_TOOL_USE_EXR="$(usex openexr)" # OpenEXR + -DOPENVDB_TOOL_USE_JPG="$(usex jpeg)" # libjpeg-turbo + -DOPENVDB_TOOL_USE_PNG="$(usex png)" # libpng + ) + fi + + if use cpu_flags_x86_avx; then + mycmakeargs+=( -DOPENVDB_SIMD="AVX" ) + elif use cpu_flags_x86_sse4_2; then + mycmakeargs+=( -DOPENVDB_SIMD="SSE42" ) + fi + + if [[ "${MULTIBUILD_VARIANT}" == "test" ]]; then + # NOTE Certain tests expect bit equality and don't set tolerance violating the C standard + # 6.5 8) + # A floating expression may be contracted, that is, evaluated as though it were an atomic operation, + # thereby omitting rounding errors implied by the source code and the expression evaluation method. + # The FP_CONTRACT pragma in <math.h> provides a way to disallow contracted expressions. + # Otherwise, whether and how expressions are contracted is implementation-defined. + # + # To reproduce the upstream tests the testsuite is compiled separate with FP_CONTRACT=OFF + append-cflags "-ffp-contract=off" + append-cxxflags "-ffp-contract=off" + if use ax; then + mycmakeargs+=( + -DOPENVDB_AX_TEST_CMD="yes" + -DOPENVDB_AX_TEST_CMD_DOWNLOADS="yes" + ) + fi + fi + + cmake_src_configure +} + +my_src_test() { + [[ "${MULTIBUILD_VARIANT}" != "test" ]] && return + + if use ax; then + ln -sr "${CMAKE_USE_DIR}/openvdb_ax/openvdb_ax/test" "${BUILD_DIR}/test" || die + fi + + if use cuda; then + cuda_add_sandbox -w + fi + + cmake_src_test +} + +my_src_install() { + [[ "${MULTIBUILD_VARIANT}" == "test" ]] && return + cmake_src_install +} + +src_configure() { + multibuild_foreach_variant my_src_configure +} + +src_compile() { + multibuild_foreach_variant cmake_src_compile +} + +src_test() { + multibuild_foreach_variant my_src_test +} + +src_install() { + multibuild_foreach_variant my_src_install +} |