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
This commit is contained in:
Ray Molenkamp
2019-08-30 08:40:08 -06:00
parent 26c110f2d2
commit 66ec72045f
10 changed files with 17 additions and 101 deletions

View File

@@ -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()

View File

@@ -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

View File

@@ -153,3 +153,7 @@ endif()
if(WITH_ALEMBIC)
add_subdirectory(alembic)
endif()
if(WIN32)
add_subdirectory(blendthumb)
endif()

View File

@@ -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})

View File

@@ -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);

View File

@@ -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