Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2020-12-14 18:40:00 +0300
committerBastien Montagne <bastien@blender.org>2020-12-14 18:44:55 +0300
commit010f44b855cab664126975543e0e760576202d85 (patch)
tree43bf4eec832dec0720555564f1f63f1681fead25 /build_files
parentf4df036bc497b134789b624efd9008c6f4b9c6c8 (diff)
Fix several issues with handling of numpy in CMake.
Issues were: * Abusing of `WITH_PYTHON_INSTALL_NUMPY` by both Audaspace and Mantaflow. - `PYTHON_INSTALL` options only decide whether we copy python (and some extra modules) in our Blender installation. On linux it makes much more sense to use global python installation. - Now we have instead a proper `WITH_PYTHON_NUMPY` * Bad assumptions regarding path of headers relative to path of python module. - In current Debian testing, modules are under `python3.9` directory, while headers are under `python3` directory. - Now we properly `find_path` for headers as well, modifying `find_python_package` to take an optional argument for headers. Note that the required changes done to `extern` libraries are in blender-specific files that do not exist upstream. Differential Revision: https://developer.blender.org/D9773
Diffstat (limited to 'build_files')
-rw-r--r--build_files/cmake/macros.cmake48
1 files changed, 48 insertions, 0 deletions
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 202b44f611c..9febeaa6889 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -1139,6 +1139,7 @@ endfunction()
function(find_python_package
package
+ relative_include_dir
)
string(TOUPPER ${package} _upper_package)
@@ -1170,7 +1171,10 @@ function(find_python_package
dist-packages
vendor-packages
NO_DEFAULT_PATH
+ DOC
+ "Path to python site-packages or dist-packages containing '${package}' module"
)
+ mark_as_advanced(PYTHON_${_upper_package}_PATH)
if(NOT EXISTS "${PYTHON_${_upper_package}_PATH}")
message(WARNING
@@ -1188,6 +1192,50 @@ function(find_python_package
set(WITH_PYTHON_INSTALL_${_upper_package} OFF PARENT_SCOPE)
else()
message(STATUS "${package} found at '${PYTHON_${_upper_package}_PATH}'")
+
+ if(NOT "${relative_include_dir}" STREQUAL "")
+ set(_relative_include_dir "${package}/${relative_include_dir}")
+ unset(PYTHON_${_upper_package}_INCLUDE_DIRS CACHE)
+ find_path(PYTHON_${_upper_package}_INCLUDE_DIRS
+ NAMES
+ "${_relative_include_dir}"
+ HINTS
+ "${PYTHON_LIBPATH}/"
+ "${PYTHON_LIBPATH}/python${PYTHON_VERSION}/"
+ "${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/"
+ PATH_SUFFIXES
+ "site-packages/"
+ "dist-packages/"
+ "vendor-packages/"
+ NO_DEFAULT_PATH
+ DOC
+ "Path to python site-packages or dist-packages containing '${package}' module header files"
+ )
+ mark_as_advanced(PYTHON_${_upper_package}_INCLUDE_DIRS)
+
+ if(NOT EXISTS "${PYTHON_${_upper_package}_INCLUDE_DIRS}")
+ message(WARNING
+ "Python package '${package}' include dir path could not be found in:\n"
+ "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/${_relative_include_dir}', "
+ "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/site-packages/${_relative_include_dir}', "
+ "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/dist-packages/${_relative_include_dir}', "
+ "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/dist-packages/${_relative_include_dir}', "
+ "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/vendor-packages/${_relative_include_dir}', "
+ "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/vendor-packages/${_relative_include_dir}', "
+ "\n"
+ "The 'WITH_PYTHON_${_upper_package}' option will be disabled.\n"
+ "The build will be usable, only add-ons that depend on this package won't be functional."
+ )
+ set(WITH_PYTHON_${_upper_package} OFF PARENT_SCOPE)
+ else()
+ set(_temp "${PYTHON_${_upper_package}_INCLUDE_DIRS}/${package}/${relative_include_dir}")
+ unset(PYTHON_${_upper_package}_INCLUDE_DIRS CACHE)
+ set(PYTHON_${_upper_package}_INCLUDE_DIRS "${_temp}"
+ CACHE PATH "Path to the include directory of the ${package} module")
+
+ message(STATUS "${package} include files found at '${PYTHON_${_upper_package}_INCLUDE_DIRS}'")
+ endif()
+ endif()
endif()
endif()
endfunction()