[Bf-blender-cvs] [690300eb4ac] blender-v3.0-release: Fix install paths for blender thumbnailer when not building a portable install

Sebastian Parborg noreply at git.blender.org
Thu Oct 28 21:18:13 CEST 2021


Commit: 690300eb4acd01ecada000c5ce6162c2437f9f6b
Author: Sebastian Parborg
Date:   Thu Oct 28 21:03:47 2021 +0200
Branches: blender-v3.0-release
https://developer.blender.org/rB690300eb4acd01ecada000c5ce6162c2437f9f6b

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

===================================================================

M	CMakeLists.txt
M	source/blender/blendthumb/CMakeLists.txt
M	source/blender/blenlib/CMakeLists.txt
M	source/blender/blenlib/intern/winstuff.c
M	source/creator/CMakeLists.txt

===================================================================

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8e975c18aaf..62e7d9b2941 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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()
diff --git a/source/blender/blendthumb/CMakeLists.txt b/source/blender/blendthumb/CMakeLists.txt
index 4bcd27082c0..4c2e72418a0 100644
--- a/source/blender/blendthumb/CMakeLists.txt
+++ b/source/blender/blendthumb/CMakeLists.txt
@@ -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()
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index 72087a12767..7db984aef5c 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -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
   )
diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c
index d5c9c5cd5e6..3001b25bc1e 100644
--- a/source/blender/blenlib/intern/winstuff.c
+++ b/source/blender/blenlib/intern/winstuff.c
@@ -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");
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index de560e39606..816d3a60fc3 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -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>



More information about the Bf-blender-cvs mailing list