1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-02 00:10:22 +02:00

CMake: installer building improvements for Windows

- Implement support for BundleUtilities when Vcpkg is used
- Add some hacky code to copy Qt plugins install directory
- Use same icon for launcher as used for VCMI, launcher one is ugly
This commit is contained in:
Arseniy Shestakov 2017-08-16 14:52:39 +03:00
parent adbfa09e31
commit 03c7bf5ee6
3 changed files with 42 additions and 5 deletions

View File

@ -16,6 +16,10 @@ project(VCMI)
# MXE: # MXE:
# - Try to implement MXE support into BundleUtilities so we can deploy deps automatically # - Try to implement MXE support into BundleUtilities so we can deploy deps automatically
# #
# Vckpg:
# - Improve install code once there is better way to deploy DLLs and Qt plugins
# - Move Vcpkg install BundleUtilities code from osx/CMakeLists.txt
#
# Other: # Other:
# - Cleanup remove_directory copy_directory if performance will be a problem. # - Cleanup remove_directory copy_directory if performance will be a problem.
# We can use some macro over copy_if_different since it's only work for single file. # We can use some macro over copy_if_different since it's only work for single file.
@ -362,6 +366,7 @@ endif()
set(CPACK_PACKAGE_VENDOR "VCMI team") set(CPACK_PACKAGE_VENDOR "VCMI team")
if(WIN32) if(WIN32)
# Note: due to NSI script generation process all of the backward slashes here are useful
set(CPACK_MONOLITHIC_INSTALL 1) set(CPACK_MONOLITHIC_INSTALL 1)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/license.txt") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/license.txt")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}") set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
@ -382,10 +387,10 @@ if(WIN32)
# set the install/unistall icon used for the installer itself # set the install/unistall icon used for the installer itself
# There is a bug in NSI that does not handle full unix paths properly. # There is a bug in NSI that does not handle full unix paths properly.
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}/client\\vcmi.ico") set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}/client\\\\vcmi.ico")
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}/client\\vcmi.ico") set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}/client\\\\vcmi.ico")
# set the package header icon for MUI # set the package header icon for MUI
set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/client\\vcmi.ico") set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/client\\\\vcmi.ico")
set(CPACK_NSIS_MENU_LINKS "http://vcmi.eu/" "VCMI Web Site") set(CPACK_NSIS_MENU_LINKS "http://vcmi.eu/" "VCMI Web Site")
@ -396,7 +401,10 @@ if(WIN32)
set(CPACK_NSIS_URL_INFO_ABOUT "http://vcmi.eu/") set(CPACK_NSIS_URL_INFO_ABOUT "http://vcmi.eu/")
set(CPACK_NSIS_CONTACT @CPACK_PACKAGE_CONTACT@) set(CPACK_NSIS_CONTACT @CPACK_PACKAGE_CONTACT@)
set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".")
# Use BundleUtilities to fix build when Vcpkg is used and disable it for MXE
if(NOT (${CMAKE_CROSSCOMPILING}))
add_subdirectory(osx)
endif()
elseif(APPLE AND NOT ENABLE_MONOLITHIC_INSTALL) elseif(APPLE AND NOT ENABLE_MONOLITHIC_INSTALL)
set(CPACK_MONOLITHIC_INSTALL 1) set(CPACK_MONOLITHIC_INSTALL 1)
set(CPACK_GENERATOR "DragNDrop") set(CPACK_GENERATOR "DragNDrop")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -7,7 +7,8 @@ if(APPLE)
message(FATAL_ERROR "Could not find macdeployqt") message(FATAL_ERROR "Could not find macdeployqt")
endif() endif()
install(CODE " install(CODE "
execute_process(COMMAND ${TOOL_MACDEPLOYQT} \"\${CMAKE_INSTALL_PREFIX}/${APP_BUNDLE_DIR}\" -verbose=2)") execute_process(COMMAND ${TOOL_MACDEPLOYQT} \"\${CMAKE_INSTALL_PREFIX}/${APP_BUNDLE_DIR}\" -verbose=2)
")
endif() endif()
install(CODE " install(CODE "
@ -16,3 +17,31 @@ if(APPLE)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${APP_BUNDLE_DIR}\" \"\" \"\") fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${APP_BUNDLE_DIR}\" \"\" \"\")
" COMPONENT Runtime) " COMPONENT Runtime)
endif(APPLE) endif(APPLE)
# This will likely only work for Vcpkg
if(WIN32)
if(ENABLE_LAUNCHER)
# Temporary ugly fix for Qt deployment since windeployqt broken in Vcpkg
install(CODE "
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/\${BUILD_TYPE}/bearer \${CMAKE_INSTALL_PREFIX}/bearer
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/\${BUILD_TYPE}/iconengines \${CMAKE_INSTALL_PREFIX}/iconengines
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/\${BUILD_TYPE}/imageformats \${CMAKE_INSTALL_PREFIX}/imageformats
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/\${BUILD_TYPE}/platforminputcontexts \${CMAKE_INSTALL_PREFIX}/platforminputcontexts
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/\${BUILD_TYPE}/platforms \${CMAKE_INSTALL_PREFIX}/platforms
)
")
endif()
install(CODE "
if(\"\${BUILD_TYPE}\" STREQUAL \"Debug\")
set(dirs \"${CMAKE_PREFIX_PATH}/debug/bin/\")
else()
set(dirs \"${CMAKE_PREFIX_PATH}/bin/\")
endif()
set(BU_CHMOD_BUNDLE_ITEMS ON)
include(BundleUtilities)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/VCMI_Client.exe\" \"\" \"\${dirs}\")
" COMPONENT Runtime)
endif(WIN32)