Fix install paths for blender thumbnailer when not building a portable install

When doing a non portable build of blender, the executable
blender-thumbnailer would be installed in two locations:
/usr/bin/
/usr/

While cleaning up, also make the blender thumbnailer dll optional on
windows to bring the logic in line with what it is on linux and mac.

Reviewed By: Campbell Barton, Ray molenkamp

Differential Revision: http://developer.blender.org/D13014
This commit is contained in:
Sebastian Parborg 2021-10-28 21:03:47 +02:00
parent db8be0cdfb
commit 690300eb4a
5 changed files with 14 additions and 13 deletions

View File

@ -160,8 +160,7 @@ if(APPLE)
# Currently this causes a build error linking, disable.
set(WITH_BLENDER_THUMBNAILER OFF)
elseif(WIN32)
# Building the thumbnail extraction DLL could be made optional.
set(WITH_BLENDER_THUMBNAILER ON)
option(WITH_BLENDER_THUMBNAILER "Build \"BlendThumb.dll\" helper for Windows explorer integration" ON)
else()
option(WITH_BLENDER_THUMBNAILER "Build \"blender-thumbnailer\" thumbnail extraction utility" ON)
endif()

View File

@ -56,11 +56,6 @@ if(WIN32)
target_link_libraries(BlendThumb bf_blenlib dbghelp.lib Version.lib)
set_target_properties(BlendThumb PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB:msvcrt")
install(
FILES $<TARGET_FILE:BlendThumb>
COMPONENT Blender
DESTINATION "."
)
else()
# -----------------------------------------------------------------------------
# Build `blender-thumbnailer` executable
@ -68,10 +63,4 @@ else()
add_executable(blender-thumbnailer ${SRC} src/blender_thumbnailer.cc)
target_link_libraries(blender-thumbnailer bf_blenlib)
target_link_libraries(blender-thumbnailer ${PTHREADS_LIBRARIES})
install(
FILES $<TARGET_FILE:blender-thumbnailer>
COMPONENT Blender
DESTINATION "."
)
endif()

View File

@ -367,6 +367,10 @@ if(WITH_GMP)
endif()
if(WIN32)
if (WITH_BLENDER_THUMBNAILER)
# Needed for querying the thumbnailer .dll in winstuff.c
add_definitions(-DWITH_BLENDER_THUMBNAILER)
endif()
list(APPEND INC
../../../intern/utfconv
)

View File

@ -172,12 +172,14 @@ bool BLI_windows_register_blend_extension(const bool background)
return false;
}
# ifdef WITH_BLENDER_THUMBNAILER
BLI_windows_get_executable_dir(InstallDir);
GetSystemDirectory(SysDir, FILE_MAXDIR);
ThumbHandlerDLL = "BlendThumb.dll";
snprintf(
RegCmd, MAX_PATH * 2, "%s\\regsvr32 /s \"%s\\%s\"", SysDir, InstallDir, ThumbHandlerDLL);
system(RegCmd);
# endif
RegCloseKey(root);
printf("success (%s)\n", usr_mode ? "user" : "system");

View File

@ -990,6 +990,13 @@ elseif(WIN32)
DESTINATION "."
)
if(WITH_BLENDER_THUMBNAILER)
install(
TARGETS BlendThumb
DESTINATION "."
)
endif()
if(WITH_DRACO)
install(
PROGRAMS $<TARGET_FILE:extern_draco>