Add build of MSI packages (#1148)

This commit is contained in:
Sebastian Marsching 2017-10-30 15:41:20 +01:00
parent e100ba8362
commit 3e9067fe8e
5 changed files with 75 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 KiB

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<CPackWiXPatch>
<CPackWiXFragment Id="CM_FP_KeePassXC.exe">
<Shortcut Id="CM_SP_KeePassXC.exe" Directory="ProgramMenuFolder"
Name="KeePassXC" Icon="ProductIcon.ico"
WorkingDirectory="INSTALL_ROOT" Advertise="yes" />
</CPackWiXFragment>
</CPackWiXPatch>

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<?include "cpack_variables.wxi"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
RequiredVersion="3.6.3303.0">
<Product Id="$(var.CPACK_WIX_PRODUCT_GUID)"
Name="$(var.CPACK_PACKAGE_NAME)"
Language="1033"
Version="$(var.CPACK_PACKAGE_VERSION)"
Manufacturer="$(var.CPACK_PACKAGE_VENDOR)"
UpgradeCode="$(var.CPACK_WIX_UPGRADE_GUID)">
<Package InstallScope="perMachine" InstallerVersion="301" Compressed="yes"/>
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes"/>
<MajorUpgrade
Schedule="afterInstallInitialize"
AllowSameVersionUpgrades="yes"
DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit."/>
<WixVariable Id="WixUILicenseRtf" Value="$(var.CPACK_WIX_LICENSE_RTF)"/>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALL_ROOT"/>
<?ifdef CPACK_WIX_PRODUCT_ICON?>
<Property Id="ARPPRODUCTICON">ProductIcon.ico</Property>
<Icon Id="ProductIcon.ico" SourceFile="$(var.CPACK_WIX_PRODUCT_ICON)"/>
<?endif?>
<?ifdef CPACK_WIX_UI_BANNER?>
<WixVariable Id="WixUIBannerBmp" Value="$(var.CPACK_WIX_UI_BANNER)"/>
<?endif?>
<?ifdef CPACK_WIX_UI_DIALOG?>
<WixVariable Id="WixUIDialogBmp" Value="$(var.CPACK_WIX_UI_DIALOG)"/>
<?endif?>
<FeatureRef Id="ProductFeature"/>
<UIRef Id="$(var.CPACK_WIX_UI_REF)" />
<?include "properties.wxi"?>
<?include "product_fragment.wxi"?>
<DirectoryRef Id="TARGETDIR">
<Directory Id="ProgramMenuFolder" />
</DirectoryRef>
</Product>
</Wix>

View File

@ -299,14 +299,21 @@ if(MINGW)
set(OUTPUT_FILE_POSTFIX "Win32") set(OUTPUT_FILE_POSTFIX "Win32")
endif() endif()
set(CPACK_GENERATOR "ZIP;NSIS") # We have to copy the license file in the configuration phase.
# CMake checks that CPACK_RESOURCE_FILE_LICENSE actually exists and
# we have to copy it because WiX needs it to have a .txt extension.
execute_process(COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_SOURCE_DIR}/LICENSE.GPL-2"
"${CMAKE_CURRENT_BINARY_DIR}/INSTALLER_LICENSE.txt")
set(CPACK_GENERATOR "ZIP;NSIS;WIX")
set(CPACK_STRIP_FILES ON) set(CPACK_STRIP_FILES ON)
set(CPACK_PACKAGE_FILE_NAME "${PROGNAME}-${KEEPASSXC_VERSION}-${OUTPUT_FILE_POSTFIX}") set(CPACK_PACKAGE_FILE_NAME "${PROGNAME}-${KEEPASSXC_VERSION}-${OUTPUT_FILE_POSTFIX}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${PROGNAME}) set(CPACK_PACKAGE_INSTALL_DIRECTORY ${PROGNAME})
set(CPACK_PACKAGE_VERSION ${KEEPASSXC_VERSION}) set(CPACK_PACKAGE_VERSION ${KEEPASSXC_VERSION})
set(CPACK_PACKAGE_VENDOR "${PROGNAME} Team") set(CPACK_PACKAGE_VENDOR "${PROGNAME} Team")
string(REGEX REPLACE "/" "\\\\\\\\" CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/share/windows/installer-header.bmp") string(REGEX REPLACE "/" "\\\\\\\\" CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/share/windows/installer-header.bmp")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.GPL-2") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/INSTALLER_LICENSE.txt")
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/share/windows/keepassxc.ico") set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/share/windows/keepassxc.ico")
set(CPACK_NSIS_MUI_UNIICON "${CPACK_NSIS_MUI_ICON}") set(CPACK_NSIS_MUI_UNIICON "${CPACK_NSIS_MUI_ICON}")
@ -319,6 +326,13 @@ if(MINGW)
set(CPACK_NSIS_DISPLAY_NAME ${PROGNAME}) set(CPACK_NSIS_DISPLAY_NAME ${PROGNAME})
set(CPACK_NSIS_PACKAGE_NAME "${PROGNAME} v${KEEPASSXC_VERSION}") set(CPACK_NSIS_PACKAGE_NAME "${PROGNAME} v${KEEPASSXC_VERSION}")
set(CPACK_NSIS_MUI_FINISHPAGE_RUN "../${PROGNAME}.exe") set(CPACK_NSIS_MUI_FINISHPAGE_RUN "../${PROGNAME}.exe")
set(CPACK_WIX_UPGRADE_GUID 88785A72-3EAE-4F29-89E3-BC6B19BA9A5B)
set(CPACK_WIX_PRODUCT_ICON "${CMAKE_SOURCE_DIR}/share/windows/keepassxc.ico")
set(CPACK_WIX_UI_BANNER "${CMAKE_SOURCE_DIR}/share/windows/wix-banner.bmp")
set(CPACK_WIX_UI_DIALOG "${CMAKE_SOURCE_DIR}/share/windows/wix-dialog.bmp")
set(CPACK_WIX_TEMPLATE "${CMAKE_SOURCE_DIR}/share/windows/wix-template.xml")
set(CPACK_WIX_PATCH_FILE "${CMAKE_SOURCE_DIR}/share/windows/wix-patch.xml")
set(CPACK_WIX_PROPERTY_ARPURLINFOABOUT "https://keepassxc.org")
include(CPack) include(CPack)
install(CODE " install(CODE "