From 241f05d53c32323c6d4bb8b179b87ec62b5f3a57 Mon Sep 17 00:00:00 2001 From: Ankit Meel Date: Mon, 29 Mar 2021 22:25:13 +0530 Subject: 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. --- source/creator/CMakeLists.txt | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'source/creator') 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 $/../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" "$" # For installation into site-packages. - COMMAND xcrun install_name_tool -add_rpath "@loader_path/../Resources/${TARGETDIR_VER}/lib" "$" - # For in-build-folder experiments. - COMMAND xcrun install_name_tool -add_rpath "@loader_path/${TARGETDIR_VER}/lib" "$" + COMMAND xcrun install_name_tool -add_rpath "@loader_path/../Resources/${BLENDER_VERSION}/lib" "$" ) 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) -- cgit v1.2.3