CMake: remove PYTHON_NUMPY_INCLUDE_DIRS as a cache variable on macOS/Windows.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 17 Sep 2018 09:10:45 +0000 (11:10 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Tue, 18 Sep 2018 10:11:06 +0000 (12:11 +0200)
It's in a fixed location on those platforms, and having it as a cache variable
just means things break when we upgrade to a new Python version.

CMakeLists.txt
build_files/cmake/platform/platform_apple.cmake

index fa14059..389287c 100644 (file)
@@ -379,7 +379,9 @@ if(UNIX AND NOT APPLE)
 endif()
 
 option(WITH_PYTHON_INSTALL       "Copy system python into the blender install folder" ON)
-if(WITH_PYTHON_INSTALL OR (WITH_AUDASPACE AND NOT WITH_SYSTEM_AUDASPACE))
+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))
        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")
@@ -1477,14 +1479,14 @@ if(WITH_PYTHON)
                )
        endif()
 
-       if(WIN32)
-               # pass, we have this in an archive to extract
+       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))
                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)
+                       mark_as_advanced(PYTHON_NUMPY_INCLUDE_DIRS)
                endif()
        endif()
 
index 8562b85..88ae9d4 100644 (file)
@@ -114,7 +114,7 @@ if(WITH_PYTHON)
        set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
 
        # needed for Audaspace, numpy is installed into python site-packages
-       set(NUMPY_INCLUDE_DIRS "${PYTHON_LIBPATH}/site-packages/numpy/core/include")
+       set(PYTHON_NUMPY_INCLUDE_DIRS "${PYTHON_LIBPATH}/site-packages/numpy/core/include")
 
        if(NOT EXISTS "${PYTHON_EXECUTABLE}")
                message(FATAL_ERROR "Python executable missing: ${PYTHON_EXECUTABLE}")