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:
authorCampbell Barton <campbell@blender.org>2022-09-14 07:06:41 +0300
committerCampbell Barton <campbell@blender.org>2022-09-14 07:06:41 +0300
commit7bd60d40efbfaa3a18d3cfee409a1a3d1fa6c11d (patch)
treed3844f163b69ae50ad00bb0f83a532575add06f0 /build_files/cmake
parentf74fa63b5a5bd6d835abd51985430e0fa4e7fc2a (diff)
CMake: warn when "bpy" installs into the site-packages from LIBDIR
Using "../lib" as a target is unlikely to be useful, add a warning & suggest alternatives.
Diffstat (limited to 'build_files/cmake')
-rw-r--r--build_files/cmake/platform/platform_unix.cmake36
1 files changed, 30 insertions, 6 deletions
diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake
index f65fda83504..aceddf7295b 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -143,14 +143,38 @@ if(NOT WITH_SYSTEM_FREETYPE)
endif()
if(WITH_PYTHON)
- # No way to set py35, remove for now.
- # find_package(PythonLibs)
+ # This could be used, see: D14954 for details.
+ # `find_package(PythonLibs)`
- # Use our own instead, since without py is such a rare case,
- # require this package
- # XXX Linking errors with debian static python :/
-# find_package_wrapper(PythonLibsUnix REQUIRED)
+ # Use our own instead, since without Python is such a rare case,
+ # require this package.
+ # XXX: Linking errors with Debian static Python (sigh).
+ # find_package_wrapper(PythonLibsUnix REQUIRED)
find_package(PythonLibsUnix REQUIRED)
+
+ if(WITH_PYTHON_MODULE AND NOT WITH_INSTALL_PORTABLE)
+ # Installing into `site-packages`, warn when installing into `./../lib/`
+ # which script authors almost certainly don't want.
+ if(EXISTS ${LIBDIR})
+ cmake_path(IS_PREFIX LIBDIR "${PYTHON_SITE_PACKAGES}" NORMALIZE _is_prefix)
+ if(_is_prefix)
+ message(WARNING "
+Building Blender with the following configuration:
+ - WITH_PYTHON_MODULE=ON
+ - WITH_INSTALL_PORTABLE=OFF
+ - LIBDIR=\"${LIBDIR}\"
+ - PYTHON_SITE_PACKAGES=\"${PYTHON_SITE_PACKAGES}\"
+In this case you may want to either:
+ - Use the system Python's site-packages, see:
+ python -c \"import site; print(site.getsitepackages()[0])\"
+ - Set WITH_INSTALL_PORTABLE=ON to create a stand-alone \"bpy\" module
+ which you will need to ensure is in Python's module search path.
+Proceeding with PYTHON_SITE_PACKAGES install target, you have been warned!"
+ )
+ endif()
+ unset(_is_prefix)
+ endif()
+ endif()
endif()
if(WITH_IMAGE_OPENEXR)