2023-08-16 00:20:26 +10:00
|
|
|
# SPDX-FileCopyrightText: 2006 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
#
|
2022-02-11 09:07:11 +11:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
2017-07-25 16:37:55 +02:00
|
|
|
|
2022-09-13 13:46:51 +10:00
|
|
|
# -----------------------------------------------------------------------------
|
2021-10-20 10:16:36 +11:00
|
|
|
# Shared Thumbnail Extraction Logic
|
|
|
|
|
|
|
|
|
|
include_directories(
|
|
|
|
|
../blenlib
|
|
|
|
|
../makesdna
|
|
|
|
|
../../../intern/guardedalloc
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
include_directories(
|
|
|
|
|
SYSTEM
|
|
|
|
|
${ZLIB_INCLUDE_DIRS}
|
|
|
|
|
)
|
2018-06-17 20:15:24 +02:00
|
|
|
|
|
|
|
|
set(SRC
|
2021-10-20 10:16:36 +11:00
|
|
|
src/blendthumb.hh
|
|
|
|
|
src/blendthumb_extract.cc
|
|
|
|
|
src/blendthumb_png.cc
|
2017-07-25 16:37:55 +02:00
|
|
|
)
|
2018-06-17 20:15:24 +02:00
|
|
|
|
2021-10-20 10:16:36 +11:00
|
|
|
if(WIN32)
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
# Build `BlendThumb.dll`
|
2020-03-11 10:33:12 -06:00
|
|
|
|
2021-10-20 10:16:36 +11:00
|
|
|
set(SRC_WIN32
|
|
|
|
|
src/blendthumb_win32.cc
|
|
|
|
|
src/blendthumb_win32.def
|
|
|
|
|
src/blendthumb_win32.rc
|
|
|
|
|
src/blendthumb_win32_dll.cc
|
|
|
|
|
)
|
2019-08-30 11:40:46 -06:00
|
|
|
|
2021-10-20 10:16:36 +11:00
|
|
|
add_definitions(-DNOMINMAX)
|
|
|
|
|
|
|
|
|
|
add_library(BlendThumb SHARED ${SRC} ${SRC_WIN32})
|
|
|
|
|
|
2025-04-04 18:38:53 +02:00
|
|
|
target_link_libraries(BlendThumb bf_blenlib dbghelp.lib Version.lib Comctl32.lib)
|
|
|
|
|
# Blenlib drags in a whole bunch of dependencies on shared libs, none of which are used by
|
|
|
|
|
# blenthumb, but will cause load issues since the debug linker will not eleminate them.
|
|
|
|
|
# Link with /OPT:ref to force elmination of those unused dependencies this is already
|
|
|
|
|
# enabled by default on the release mode flags.
|
|
|
|
|
set_target_properties(BlendThumb PROPERTIES LINK_FLAGS "/OPT:ref")
|
2021-10-20 10:16:36 +11:00
|
|
|
set_target_properties(BlendThumb PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB:msvcrt")
|
2023-12-22 13:35:51 -07:00
|
|
|
set_target_properties(BlendThumb PROPERTIES VS_GLOBAL_VcpkgEnabled "false")
|
2021-10-20 10:16:36 +11:00
|
|
|
|
2025-01-23 17:00:19 +01:00
|
|
|
elseif(APPLE)
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
# Build `blender-thumbnailer.appex` app extension.
|
|
|
|
|
set(SRC_APPEX
|
|
|
|
|
src/thumbnail_provider.h
|
2025-02-10 19:38:51 +11:00
|
|
|
src/thumbnail_provider.mm
|
2025-01-23 17:00:19 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
add_executable(blender-thumbnailer MACOSX_BUNDLE ${SRC} ${SRC_APPEX})
|
|
|
|
|
setup_platform_linker_flags(blender-thumbnailer)
|
|
|
|
|
setup_platform_linker_libs(blender-thumbnailer)
|
|
|
|
|
target_link_libraries(blender-thumbnailer
|
|
|
|
|
bf_blenlib
|
|
|
|
|
# Avoid linker error about undefined _main symbol.
|
|
|
|
|
"-e _NSExtensionMain"
|
|
|
|
|
"-framework QuickLookThumbnailing"
|
|
|
|
|
)
|
2025-01-29 12:31:19 +11:00
|
|
|
# The RPATH here points to the main Blender Resources/lib directory.
|
|
|
|
|
# Avoid duplicating the large `dylibs` (~300MB).
|
2025-02-14 10:46:48 +01:00
|
|
|
set_target_properties(blender-thumbnailer PROPERTIES
|
|
|
|
|
INSTALL_RPATH "@loader_path/../../../../Resources/lib"
|
|
|
|
|
# Prevent Xcode from overwriting the signature.
|
|
|
|
|
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ""
|
2025-01-23 17:00:19 +01:00
|
|
|
)
|
2025-02-14 10:46:48 +01:00
|
|
|
# CMake needs the target defined in the same file as add_custom_command.
|
2025-01-29 12:31:19 +11:00
|
|
|
# It needs to be code-signed (ad-hoc in this case)
|
|
|
|
|
# even on developer machine to generate thumbnails.
|
2025-01-23 17:00:19 +01:00
|
|
|
# Command taken from XCode build process.
|
|
|
|
|
add_custom_command(
|
|
|
|
|
TARGET blender-thumbnailer POST_BUILD
|
|
|
|
|
COMMAND codesign --deep --force --sign - --entitlements "${CMAKE_SOURCE_DIR}/release/darwin/thumbnailer_entitlements.plist"
|
|
|
|
|
--timestamp=none $<TARGET_BUNDLE_DIR:blender-thumbnailer>
|
|
|
|
|
)
|
|
|
|
|
elseif(UNIX)
|
2021-10-20 10:16:36 +11:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
# Build `blender-thumbnailer` executable
|
|
|
|
|
|
2021-11-08 14:43:45 +11:00
|
|
|
set(SRC_CMD
|
|
|
|
|
src/blender_thumbnailer.cc
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
add_executable(blender-thumbnailer ${SRC} ${SRC_CMD})
|
2022-02-04 20:57:30 +05:30
|
|
|
setup_platform_linker_flags(blender-thumbnailer)
|
2021-10-20 10:16:36 +11:00
|
|
|
target_link_libraries(blender-thumbnailer bf_blenlib)
|
2023-01-19 17:07:23 +11:00
|
|
|
if(DEFINED PTHREADS_LIBRARIES)
|
|
|
|
|
target_link_libraries(blender-thumbnailer ${PTHREADS_LIBRARIES})
|
|
|
|
|
endif()
|
2021-10-20 10:16:36 +11:00
|
|
|
endif()
|