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.
This commit is contained in:
parent
77ac67dae4
commit
241f05d53c
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue