[Bf-blender-cvs] [66ec72045f8] master: Windows: Move building of blendthumb into the blender codebase.

Ray Molenkamp noreply at git.blender.org
Fri Aug 30 16:40:18 CEST 2019


Commit: 66ec72045f8c25ec9e9710f4d70aed9fb1514df6
Author: Ray Molenkamp
Date:   Fri Aug 30 08:40:08 2019 -0600
Branches: master
https://developer.blender.org/rB66ec72045f8c25ec9e9710f4d70aed9fb1514df6

Windows: Move building of blendthumb into the blender codebase.

Previously this was done in the deps builder due to the fact we needed
both 32 and 64 bit versions of this dll and CMAKE does not support that
in a single build folder. Now that 32 bit support has been dropped, this
can be safely moved into the codebase.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5633

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

D	build_files/build_environment/cmake/blendthumb.cmake
M	build_files/build_environment/cmake/harvest.cmake
M	source/blender/CMakeLists.txt
R077	release/windows/blendthumb/CMakeLists.txt	source/blender/blendthumb/CMakeLists.txt
R100	release/windows/blendthumb/src/BlendThumb.def	source/blender/blendthumb/src/BlendThumb.def
R100	release/windows/blendthumb/src/BlendThumb.rc	source/blender/blendthumb/src/BlendThumb.rc
R100	release/windows/blendthumb/src/BlenderThumb.cpp	source/blender/blendthumb/src/BlenderThumb.cpp
R100	release/windows/blendthumb/src/Dll.cpp	source/blender/blendthumb/src/Dll.cpp
M	source/blender/blenlib/intern/winstuff.c
M	source/creator/CMakeLists.txt

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

diff --git a/build_files/build_environment/cmake/blendthumb.cmake b/build_files/build_environment/cmake/blendthumb.cmake
deleted file mode 100644
index f4cc6ee9d37..00000000000
--- a/build_files/build_environment/cmake/blendthumb.cmake
+++ /dev/null
@@ -1,67 +0,0 @@
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ***** END GPL LICENSE BLOCK *****
-
-if(BUILD_MODE STREQUAL Release)
-  if(WIN32)
-    set(THUMB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../release/windows/blendthumb)
-
-    ExternalProject_Add(external_zlib_32
-      URL ${ZLIB_URI}
-      CMAKE_GENERATOR ${GENERATOR_32}
-      URL_HASH MD5=${ZLIB_HASH}
-      DOWNLOAD_DIR ${DOWNLOAD_DIR}
-      PREFIX ${BUILD_DIR}/zlib32
-      CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/zlib32 ${DEFAULT_CMAKE_FLAGS}
-      INSTALL_DIR ${LIBDIR}/zlib32
-    )
-
-    ExternalProject_Add(external_zlib_64
-      URL ${ZLIB_URI}
-      CMAKE_GENERATOR ${GENERATOR_64}
-      URL_HASH MD5=${ZLIB_HASH}
-      DOWNLOAD_DIR ${DOWNLOAD_DIR}
-      PREFIX ${BUILD_DIR}/zlib64
-      CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/zlib64 ${DEFAULT_CMAKE_FLAGS}
-      INSTALL_DIR ${LIBDIR}/zlib64
-    )
-
-    ExternalProject_Add(external_blendthumb_32
-      CMAKE_GENERATOR ${GENERATOR_32}
-      SOURCE_DIR ${THUMB_DIR}
-      PREFIX ${BUILD_DIR}/blendthumb32
-      CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/blendThumb32 ${DEFAULT_CMAKE_FLAGS} -DZLIB_INCLUDE=${LIBDIR}/zlib32/include -DZLIB_LIBS=${LIBDIR}/zlib32/lib/zlibstatic.lib
-      INSTALL_DIR ${LIBDIR}/blendthumb32
-    )
-    add_dependencies(
-      external_blendthumb_32
-      external_zlib_32
-    )
-
-    ExternalProject_Add(external_blendthumb_64
-      CMAKE_GENERATOR ${GENERATOR_64}
-      SOURCE_DIR ${THUMB_DIR}
-      PREFIX ${BUILD_DIR}/blendthumb64
-      CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/blendThumb64 ${DEFAULT_CMAKE_FLAGS} -DZLIB_INCLUDE=${LIBDIR}/zlib64/include -DZLIB_LIBS=${LIBDIR}/zlib64/lib/zlibstatic.lib
-      INSTALL_DIR ${LIBDIR}/blendthumb64
-    )
-    add_dependencies(
-      external_blendthumb_64
-      external_zlib_64
-    )
-  endif()
-endif()
diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake
index 97e4a6b69d4..526e72e2e33 100644
--- a/build_files/build_environment/cmake/harvest.cmake
+++ b/build_files/build_environment/cmake/harvest.cmake
@@ -51,9 +51,6 @@ if(BUILD_MODE STREQUAL Release)
         # tiff
         ${CMAKE_COMMAND} -E copy ${LIBDIR}/tiff/lib/tiff.lib ${HARVEST_TARGET}/tiff/lib/libtiff.lib &&
         ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/tiff/include/ ${HARVEST_TARGET}/tiff/include/ &&
