Skip to content

Commit

Permalink
Improved coping of Qt DLLs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vertexwahn committed Mar 9, 2018
1 parent 157fdb8 commit 45472f0
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 88 deletions.
26 changes: 26 additions & 0 deletions CMake/ExecuteQtDeployTool.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
if(WIN32)
# Unit tests need access to Qt DLLs and resources - this project copies this stuff to the right place
add_custom_target(ExecuteQtDeployTool
#------------------------------------------------------------------------------------------------------
# Variant A: This does not need a prebuild DrawTriangle.exe
# This parts builds just the DrawTriangle unit test which is needed by windeployqt
# Actually this takes a long time...
#COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target DrawTriangle --config debug
#COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target DrawTriangle --config release
#COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target DrawTriangle --config relWithDebInfo
#------------------------------------------------------------------------------------------------------

#------------------------------------------------------------------------------------------------------
# Variant B: This requires a prebuild DrawTriangle.exe
# From my experience it is fine to use for every build type the debug.exe...
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/Deploy/Debug/DrawTriangle.exe ${CMAKE_BINARY_DIR}/Debug
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/Deploy/Debug/DrawTriangle.exe ${CMAKE_BINARY_DIR}/RelWithDebInfo
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/Deploy/Debug/DrawTriangle.exe ${CMAKE_BINARY_DIR}/Release
#------------------------------------------------------------------------------------------------------

COMMAND ${Qt5Core_DIR}/../../../bin/windeployqt.exe --no-system-d3d-compiler --force --debug ${CMAKE_BINARY_DIR}/Debug/DrawTriangle.exe
COMMAND ${Qt5Core_DIR}/../../../bin/windeployqt.exe --no-system-d3d-compiler --force --pdb ${CMAKE_BINARY_DIR}/Debug/DrawTriangle.exe
COMMAND ${Qt5Core_DIR}/../../../bin/windeployqt.exe --no-system-d3d-compiler --force --release ${CMAKE_BINARY_DIR}/RelWithDebInfo/DrawTriangle.exe
COMMAND ${Qt5Core_DIR}/../../../bin/windeployqt.exe --no-system-d3d-compiler --force --release ${CMAKE_BINARY_DIR}/Release/DrawTriangle.exe
)
endif()
84 changes: 0 additions & 84 deletions CMake/QtCopyBinaries.cmake

This file was deleted.

9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ if(BLUEFRAMEWORK_USE_PREDEFINED_THIRDPARTY_PATH)
"C:\\Qt\\Qt5.9.1\\5.9.1\\msvc${MSVC_VERSION_YEAR}_64"
"C:\\Qt\\5.9.2\\msvc${MSVC_VERSION_YEAR}_64"
"C:\\Qt\\Qt5.9.3\\5.9.3\\msvc${MSVC_VERSION_YEAR}_64"
"C:\\Qt\\5.10.0\\msvc${MSVC_VERSION_YEAR}_64")
"C:\\Qt\\5.10.0\\msvc${MSVC_VERSION_YEAR}_64"
"C:\\Qt\\5.10.1\\msvc${MSVC_VERSION_YEAR}_64")
find_path(GLEW_ROOT NAMES include/GL/glew.h HINTS "C:\\thirdparty\\${MSVC_VERSION_STRING}\\x64\\glew-2.0.0")
find_path(GTEST_ROOT NAMES googletest/include/gtest/gtest.h HINTS "C:\\thirdparty\\${MSVC_VERSION_STRING}\\x64\\googletest-release-1.8.0" "C:\\thirdparty\\${MSVC_VERSION_STRING}\\x64\\googletest-1.8.0")
find_path(TINYXML2_ROOT NAMES tinyxml2.h HINTS "C:\\thirdparty\\${MSVC_VERSION_STRING}\\x64\\tinyxml2-master")
Expand Down Expand Up @@ -193,8 +194,8 @@ set_target_properties(BlueFramework.Engine PROPERTIES FOLDER "Bl
set_target_properties(BlueFramework.Rasterizer PROPERTIES FOLDER "BlueFramework")
set_target_properties(BlueFramework.ImageProcessing PROPERTIES FOLDER "BlueFramework")

include(QtCopyBinaries)
set_target_properties(Qt5CopyBinaries PROPERTIES FOLDER "Copy")
include(ExecuteQtDeployTool)
set_target_properties(ExecuteQtDeployTool PROPERTIES FOLDER "Copy")
set_target_properties(GTestCopyBinaries PROPERTIES FOLDER "Copy")

# Copy libs
Expand Down Expand Up @@ -239,7 +240,7 @@ add_custom_target(DEPLOY
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target UpdateLibsAndDLLsForCurrentBuildConfiguration --config debug
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target UpdateLibsAndDLLsForCurrentBuildConfiguration --config release
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target UpdateLibsAndDLLsForCurrentBuildConfiguration --config relWithDebInfo
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target Qt5CopyBinaries
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target ExecuteQtDeployTool
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target PACKAGE
)

Expand Down
Binary file added Deploy/Debug/DrawTriangle.exe
Binary file not shown.

0 comments on commit 45472f0

Please sign in to comment.