media-gfx/openvdb: revbump for build configuration changes; rebase 8.1/9.0

Rebasing on waebbl's changes.

See: https://github.com/gentoo/gentoo/pull/22738
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James
2021-10-31 02:18:29 +00:00
parent 09efbdab3e
commit 1e960a2829
5 changed files with 164 additions and 7 deletions
@@ -0,0 +1,151 @@
Grabbed relevant parts from upstream PR for 9.x; it's a variant
of https://github.com/gentoo/gentoo/pull/22738 which wa sfor earlier versions.
https://github.com/AcademySoftwareFoundation/openvdb/pull/1237
From 3c5f69efeacca762406a80d74b39b970c7023bd6 Mon Sep 17 00:00:00 2001
From: Nick Avramoussis <4256455+Idclip@users.noreply.github.com>
Date: Thu, 28 Oct 2021 16:54:10 +0100
Subject: [PATCH 1/3] Improvements to find_package Python usage. Primarily
fixes an issues where NumPy needs to be specified along with the Development
and Interpreter components in a single call
Signed-off-by: Nick Avramoussis <4256455+Idclip@users.noreply.github.com>
---
openvdb/openvdb/python/CMakeLists.txt | 97 +++++++++++++--------------
1 file changed, 46 insertions(+), 51 deletions(-)
diff --git a/openvdb/openvdb/python/CMakeLists.txt b/openvdb/openvdb/python/CMakeLists.txt
index 7b36379f9..5e9141e8c 100644
--- a/openvdb/openvdb/python/CMakeLists.txt
+++ b/openvdb/openvdb/python/CMakeLists.txt
@@ -55,25 +55,39 @@ endif()
# be provided to find_package(Python) with differing major versions. e.g.
# calls to find_package(Python 2.7) fails if python3 is found on the system.
function(OPENVDB_CHECK_PYTHON_VERSION)
- set(_PY_VERSION ${ARGV0})
- set(_PY_PATH ${ARGV1})
- if(NOT _PY_VERSION)
- message(FATAL_ERROR "Could NOT find Python (Required is at least version "
- "\"${MINIMUM_PYTHON_VERSION}\")"
- )
- elseif(_PY_VERSION VERSION_LESS MINIMUM_PYTHON_VERSION)
- message(FATAL_ERROR "Could NOT find Python: Found unsuitable version \"${_PY_VERSION}\""
- "but required is at least \"${MINIMUM_PYTHON_VERSION}\" (found ${_PY_PATH})"
- )
- else()
- message(STATUS "Found Python: ${_PY_PATH}) (found suitable version \"${_PY_VERSION}\", "
- "minimum required is \"${MINIMUM_PYTHON_VERSION}\")"
+ set(PY_TARGET ${ARGV0})
+ set(PY_TARGET_VERSION ${ARGV1})
+ set(PY_TARGET_INCLUDES ${ARGV2})
+ set(MIN_VERSION ${ARGV3})
+ set(FUTURE_MIN_VERSION ${ARGV4})
+
+ if(NOT TARGET ${PY_TARGET})
+ message(FATAL_ERROR "Could NOT find ${PY_TARGET} (Required is at least version "
+ "\"${MIN_VERSION}\")"
)
endif()
+
+ if(PY_TARGET_VERSION AND MIN_VERSION)
+ if(PY_TARGET_VERSION VERSION_LESS MIN_VERSION)
+ message(FATAL_ERROR "Could NOT find ${PY_TARGET}: Found unsuitable version "
+ "\"${PY_TARGET_VERSION}\" but required is at least \"${MIN_VERSION}\" (found ${PY_TARGET_INCLUDES})"
+ )
+ endif()
+ endif()
+
+ message(STATUS "Found ${PY_TARGET}: ${PY_TARGET_INCLUDES}) (found suitable "
+ "version \"${PY_TARGET_VERSION}\", minimum required is \"${MIN_VERSION}\")"
+ )
+
+ if(OPENVDB_FUTURE_DEPRECATION AND PY_TARGET_VERSION AND FUTURE_MIN_VERSION)
+ if(PY_TARGET_VERSION VERSION_LESS FUTURE_MIN_VERSION)
+ message(DEPRECATION "Support for ${PY_TARGET} versions < ${FUTURE_MIN_VERSION} "
+ "is deprecated and will be removed.")
+ endif()
+ endif()
endfunction()
# Configure Python and Numpy. Note that:
-# - find_package(Python NumPy) requires CMake >= 3.14
# - find_package(Python Development) target Python::Module requires CMake >= 3.15
# - find_package(Python Development.Module) requires CMake >= 3.18
# To ensure consistent versions between components Interpreter, Compiler,
@@ -85,38 +99,30 @@ endfunction()
set(OPENVDB_PYTHON_DEPS)
set(OPENVDB_PYTHON_REQUIRED_COMPONENTS Development)
if(NOT DEFINED PYOPENVDB_INSTALL_DIRECTORY)
- list(APPEND OPENVDB_PYTHON_REQUIRED_COMPONENTS Interpreter)
+ list(APPEND OPENVDB_PYTHON_REQUIRED_COMPONENTS Interpreter)
endif()
-find_package(Python QUIET COMPONENTS ${OPENVDB_PYTHON_REQUIRED_COMPONENTS})
-OPENVDB_CHECK_PYTHON_VERSION(${Python_VERSION} ${Python_INCLUDE_DIRS})
-
if(USE_NUMPY)
- find_package(Python QUIET COMPONENTS NumPy)
- if(NOT TARGET Python::NumPy)
- message(FATAL_ERROR "Could NOT find NumPy (Required is at least version "
- "\"${MINIMUM_NUMPY_VERSION}\")"
- )
- elseif(Python_NumPy_VERSION VERSION_LESS MINIMUM_NUMPY_VERSION)
- message(FATAL_ERROR "Could NOT find NumPy: Found unsuitable version \"${Python_NumPy_VERSION}\""
- "but required is at least \"${MINIMUM_NUMPY_VERSION}\" (found ${Python_NumPy_INCLUDE_DIRS})"
- )
- else()
- message(STATUS "Found NumPy: ${Python_NumPy_INCLUDE_DIRS} (found suitable "
- "version \"${Python_NumPy_VERSION}\", minimum required is "
- "\"${MINIMUM_NUMPY_VERSION}\")"
- )
- endif()
- list(APPEND OPENVDB_PYTHON_DEPS Python::NumPy)
+ list(APPEND OPENVDB_PYTHON_REQUIRED_COMPONENTS NumPy)
endif()
+# Make sure find_package(Python) is only ever invoked once with all required components
+find_package(Python COMPONENTS ${OPENVDB_PYTHON_REQUIRED_COMPONENTS})
+
+openvdb_check_python_version(Python::Module
+ "${Python_VERSION}"
+ "${Python_INCLUDE_DIRS}"
+ "${MINIMUM_PYTHON_VERSION}"
+ "${FUTURE_MINIMUM_PYTHON_VERSION}")
+list(APPEND OPENVDB_PYTHON_DEPS Python::Module)
+
if(USE_NUMPY)
- if(OPENVDB_FUTURE_DEPRECATION AND FUTURE_MINIMUM_NUMPY_VERSION)
- if(Python_NumPy_VERSION VERSION_LESS FUTURE_MINIMUM_NUMPY_VERSION)
- message(DEPRECATION "Support for NumPy versions < ${FUTURE_MINIMUM_NUMPY_VERSION} "
- "is deprecated and will be removed.")
- endif()
- endif()
+ openvdb_check_python_version(Python::NumPy
+ "${Python_NumPy_VERSION}"
+ "${Python_NumPy_INCLUDE_DIRS}"
+ "${MINIMUM_NUMPY_VERSION}"
+ "${FUTURE_MINIMUM_NUMPY_VERSION}")
+ list(APPEND OPENVDB_PYTHON_DEPS Python::NumPy)
endif()
if(TARGET openvdb_shared AND NOT Boost_USE_STATIC_LIBS)
@@ -230,17 +236,6 @@ elseif(WIN32)
set_target_properties(pyopenvdb PROPERTIES SUFFIX ".pyd") # .pyd on windows
endif()
-if(TARGET Python::Module)
- list(APPEND OPENVDB_PYTHON_DEPS Python::Module)
-else()
- if(APPLE)
- target_include_directories(pyopenvdb SYSTEM PUBLIC ${Python_INCLUDE_DIRS})
- target_link_options(pyopenvdb PUBLIC -undefined dynamic_lookup)
- else()
- list(APPEND OPENVDB_PYTHON_DEPS Python::Python)
- endif()
-endif()
-
target_link_libraries(pyopenvdb PUBLIC
${OPENVDB_LIB}
${OPENVDB_PYTHON_DEPS}
+6 -3
View File
@@ -67,6 +67,7 @@ BDEPEND="
PATCHES=(
"${FILESDIR}/${PN}-7.1.0-0001-Fix-multilib-header-source.patch"
"${FILESDIR}/${PN}-8.0.1-add-consistency-for-NumPy-find_package-call.patch"
"${FILESDIR}/${PN}-8.1.0-glfw-libdir.patch"
)
@@ -94,9 +95,9 @@ src_configure() {
-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_VIEW=$(usex !utils)
-DOPENVDB_BUILD_VDB_LOD=$(usex utils)
-DOPENVDB_BUILD_VDB_RENDER=$(usex utils)
-DOPENVDB_BUILD_VDB_VIEW=$(usex utils)
-DOPENVDB_CORE_SHARED=ON
-DOPENVDB_CORE_STATIC=$(usex static-libs)
-DOPENVDB_ENABLE_RPATH=OFF
@@ -113,8 +114,10 @@ src_configure() {
mycmakeargs+=(
-DOPENVDB_BUILD_PYTHON_MODULE=ON
-DUSE_NUMPY=$(usex numpy)
-DOPENVDB_BUILD_PYTHON_UNITTESTS=$(usex test)
-DPYOPENVDB_INSTALL_DIRECTORY="$(python_get_sitedir)"
-DPython_EXECUTABLE="${PYTHON}"
-DPython_INCLUDE_DIR="$(python_get_includedir)"
)
fi
+7 -4
View File
@@ -12,7 +12,7 @@ HOMEPAGE="https://www.openvdb.org"
SRC_URI="https://github.com/AcademySoftwareFoundation/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="MPL-2.0"
SLOT="0"
SLOT="0/9"
KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
IUSE="cpu_flags_x86_avx cpu_flags_x86_sse4_2 blosc doc numpy python static-libs test utils zlib abi6-compat abi7-compat +abi8-compat"
RESTRICT="!test? ( test )"
@@ -65,6 +65,7 @@ BDEPEND="
PATCHES=(
"${FILESDIR}/${PN}-7.1.0-0001-Fix-multilib-header-source.patch"
"${FILESDIR}/${PN}-8.1.0-glfw-libdir.patch"
"${FILESDIR}/${PN}-9.0.0-numpy.patch"
)
pkg_setup() {
@@ -91,9 +92,9 @@ src_configure() {
-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_VIEW=$(usex !utils)
-DOPENVDB_BUILD_VDB_LOD=$(usex utils)
-DOPENVDB_BUILD_VDB_RENDER=$(usex utils)
-DOPENVDB_BUILD_VDB_VIEW=$(usex utils)
-DOPENVDB_CORE_SHARED=ON
-DOPENVDB_CORE_STATIC=$(usex static-libs)
-DOPENVDB_ENABLE_RPATH=OFF
@@ -109,8 +110,10 @@ src_configure() {
mycmakeargs+=(
-DOPENVDB_BUILD_PYTHON_MODULE=ON
-DUSE_NUMPY=$(usex numpy)
-DOPENVDB_BUILD_PYTHON_UNITTESTS=$(usex test)
-DPYOPENVDB_INSTALL_DIRECTORY="$(python_get_sitedir)"
-DPython_EXECUTABLE="${PYTHON}"
-DPython_INCLUDE_DIR="$(python_get_includedir)"
)
fi