[Bf-blender-cvs] [bbce6ce249f] master: Fix macOS python cmake install to work when switching lib directories.

Brecht Van Lommel noreply at git.blender.org
Thu May 25 02:47:10 CEST 2017


Commit: bbce6ce249f8964e9dbf2e1f13cadad15126f9b9
Author: Brecht Van Lommel
Date:   Thu May 25 02:34:39 2017 +0200
Branches: master
https://developer.blender.org/rBbbce6ce249f8964e9dbf2e1f13cadad15126f9b9

Fix macOS python cmake install to work when switching lib directories.

It's a bit ugly but I couldn't find a better way to keep fast installs and
correct handling of switching between master and blender2.8 with different
lib directories.

===================================================================

M	source/creator/CMakeLists.txt

===================================================================

diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 504d0de9145..6d0cbb365b4 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -997,21 +997,26 @@ elseif(APPLE)
 
 	# python
 	if(WITH_PYTHON AND NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
-		# the python zip is first extract as part of the build process,
+		# the python zip is first extracted as part of the build process,
 		# and then later installed as part of make install. this is much
 		# quicker, and means we can easily exclude files on copy
-		# Not needed for PYTHON_MODULE or WEB_PLUGIN due uses  Pyhon framework
+		# Not needed for PYTHON_MODULE or WEB_PLUGIN due uses Pyhon framework
+		# use a hash of the .zip path to handle switching between different
+		# lib directories without needing a clean build
+		string(SHA1 PYTHON_ZIP_HASH ${LIBDIR}/release/${PYTHON_ZIP})
+		set(PYTHON_EXTRACT_DIR ${CMAKE_CURRENT_BINARY_DIR}/${PYTHON_ZIP_HASH}/python)
+
 		add_custom_target(
 			extractpyzip
-			DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/python)
+			DEPENDS ${PYTHON_EXTRACT_DIR})
 
 		set(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip")
 
 		add_custom_command(
-			OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python
-			COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/python/"
-			COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/python/"
-			COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_CURRENT_BINARY_DIR}/python/"
+			OUTPUT ${PYTHON_EXTRACT_DIR}
+			COMMAND ${CMAKE_COMMAND} -E remove_directory "${PYTHON_EXTRACT_DIR}/"
+			COMMAND ${CMAKE_COMMAND} -E make_directory "${PYTHON_EXTRACT_DIR}/"
+			COMMAND ${CMAKE_COMMAND} -E chdir "${PYTHON_EXTRACT_DIR}/"
 			        ${CMAKE_COMMAND} -E tar xzfv "${LIBDIR}/release/${PYTHON_ZIP}"
 			DEPENDS ${LIBDIR}/release/${PYTHON_ZIP})
 
@@ -1019,13 +1024,13 @@ elseif(APPLE)
 
 		# copy extracted python files
 		install_dir(
-			${CMAKE_CURRENT_BINARY_DIR}/python
+			${PYTHON_EXTRACT_DIR}
 			\${TARGETDIR_VER}
 		)
 		# copy site-packages files
 		install_dir(
 			${LIBDIR}/release/site-packages
-			${CMAKE_CURRENT_BINARY_DIR}/python/lib/python${PYTHON_VERSION}
+			\${TARGETDIR_VER}/python/lib/python${PYTHON_VERSION}
 		)
 
 		install(DIRECTORY ${LIBDIR}/python/bin




More information about the Bf-blender-cvs mailing list