diff options
author | Bastien Montagne <bastien@blender.org> | 2020-12-14 18:40:00 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-12-14 18:44:55 +0300 |
commit | 010f44b855cab664126975543e0e760576202d85 (patch) | |
tree | 43bf4eec832dec0720555564f1f63f1681fead25 /CMakeLists.txt | |
parent | f4df036bc497b134789b624efd9008c6f4b9c6c8 (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 | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d7cf4e325c..c8ae562f6ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -347,16 +347,21 @@ if(UNIX AND NOT APPLE) endif() option(WITH_PYTHON_INSTALL "Copy system python into the blender install folder" ON) + +if((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) +endif() + 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_PYTHON_NUMPY) 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,19 +1626,16 @@ 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() if(WIN32 OR APPLE) # pass, we have this in lib/python/site-packages elseif(WITH_PYTHON_INSTALL_REQUESTS) - find_python_package(requests) + find_python_package(requests "") endif() endif() |