From 13c3d95f522f1b1b3b836a62c0574e7974b04742 Mon Sep 17 00:00:00 2001 From: Ankit Meel Date: Fri, 14 Feb 2025 10:46:48 +0100 Subject: [PATCH] Xcode/thumbnailer: rebuild error due to rpath Fix duplicate rpath error on rebuild by using CMake target property. Pull Request: https://projects.blender.org/blender/blender/pulls/134527 --- CMakeLists.txt | 4 ++-- source/blender/blendthumb/CMakeLists.txt | 9 +++++---- source/blender/blendthumb/src/thumbnail_provider.mm | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab52553e94c..7e69b156fa2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -219,8 +219,8 @@ intended for use by file-managers to extract PNG images from `.blend` files." ) elseif(APPLE) option(WITH_BLENDER_THUMBNAILER "\ -Build \"blender-thumbnailer.appex\" extension for macOS Finder/ QuickLook to support viewing \ -thumbnails from `.blend` files." +Build \"blender-thumbnailer.appex\" extension for Finder/ QuickLook thumbnail \ +support for blend files." ON ) endif() diff --git a/source/blender/blendthumb/CMakeLists.txt b/source/blender/blendthumb/CMakeLists.txt index 1bc0950029b..935b3f94ee1 100644 --- a/source/blender/blendthumb/CMakeLists.txt +++ b/source/blender/blendthumb/CMakeLists.txt @@ -58,13 +58,14 @@ elseif(APPLE) "-e _NSExtensionMain" "-framework QuickLookThumbnailing" ) - # CMake needs the target defined in the same file as add_custom_command. # The RPATH here points to the main Blender Resources/lib directory. # Avoid duplicating the large `dylibs` (~300MB). - add_custom_command( - TARGET blender-thumbnailer POST_BUILD - COMMAND install_name_tool -add_rpath @loader_path/../../../../Resources/lib $ + set_target_properties(blender-thumbnailer PROPERTIES + INSTALL_RPATH "@loader_path/../../../../Resources/lib" + # Prevent Xcode from overwriting the signature. + XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" ) + # CMake needs the target defined in the same file as add_custom_command. # It needs to be code-signed (ad-hoc in this case) # even on developer machine to generate thumbnails. # Command taken from XCode build process. diff --git a/source/blender/blendthumb/src/thumbnail_provider.mm b/source/blender/blendthumb/src/thumbnail_provider.mm index 565fc761ef2..785550f99e5 100644 --- a/source/blender/blendthumb/src/thumbnail_provider.mm +++ b/source/blender/blendthumb/src/thumbnail_provider.mm @@ -43,7 +43,7 @@ * * LLDB/ Xcode etc., debuggers can be used to get extra logs than CLI invocation but breakpoints * still are a pain point. /usr/bin/qlmanage is the target executable. Other args to qlmanage - * follow. + * follow. lldb qlmanage -- -t -x a.blend * * # Troubleshooting * - The appex shouldn't have any quarantine flag. @@ -62,7 +62,7 @@ * - The code cannot attempt to do anything outside sandbox like writing to blend. * * # Triggering a thumbnail - * - qlmanage -t -s 512 -o /tmp/ /path/to/file.blend + * - qlmanage -t -x /path/to/file.blend * * # External resources * https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/Quicklook_Programming_Guide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40005020-CH1-SW1