Browse Source

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
Arseniy Shestakov 8 years ago
parent
commit
03c7bf5ee6
3 changed files with 42 additions and 5 deletions
  1. 12 4
      CMakeLists.txt
  2. BIN
      launcher/VCMI_launcher.ico
  3. 30 1
      osx/CMakeLists.txt

+ 12 - 4
CMakeLists.txt

@@ -16,6 +16,10 @@ project(VCMI)
 # MXE:
 # - 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:
 # - 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.
@@ -362,6 +366,7 @@ endif()
 set(CPACK_PACKAGE_VENDOR "VCMI team")
 
 if(WIN32)
+	# Note: due to NSI script generation process all of the backward slashes here are useful
 	set(CPACK_MONOLITHIC_INSTALL 1)
 	set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/license.txt")
 	set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
@@ -382,10 +387,10 @@ if(WIN32)
 
 	# set the install/unistall icon used for the installer itself
 	# 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_UNIICON "${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 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")
 
@@ -396,7 +401,10 @@ if(WIN32)
 	set(CPACK_NSIS_URL_INFO_ABOUT "http://vcmi.eu/")
 	set(CPACK_NSIS_CONTACT @CPACK_PACKAGE_CONTACT@)
 	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)
 	set(CPACK_MONOLITHIC_INSTALL 1)
 	set(CPACK_GENERATOR "DragNDrop")

BIN
launcher/VCMI_launcher.ico


+ 30 - 1
osx/CMakeLists.txt

@@ -7,7 +7,8 @@ if(APPLE)
 			message(FATAL_ERROR "Could not find macdeployqt")
 		endif()
 		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()
 
 	install(CODE "
@@ -16,3 +17,31 @@ if(APPLE)
 		fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${APP_BUNDLE_DIR}\" \"\" \"\")
 	" COMPONENT Runtime)
 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)