diff options
author | Bastien Montagne <bastien@blender.org> | 2020-12-07 17:28:24 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-12-14 13:00:28 +0300 |
commit | 5d570c875eda8fb9aa3635f7f4edac0dc1eaedc8 (patch) | |
tree | c25cf569dd78fcacab71fc1fea1d1eed11bad276 /CMakeLists.txt | |
parent | 53ed96641c60531e2ece17230879088df899f8a5 (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 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d7cf4e325c..71186a58281 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -349,14 +349,16 @@ endif() option(WITH_PYTHON_INSTALL "Copy system python into the blender install folder" ON) if(WIN32 OR APPLE) # Windows and macOS have this bundled with Python libraries. -elseif(WITH_PYTHON_INSTALL OR (WITH_AUDASPACE AND NOT WITH_SYSTEM_AUDASPACE)) +elseif(WITH_PYTHON_INSTALL OR (WITH_AUDASPACE AND NOT WITH_SYSTEM_AUDASPACE) OR WITH_MOD_FLUID) + option(WITH_PYTHON_NUMPY "Include NumPy in Blender (used by Audaspace and Mantaflow)" ON) + set(PYTHON_NUMPY_PATH "" CACHE PATH "Path to python site-packages or dist-packages containing 'numpy' module") mark_as_advanced(PYTHON_NUMPY_PATH) - set(PYTHON_NUMPY_INCLUDE_DIRS ${PYTHON_NUMPY_PATH}/numpy/core/include CACHE PATH "Path to the include directory of the numpy module") + set(PYTHON_NUMPY_INCLUDE_DIRS "" CACHE PATH "Path to the include directory of the NumPy module") mark_as_advanced(PYTHON_NUMPY_INCLUDE_DIRS) endif() if(WITH_PYTHON_INSTALL) - option(WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install folder" ON) + option(WITH_PYTHON_INSTALL_NUMPY "Copy system NumPy into the blender install folder" ON) if(UNIX AND NOT APPLE) option(WITH_PYTHON_INSTALL_REQUESTS "Copy system requests into the blender install folder" ON) @@ -1621,12 +1623,9 @@ if(WITH_PYTHON) if(WIN32 OR APPLE) # Windows and macOS have this bundled with Python libraries. - elseif((WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY) OR (WITH_AUDASPACE AND NOT WITH_SYSTEM_AUDASPACE)) + elseif((WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY) OR WITH_PYTHON_NUMPY) if(("${PYTHON_NUMPY_PATH}" STREQUAL "") OR (${PYTHON_NUMPY_PATH} MATCHES NOTFOUND)) - find_python_package(numpy) - unset(PYTHON_NUMPY_INCLUDE_DIRS CACHE) - set(PYTHON_NUMPY_INCLUDE_DIRS ${PYTHON_NUMPY_PATH}/numpy/core/include CACHE PATH "Path to the include directory of the numpy module") - mark_as_advanced(PYTHON_NUMPY_INCLUDE_DIRS) + find_python_package(numpy "core/include") endif() endif() |