Depends on lib update after D11748
For Blender.app: dropping libomp.dylib next to Blender executable is
enough for it getting picked up since @executable_path is a rpath.
For non-distributed binaries datatoc, makesdna, tests etc, code for
copying libomp.dylib to build folder is removed and replaced by
CMake's rpath option for build tree.
For bpy.so, the post build rpath change has also been replaced by CMake
install rpath option.
If portable, the dylib folder is bpy.so/../../Resources/{version}/lib.
If not portable, site-packages/Resources/{version}/lib.
Since -id has been changed in D11748, remove the
install_name_tool -change ... command.
Any dylib can just be dropped at MAC_BLENDER_TARGET_DYLIBS_DIR
hereafter. Appending dylib path to CMAKE_BUILD_RPATH will be needed
for datatoc if linked against one (instead of copying the dylib around).
[1]
diff --git b/build_files/cmake/platform/platform_apple.cmake a/build_files/cmake/platform/platform_apple.cmake index d844a8cc86e..e3ae633d072 100644 --- b/build_files/cmake/platform/platform_apple.cmake +++ a/build_files/cmake/platform/platform_apple.cmake @@ -413,6 +413,27 @@ if(WITH_OPENMP) set(OpenMP_CXX_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'") set(OpenMP_LINKER_FLAGS "-L'${LIBDIR}/openmp/lib' -lomp") set(OpenMP_LIBRARY "${LIBDIR}/openmp/lib/libomp.dylib") + + # Copy libomp.dylib to allow executables like datatoc and tests to work. + # `@rpath/libomp.dylib` as `LC_ID_DYLIB` is added by the deps builder. + if(GENERATOR_IS_MULTI_CONFIG) + set(_openmp_CONFIGS Debug Release MinSizeRel RelWithDebInfo) + else() + set(_openmp_CONFIGS " ") + endif() + foreach(_config ${_openmp_CONFIGS}) + # This will make single-config generator's config empty and that's intended. Multiple `/`s are considered as one. + string(STRIP ${_config} _config) + execute_process( + # datatoc, makesdna etc. + COMMAND ${CMAKE_COMMAND} -E copy "${OpenMP_LIBRARY}" "${EXECUTABLE_OUTPUT_PATH}/${_config}/libomp.dylib" + # Tests. + COMMAND ${CMAKE_COMMAND} -E copy "${OpenMP_LIBRARY}" "${EXECUTABLE_OUTPUT_PATH}/tests/${_config}/libomp.dylib" + # For Blender.app, dylib copy is done as an install step. + ) + endforeach() + unset(_config) + unset(_openmp_CONFIGS) endif() endif()