diff options
-rw-r--r-- | media-gfx/blender/blender-4.0.1.ebuild | 1 | ||||
-rw-r--r-- | media-gfx/blender/blender-9999.ebuild | 4 | ||||
-rw-r--r-- | media-gfx/blender/files/blender-4.0.1-openvdb-11.patch | 73 | ||||
-rw-r--r-- | media-gfx/openvdb/Manifest | 1 | ||||
-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 | ||||
-rw-r--r-- | profiles/arch/riscv/package.use.mask | 4 | ||||
-rw-r--r-- | profiles/base/package.use.mask | 2 |
10 files changed, 601 insertions, 1 deletions
diff --git a/media-gfx/blender/blender-4.0.1.ebuild b/media-gfx/blender/blender-4.0.1.ebuild index 853b1444f8d1..a943d6078e8c 100644 --- a/media-gfx/blender/blender-4.0.1.ebuild +++ b/media-gfx/blender/blender-4.0.1.ebuild @@ -143,6 +143,7 @@ BDEPEND=" PATCHES=( "${FILESDIR}/${PN}-4.0.1-fix-cflags-cleaner.patch" # to be dropped for releases after Dec 8, 2023 + "${FILESDIR}/${PN}-4.0.1-openvdb-11.patch" ) blender_check_requirements() { diff --git a/media-gfx/blender/blender-9999.ebuild b/media-gfx/blender/blender-9999.ebuild index d1c33bb35bd4..bc907241e946 100644 --- a/media-gfx/blender/blender-9999.ebuild +++ b/media-gfx/blender/blender-9999.ebuild @@ -143,6 +143,10 @@ BDEPEND=" ) " +PATCHES=( + "${FILESDIR}/${PN}-4.0.1-openvdb-11.patch" +) + blender_check_requirements() { [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp diff --git a/media-gfx/blender/files/blender-4.0.1-openvdb-11.patch b/media-gfx/blender/files/blender-4.0.1-openvdb-11.patch new file mode 100644 index 000000000000..d9455222c6a7 --- /dev/null +++ b/media-gfx/blender/files/blender-4.0.1-openvdb-11.patch @@ -0,0 +1,73 @@ +--- a/intern/cycles/scene/image_vdb.cpp 2023-11-23 14:42:38.772685628 +0100 ++++ b/intern/cycles/scene/image_vdb.cpp 2023-11-23 15:19:55.475804922 +0100 +@@ -11,7 +11,14 @@ + # include <openvdb/tools/Dense.h> + #endif + #ifdef WITH_NANOVDB +-# include <nanovdb/util/OpenToNanoVDB.h> ++# include <nanovdb/NanoVDB.h> ++# define NANOVDB_VERSION(major, minor, patch) (major << 21 | minor << 10 | patch) ++# if NANOVDB_VERSION(NANOVDB_MAJOR_VERSION_NUMBER, NANOVDB_MINOR_VERSION_NUMBER, NANOVDB_PATCH_VERSION_NUMBER) >= NANOVDB_VERSION(32, 6, 0) ++# include <nanovdb/util/CreateNanoGrid.h> ++# else ++# include <nanovdb/util/OpenToNanoVDB.h> ++# endif ++# undef NANOVDB_VERSION + #endif + + CCL_NAMESPACE_BEGIN +@@ -55,20 +62,35 @@ + FloatGridType floatgrid(*openvdb::gridConstPtrCast<GridType>(grid)); + if constexpr (std::is_same_v<FloatGridType, openvdb::FloatGrid>) { + if (precision == 0) { +- nanogrid = nanovdb::openToNanoVDB<nanovdb::HostBuffer, +- typename FloatGridType::TreeType, +- nanovdb::FpN>(floatgrid); ++ if constexpr (nanovdb::Version() >= nanovdb::Version(32,6,0)) { ++ nanogrid = nanovdb::createNanoGrid(floatgrid); ++ } ++ else { ++ nanogrid = nanovdb::openToNanoVDB<nanovdb::HostBuffer, ++ typename FloatGridType::TreeType, ++ nanovdb::FpN>(floatgrid); ++ } + return true; + } +- else if (precision == 16) { +- nanogrid = nanovdb::openToNanoVDB<nanovdb::HostBuffer, +- typename FloatGridType::TreeType, +- nanovdb::Fp16>(floatgrid); ++ if (precision == 16) { ++ if constexpr (nanovdb::Version() > nanovdb::Version(32,4,0)) { ++ nanogrid = nanovdb::createNanoGrid(floatgrid); ++ } ++ else { ++ nanogrid = nanovdb::openToNanoVDB<nanovdb::HostBuffer, ++ typename FloatGridType::TreeType, ++ nanovdb::Fp16>(floatgrid); ++ } + return true; + } + } + +- nanogrid = nanovdb::openToNanoVDB(floatgrid); ++ if constexpr (nanovdb::Version() > nanovdb::Version(32,4,0)) { ++ nanogrid = nanovdb::createNanoGrid(floatgrid); ++ } ++ else { ++ nanogrid = nanovdb::openToNanoVDB(floatgrid); ++ } + } + catch (const std::exception &e) { + VLOG_WARNING << "Error converting OpenVDB to NanoVDB grid: " << e.what(); +--- a/CMakeLists.txt 2023-11-23 15:59:58.715805024 +0100 ++++ b/CMakeLists.txt 2023-11-23 16:06:42.352711508 +0100 +@@ -1461,7 +1461,7 @@ + endif() + + if(WITH_OPENVDB) +- list(APPEND OPENVDB_DEFINITIONS -DWITH_OPENVDB) ++ list(APPEND OPENVDB_DEFINITIONS -DWITH_OPENVDB -DNANOVDB_USE_OPENVDB) + + if(WITH_OPENVDB_3_ABI_COMPATIBLE) + list(APPEND OPENVDB_DEFINITIONS -DOPENVDB_3_ABI_COMPATIBLE) diff --git a/media-gfx/openvdb/Manifest b/media-gfx/openvdb/Manifest index 4ddf7d7dbf21..ffa937062858 100644 --- a/media-gfx/openvdb/Manifest +++ b/media-gfx/openvdb/Manifest @@ -1 +1,2 @@ DIST openvdb-10.0.1.tar.gz 3461352 BLAKE2B 506168a4bb29bab2a3a3cb37002858517000dc1682f04d95387fd1e250b61c61d92d2ffdf9b679d83ef1ce270909693ebd46224b732ce264685004d1e47b3027 SHA512 361cef8932b69b19ee94c47fe78f665a1acabfabc3f45ff9f490e830f73ff092c42f56ce698677476a8ccf062c89e3e4dc6d4c550aa6842438cbd4d404ee83bb +DIST openvdb-11.0.0.tar.gz 4620858 BLAKE2B b970167fffa10f28f89c0a3497c7a6076462702c7ede6aacc098239a81f5f09f408b56c37f84ea68e301cedff24920f02a6d08c1f00a2b9ca48925ef7cdc85c7 SHA512 f2c90ca8435ecbacefda429341000ecb555385c746a3e0233220cd78540cee2a26cc17df7b560fdfe2dc03f2b2e960a2fa226a85980189c3e018164ccc037bd4 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..23252c26a1f2 --- /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" + 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 +} diff --git a/profiles/arch/riscv/package.use.mask b/profiles/arch/riscv/package.use.mask index 5f3674f57d60..ac83a3b8d238 100644 --- a/profiles/arch/riscv/package.use.mask +++ b/profiles/arch/riscv/package.use.mask @@ -1,6 +1,10 @@ # Copyright 2019-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +# Paul Zander <negril.nx+gentoo@gmail.com> (2024-02-18) +# alembic not stable yet +media-gfx/openvdb alembic + # Michal Privoznik <michal.privoznik@gmail.com> (2024-01-18) # No sys-block/nbdkit on riscv, yet app-emulation/libvirt nbd diff --git a/profiles/base/package.use.mask b/profiles/base/package.use.mask index 6490341d8691..777555152136 100644 --- a/profiles/base/package.use.mask +++ b/profiles/base/package.use.mask @@ -38,7 +38,7 @@ net-analyzer/nagios-plugin-check_raid hpa # Michał Górny <mgorny@gentoo.org> (2023-12-22) # Requires LLVM 14 that is being removed. <dev-lang/ghc-9.4 llvm -media-gfx/openvdb ax +<media-gfx/openvdb-11 ax sys-devel/sparse llvm # Takuya Wakazono <pastalian46@gmail.com> (2023-11-21) |