-        # BlendThumb
-        ${CMAKE_COMMAND} -E copy ${LIBDIR}/BlendThumb64/bin/blendthumb.dll ${HARVEST_TARGET}/ThumbHandler/lib/BlendThumb64.dll &&
-        ${CMAKE_COMMAND} -E copy ${LIBDIR}/BlendThumb32/bin/blendthumb.dll ${HARVEST_TARGET}/ThumbHandler/lib/BlendThumb.dll &&
         # hidapi
         ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/hidapi/ ${HARVEST_TARGET}/hidapi/ &&
         # webp, straight up copy
diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index 76442048594..203543b0ef0 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -153,3 +153,7 @@ endif()
 if(WITH_ALEMBIC)
   add_subdirectory(alembic)
 endif()
+
+if(WIN32)
+  add_subdirectory(blendthumb)
+endif()
diff --git a/release/windows/blendthumb/CMakeLists.txt b/source/blender/blendthumb/CMakeLists.txt
similarity index 77%
rename from release/windows/blendthumb/CMakeLists.txt
rename to source/blender/blendthumb/CMakeLists.txt
index 45c583d1421..3f9e0b1bff5 100644
--- a/release/windows/blendthumb/CMakeLists.txt
+++ b/source/blender/blendthumb/CMakeLists.txt
@@ -19,13 +19,8 @@
 # ***** END GPL LICENSE BLOCK *****
 
 #-----------------------------------------------------------------------------
-cmake_minimum_required(VERSION 2.8)
-project(BlendThumb)
+include_directories(${ZLIB_INCLUDE_DIRS})
 
-#Bring the headers, such as Student.h into the project
-include_directories(${ZLIB_INCLUDE})
-
-#Can manually add the sources using the set command as follows:
 set(SRC
   src/BlenderThumb.cpp
   src/BlendThumb.def
@@ -34,5 +29,4 @@ set(SRC
 )
 
 add_library(BlendThumb SHARED ${SRC})
-target_link_libraries(BlendThumb ${ZLIB_LIBS})
-install (TARGETS BlendThumb DESTINATION bin)
+target_link_libraries(BlendThumb ${ZLIB_LIBRARIES})
diff --git a/release/windows/blendthumb/src/BlendThumb.def b/source/blender/blendthumb/src/BlendThumb.def
similarity index 100%
rename from release/windows/blendthumb/src/BlendThumb.def
rename to source/blender/blendthumb/src/BlendThumb.def
diff --git a/release/windows/blendthumb/src/BlendThumb.rc b/source/blender/blendthumb/src/BlendThumb.rc
similarity index 100%
rename from release/windows/blendthumb/src/BlendThumb.rc
rename to source/blender/blendthumb/src/BlendThumb.rc
diff --git a/release/windows/blendthumb/src/BlenderThumb.cpp b/source/blender/blendthumb/src/BlenderThumb.cpp
similarity index 100%
rename from release/windows/blendthumb/src/BlenderThumb.cpp
rename to source/blender/blendthumb/src/BlenderThumb.cpp
diff --git a/release/windows/blendthumb/src/Dll.cpp b/source/blender/blendthumb/src/Dll.cpp
similarity index 100%
rename from release/windows/blendthumb/src/Dll.cpp
rename to source/blender/blendthumb/src/Dll.cpp
diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c
index 9e6ea0bb6ee..724f27f4667 100644
--- a/source/blender/blenlib/intern/winstuff.c
+++ b/source/blender/blenlib/intern/winstuff.c
@@ -172,17 +172,7 @@ void RegisterBlendExtension(void)
 
   BLI_getInstallationDir(InstallDir);
   GetSystemDirectory(SysDir, FILE_MAXDIR);
-#  ifdef _WIN64
-  ThumbHandlerDLL = "BlendThumb64.dll";
-#  else
-  IsWow64Process(GetCurrentProcess(), &IsWOW64);
-  if (IsWOW64 == true) {
-    ThumbHandlerDLL = "BlendThumb64.dll";
-  }
-  else {
-    ThumbHandlerDLL = "BlendThumb.dll";
-  }
-#  endif
+  ThumbHandlerDLL = "BlendThumb.dll";
   snprintf(
       RegCmd, MAX_PATH * 2, "%s\\regsvr32 /s \"%s\\%s\"", SysDir, InstallDir, ThumbHandlerDLL);
   system(RegCmd);
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index f74fd57252d..893d3262590 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -820,18 +820,6 @@ elseif(WIN32)
     )
   endif()
 
-  if(NOT CMAKE_CL_64)
-    install(
-      FILES ${LIBDIR}/thumbhandler/lib/BlendThumb.dll
-      DESTINATION "."
-    )
-  endif()
-
-  install( # x86 builds can run on x64 Windows, so this is required at all times
-    FILES ${LIBDIR}/thumbhandler/lib/BlendThumb64.dll
-    DESTINATION "."
-  )
-
   install(
     FILES
       ${CMAKE_SOURCE_DIR}/release/windows/batch/blender_debug_gpu.cmd
@@ -1037,6 +1025,16 @@ if (WIN32)
   set_target_properties(blender PROPERTIES VS_GLOBAL_VcpkgEnabled "false")
 endif()
 
+# -----------------------------------------------------------------------------
+# Thumbnailer
+if(WIN32)
+  install(
+    TARGETS BlendThumb
+    COMPONENT Blender
+    DESTINATION "."
+  )
+endif()
+
 # -----------------------------------------------------------------------------
 # Setup launcher



More information about the Bf-blender-cvs mailing list