[Bf-blender-cvs] [241f05d53c3] master: macOS/bpy: accommodate portable builds, and multi-config generators.

Ankit Meel noreply at git.blender.org
Mon Mar 29 18:58:24 CEST 2021


Commit: 241f05d53c32323c6d4bb8b179b87ec62b5f3a57
Author: Ankit Meel
Date:   Mon Mar 29 22:25:13 2021 +0530
Branches: master
https://developer.blender.org/rB241f05d53c32323c6d4bb8b179b87ec62b5f3a57

macOS/bpy: accommodate portable builds, and multi-config generators.

Old code's `install` step did not guarantee that all script files
will be copied from source folder to build folder _before_ copying from
build folder to site-packages. That caused incomplete installation.
Fixed by copying scripts etc., only once. Also match the behavior on
Linux: install to site-packages only if `WITH_INSTALL_PORTABLE` is OFF.

Also fix install and launch issues with Xcode.

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

M	source/creator/CMakeLists.txt

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

diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 43533d55f55..d9064682203 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -326,7 +326,14 @@ elseif(WIN32)
 
 elseif(APPLE)
   if(WITH_PYTHON_MODULE)
-    set(TARGETDIR_VER ${BLENDER_VERSION})
+    if(WITH_INSTALL_PORTABLE)
+      set(TARGETDIR_VER $<TARGET_FILE_DIR:blender>/../Resources/${BLENDER_VERSION})
+      # Keep the `BLENDER_VERSION` folder and bpy.so in the build folder.
+      set(INSTALL_BPY_TO_SITE_PACKAGES OFF)
+    else()
+      set(TARGETDIR_VER "${PYTHON_LIBPATH}/Resources/${BLENDER_VERSION}")
+      set(INSTALL_BPY_TO_SITE_PACKAGES ON)
+    endif()
   else()
     set(TARGETDIR_VER Blender.app/Contents/Resources/${BLENDER_VERSION})
   endif()
@@ -1007,8 +1014,6 @@ elseif(APPLE)
     )
     if(WITH_PYTHON_MODULE)
       # Move the dylib in a Blender version folder to keep the corresponding OpenMP version.
-      # Also for easy copying of a single folder, `TARGETDIR_VER` to site-packages
-      # during installation.
       install(
         DIRECTORY   ${CMAKE_BINARY_DIR}/Resources/lib
         DESTINATION ${TARGETDIR_VER}
@@ -1018,9 +1023,7 @@ elseif(APPLE)
         # Change it to support multiple rpaths.
         COMMAND xcrun install_name_tool -change "@executable_path/../Resources/lib/libomp.dylib" "@rpath/libomp.dylib" "$<TARGET_FILE:blender>"
         # For installation into site-packages.
-        COMMAND xcrun install_name_tool -add_rpath "@loader_path/../Resources/${TARGETDIR_VER}/lib" "$<TARGET_FILE:blender>"
-        # For in-build-folder experiments.
-        COMMAND xcrun install_name_tool -add_rpath "@loader_path/${TARGETDIR_VER}/lib" "$<TARGET_FILE:blender>"
+        COMMAND xcrun install_name_tool -add_rpath "@loader_path/../Resources/${BLENDER_VERSION}/lib" "$<TARGET_FILE:blender>"
       )
     endif()
   endif()
@@ -1055,13 +1058,12 @@ elseif(APPLE)
     unset(_py_inc_suffix)
   endif()
   if(WITH_PYTHON_MODULE)
-    install(
-      TARGETS blender
-      LIBRARY DESTINATION ${PYTHON_LIBPATH}/site-packages
-    )
-    install_dir(
-      ${CMAKE_INSTALL_PREFIX}/${TARGETDIR_VER}
-      ${PYTHON_LIBPATH}/Resources)
+    if(INSTALL_BPY_TO_SITE_PACKAGES)
+      install(
+        TARGETS blender
+        LIBRARY DESTINATION ${PYTHON_LIBPATH}/site-packages
+      )
+    endif()
   endif()
 
   if(WITH_DRACO)



More information about the Bf-blender-cvs mailing list