forked from bartvdbraak/blender
macOS/bpy: add support for OpenMP
Changes made: * Add OpenMP linker flags. * Copy the libomp.dylib to `2.93/lib/libomp.dylib`. * Change the `LC_LOAD_DYLIB` item such that the lib is found at `bpy.so/../../Resources/2.93/lib/libomp.dylib`. Installation is done by D10664. Reviewed By: #platform_macos, brecht Maniphest Tasks: T86579 Differential Revision: https://developer.blender.org/D10657
This commit is contained in:
parent
35d5cc8982
commit
ad31b13f91
@ -1235,6 +1235,7 @@ if(WITH_OPENMP)
|
|||||||
string(APPEND CMAKE_C_FLAGS " ${OpenMP_C_FLAGS}")
|
string(APPEND CMAKE_C_FLAGS " ${OpenMP_C_FLAGS}")
|
||||||
string(APPEND CMAKE_CXX_FLAGS " ${OpenMP_CXX_FLAGS}")
|
string(APPEND CMAKE_CXX_FLAGS " ${OpenMP_CXX_FLAGS}")
|
||||||
string(APPEND CMAKE_EXE_LINKER_FLAGS " ${OpenMP_LINKER_FLAGS}")
|
string(APPEND CMAKE_EXE_LINKER_FLAGS " ${OpenMP_LINKER_FLAGS}")
|
||||||
|
string(APPEND CMAKE_MODULE_LINKER_FLAGS " ${OpenMP_LINKER_FLAGS}")
|
||||||
else()
|
else()
|
||||||
# Typically avoid adding flags as defines but we can't
|
# Typically avoid adding flags as defines but we can't
|
||||||
# pass OpenMP flags to the linker for static builds, meaning
|
# pass OpenMP flags to the linker for static builds, meaning
|
||||||
|
@ -1005,6 +1005,24 @@ elseif(APPLE)
|
|||||||
FILES ${LIBDIR}/openmp/lib/libomp.dylib
|
FILES ${LIBDIR}/openmp/lib/libomp.dylib
|
||||||
DESTINATION Blender.app/Contents/Resources/lib
|
DESTINATION Blender.app/Contents/Resources/lib
|
||||||
)
|
)
|
||||||
|
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}
|
||||||
|
)
|
||||||
|
add_custom_command(TARGET blender POST_BUILD
|
||||||
|
# The old `LC_LOAD_DYLIB` is the `LC_ID_DYLIB` of the LIBDIR OpenMP dylib.
|
||||||
|
# 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>"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_LLVM AND NOT LLVM_STATIC)
|
if(WITH_LLVM AND NOT LLVM_STATIC)
|
||||||
|
Loading…
Reference in New Issue
Block a user