From 6a239606429e124b5910f3802d8f5ad05465a111 Mon Sep 17 00:00:00 2001 From: Michael Pavlyshko Date: Mon, 14 Jul 2014 01:02:00 +0300 Subject: [PATCH 1/3] CMake/WIN32 : add icon to client and launcher --- client/CMakeLists.txt | 2 ++ client/VCMI_client.mingw.rc | 1 + launcher/CMakeLists.txt | 2 +- launcher/VCMI_launcher.mingw.rc | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 client/VCMI_client.mingw.rc create mode 100644 launcher/VCMI_launcher.mingw.rc diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 785095a27..079a8392b 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -97,6 +97,8 @@ if(APPLE) cp -r ${CMAKE_HOME_DIRECTORY}/launcher/icons/ ${BUNDLE_PATH}/Data/launcher/icons/) add_custom_command(TARGET vcmiclient POST_BUILD COMMAND ${MakeVCMIBundle}) +elseif(WIN32) + add_executable(vcmiclient ${client_SRCS} VCMI_client.mingw.rc) else() add_executable(vcmiclient ${client_SRCS}) endif() diff --git a/client/VCMI_client.mingw.rc b/client/VCMI_client.mingw.rc new file mode 100644 index 000000000..f901de682 --- /dev/null +++ b/client/VCMI_client.mingw.rc @@ -0,0 +1 @@ +IDI_ICON1 ICON "vcmi.ico" \ No newline at end of file diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 9bc5ca2d8..97401251e 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -52,7 +52,7 @@ set(CMAKE_CXX_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS} ${CMAKE_CXX_FLAGS}") qt5_wrap_ui(launcher_UI_HEADERS ${launcher_FORMS}) if(WIN32) - add_executable(vcmilauncher WIN32 ${launcher_SRCS} ${launcher_UI_HEADERS}) + add_executable(vcmilauncher WIN32 ${launcher_SRCS} ${launcher_UI_HEADERS} VCMI_launcher.mingw.rc) set_target_properties(vcmilauncher PROPERTIES OUTPUT_NAME VCMI_launcher) else() add_executable(vcmilauncher ${launcher_SRCS} ${launcher_UI_HEADERS}) diff --git a/launcher/VCMI_launcher.mingw.rc b/launcher/VCMI_launcher.mingw.rc new file mode 100644 index 000000000..0ab86661d --- /dev/null +++ b/launcher/VCMI_launcher.mingw.rc @@ -0,0 +1 @@ +IDI_ICON1 ICON "../client/vcmi.ico" \ No newline at end of file From 88316f93d1c3ec871f91028b56fe50f3198d6b8f Mon Sep 17 00:00:00 2001 From: Michael Pavlyshko Date: Mon, 14 Jul 2014 01:23:57 +0300 Subject: [PATCH 2/3] add NSIS generator settings --- CMakeLists.txt | 17 +++++++++++++++- cmake_modules/CMakeCPackOptions.cmake.in | 26 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 cmake_modules/CMakeCPackOptions.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ef744909..e01fb0014 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -283,7 +283,22 @@ set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSIO set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) if(WIN32) - set(CPACK_GENERATOR ZIP) # just use zip? CPack has some GUI install as well + set(CPACK_STRIP_FILES "VCMI_launcher.exe;VCMI_client.exe;VCMI_server.exe;VCMI_lib.exe;AI/BattleAI.dll;AI/EmptyAI.dll;AI/StupidAI.dll;AI/VCAI.dll") + + set(CPACK_MONOLITHIC_INSTALL 1) + set(CPACK_PACKAGE_NAME "VCMI") + set(CPACK_PACKAGE_VENDOR "VCMI team") + set(CPACK_PACKAGE_FILE_NAME "vcmi-${CPACK_PACKAGE_VERSION}-win32") + set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.txt") + set(CPACK_PACKAGE_EXECUTABLES "VCMI_launcher;VCMI") + set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}") + set(CPACK_NSIS_PACKAGE_NAME "VCMI ${CPACK_PACKAGE_VERSION}") + set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES") + set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " CreateShortCut \\\"$DESKTOP\\\\VCMI.lnk\\\" \\\"$INSTDIR\\\\VCMI_launcher.exe\\\"") + set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS " Delete \\\"$DESKTOP\\\\VCMI.lnk\\\" ") + + configure_file("${CMAKE_SOURCE_DIR}/cmake_modules/CMakeCPackOptions.cmake.in" "${CMAKE_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY) + set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_BINARY_DIR}/CMakeCPackOptions.cmake") elseif(APPLE) set(CPACK_GENERATOR DragNDrop) set(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_SOURCE_DIR}/osx/dmg_background.png") diff --git a/cmake_modules/CMakeCPackOptions.cmake.in b/cmake_modules/CMakeCPackOptions.cmake.in new file mode 100644 index 000000000..b39bc5030 --- /dev/null +++ b/cmake_modules/CMakeCPackOptions.cmake.in @@ -0,0 +1,26 @@ +# This file is configured at cmake time, and loaded at cpack time. +# To pass variables to cpack from cmake, they must be configured +# in this file. + +if(CPACK_GENERATOR MATCHES "NSIS") + set(CPACK_NSIS_INSTALL_ROOT "@CPACK_NSIS_INSTALL_ROOT@") + + # 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_SOURCE_DIR@/client\\vcmi.ico") + set(CPACK_NSIS_MUI_UNIICON "@CMAKE_SOURCE_DIR@/client\\vcmi.ico") + # set the package header icon for MUI + set(CPACK_PACKAGE_ICON "@CMAKE_SOURCE_DIR@/client\\vcmi.ico") + + set(CPACK_NSIS_MENU_LINKS + "http://vcmi.eu/" "VCMI Web Site") + + set(CPACK_NSIS_INSTALLED_ICON_NAME "VCMI_client.exe") + set(CPACK_NSIS_COMPRESSOR "/SOLID lzma") + set(CPACK_NSIS_PACKAGE_NAME "@CPACK_NSIS_PACKAGE_NAME@") + set(CPACK_NSIS_DISPLAY_NAME "@CPACK_NSIS_PACKAGE_NAME@, open-source engine for Heroes of Might and Magic III ") + set(CPACK_NSIS_HELP_LINK "http://vcmi.eu/") + set(CPACK_NSIS_URL_INFO_ABOUT "http://vcmi.eu/") + set(CPACK_NSIS_CONTACT @CPACK_PACKAGE_CONTACT@) + set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") +endif() \ No newline at end of file From a6e590f2206c68766e9b1f17f915a090671c9069 Mon Sep 17 00:00:00 2001 From: Michael Pavlyshko Date: Thu, 17 Jul 2014 23:11:09 +0300 Subject: [PATCH 3/3] cpack/nsis: do not strip files --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e01fb0014..66d47ebd6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -283,8 +283,6 @@ set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSIO set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) if(WIN32) - set(CPACK_STRIP_FILES "VCMI_launcher.exe;VCMI_client.exe;VCMI_server.exe;VCMI_lib.exe;AI/BattleAI.dll;AI/EmptyAI.dll;AI/StupidAI.dll;AI/VCAI.dll") - set(CPACK_MONOLITHIC_INSTALL 1) set(CPACK_PACKAGE_NAME "VCMI") set(CPACK_PACKAGE_VENDOR "VCMI team")