Windows Installer cleanup: fix passing variables to WiX

Update SetupWindowsPackaging.cmake
This commit is contained in:
Casper Jeukendrup 2023-09-14 22:22:50 +02:00
parent 7539ee78a4
commit 2b29c73b63
No known key found for this signature in database
GPG key ID: 6C571BEF59E722DD
3 changed files with 27 additions and 28 deletions

View file

@ -54,15 +54,6 @@ set(CPACK_WIX_ROOT "${PROGRAMFILES}/WiX Toolset v3.11")
# Use custom version of WIX.template.in
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/packaging" ${CMAKE_MODULE_PATH})
# File types association:
message(STATUS "[SetupWindowsPackaging.cmake] PACKAGE_FILE_ASSOCIATION: ${MUE_ENABLE_FILE_ASSOCIATION}")
if(MUE_ENABLE_FILE_ASSOCIATION)
list(APPEND CPACK_WIX_CANDLE_EXTRA_FLAGS -dCPACK_WIX_FILE_ASSOCIATION=ON)
else()
list(APPEND CPACK_WIX_CANDLE_EXTRA_FLAGS -dCPACK_WIX_FILE_ASSOCIATION=OFF)
endif()
if(NOT CPACK_WIX_PRODUCT_GUID)
set(CPACK_WIX_PRODUCT_GUID "00000000-0000-0000-0000-000000000000")
endif()
@ -82,4 +73,15 @@ set(CPACK_WIX_UI_DIALOG "${PROJECT_SOURCE_DIR}/build/packaging/installer_backgro
set(CPACK_WIX_PROGRAM_MENU_FOLDER "${MUSESCORE_NAME_VERSION}")
set(CPACK_WIX_EXTENSIONS "WixUtilExtension")
# Extra CPack variables
list(APPEND CPACK_WIX_CANDLE_EXTRA_FLAGS
"-dCPACK_PACKAGE_VERSION_MAJOR=${CPACK_PACKAGE_VERSION_MAJOR}"
"-dMUSESCORE_NAME_VERSION=${MUSESCORE_NAME_VERSION}"
"-dMUSESCORE_VERSION_LABEL=${MUSESCORE_VERSION_LABEL}"
)
if (MUSESCORE_UNSTABLE)
list(APPEND CPACK_WIX_CANDLE_EXTRA_FLAGS "-dMUSESCORE_UNSTABLE=ON")
endif()
include(CPack)

View file

@ -1,5 +0,0 @@
The Wix.template.in file contains one absolute path to the exe file. It needs to be changed.
<?define ExeId="CM_FP_bin.$(var.CPACK_PACKAGE_NAME).exe" ?>
To create new version, the 3 digits version of MuseScore needs to be
changed and the product ID as well (see SetupWindowsPackaging.cmake)

View file

@ -2,15 +2,14 @@
<?include "cpack_variables.wxi"?>
<?define ProdName="@MUSESCORE_NAME_VERSION@"?>
<?define ShortProdName="$(var.CPACK_PACKAGE_NAME)$(var.CPACK_PACKAGE_VERSION_MAJOR)@MUSESCORE_VERSION_LABEL@"?>
<?define ExeName="$(var.ShortProdName).exe"?>
<?define ProdName="$(var.MUSESCORE_NAME_VERSION)"?>
<?define ShortProdName="$(var.CPACK_PACKAGE_NAME)$(var.CPACK_PACKAGE_VERSION_MAJOR)$(var.MUSESCORE_VERSION_LABEL)"?>
<?define ExeName="$(var.CPACK_PACKAGE_NAME)$(var.CPACK_PACKAGE_VERSION_MAJOR).exe"?>
<?define ExeKey="$(var.ShortProdName).exe"?>
<?define ExeId="CM_FP_bin.$(var.ShortProdName).exe"?>
<?define RegistryRoot="HKMU"?> <!--HKCU / HKLM-->
<?if "@MUSESCORE_VERSION_LABEL@" != ""?>
<?define ProgIdSuffix="$(var.CPACK_PACKAGE_VERSION_MAJOR).@MUSESCORE_VERSION_LABEL@"?>
<?if "$(var.MUSESCORE_VERSION_LABEL)" != ""?>
<?define ProgIdSuffix="$(var.CPACK_PACKAGE_VERSION_MAJOR).$(var.MUSESCORE_VERSION_LABEL)"?>
<?else?>
<?define ProgIdSuffix="$(var.CPACK_PACKAGE_VERSION_MAJOR)"?>
<?endif?>
@ -65,7 +64,7 @@
</UI>
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch $(var.ProdName)" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />
<Property Id="WixShellExecTarget" Value="[#CM_FP_bin.$(var.ShortProdName).exe]" />
<Property Id="WixShellExecTarget" Value="[#CM_FP_bin.$(var.ExeName)]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<Component Id="RegisterTypes" Directory="TARGETDIR" Guid="76707452-ee26-4f9a-9650-2cf2c70a6448">
@ -153,12 +152,12 @@
<RegistryValue Key="DefaultIcon" Value="[INSTALL_ROOT]bin\$(var.ExeName),1" Type="string" />
<RegistryValue Key="shell\open\command" Value="&quot;[INSTALL_ROOT]bin\$(var.ExeName)&quot; &quot;%1&quot;" Type="string" />
</RegistryKey>
<?if "@MUSESCORE_UNSTABLE@" = ""?>
<?ifndef MUSESCORE_UNSTABLE?>
<RegistryValue Root="$(var.RegistryRoot)" Key="SOFTWARE\Classes\MuseScore.mscz\CurVer" Value="MuseScore.mscz.$(var.ProgIdSuffix)" Type="string" />
<?endif?>
<RegistryKey Root="$(var.RegistryRoot)" Key="SOFTWARE\Classes\.mscz">
<?if "@MUSESCORE_UNSTABLE@" = ""?>
<?ifndef MUSESCORE_UNSTABLE?>
<RegistryValue Value="MuseScore.mscz.$(var.ProgIdSuffix)" Type="string" />
<?endif?>
<RegistryValue Name="Content Type" Value="application/x-musescore" Type="string" />
@ -170,12 +169,12 @@
<RegistryValue Key="DefaultIcon" Value="[INSTALL_ROOT]bin\$(var.ExeName),2" Type="string" />
<RegistryValue Key="shell\open\command" Value="&quot;[INSTALL_ROOT]bin\$(var.ExeName)&quot; &quot;%1&quot;" Type="string" />
</RegistryKey>
<?if "@MUSESCORE_UNSTABLE@" = ""?>
<?ifndef MUSESCORE_UNSTABLE?>
<RegistryValue Root="$(var.RegistryRoot)" Key="SOFTWARE\Classes\MuseScore.mscx\CurVer" Value="MuseScore.mscx.$(var.ProgIdSuffix)" Type="string" />
<?endif?>
<RegistryKey Root="$(var.RegistryRoot)" Key="SOFTWARE\Classes\.mscx">
<?if "@MUSESCORE_UNSTABLE@" = ""?>
<?ifndef MUSESCORE_UNSTABLE?>
<RegistryValue Value="MuseScore.mscx.$(var.ProgIdSuffix)" Type="string" />
<?endif?>
<RegistryValue Name="Content Type" Value="application/x-musescore+xml" Type="string" />
@ -187,12 +186,12 @@
<RegistryValue Key="DefaultIcon" Value="[INSTALL_ROOT]bin\$(var.ExeName),1" Type="string" />
<RegistryValue Key="shell\open\command" Value="&quot;[INSTALL_ROOT]bin\$(var.ExeName)&quot; &quot;%1&quot;" Type="string" />
</RegistryKey>
<?if "@MUSESCORE_UNSTABLE@" = ""?>
<?ifndef MUSESCORE_UNSTABLE?>
<RegistryValue Root="$(var.RegistryRoot)" Key="SOFTWARE\Classes\MuseScore.mscs\CurVer" Value="MuseScore.mscs.$(var.ProgIdSuffix)" Type="string" />
<?endif?>
<RegistryKey Root="$(var.RegistryRoot)" Key="SOFTWARE\Classes\.mscs">
<?if "@MUSESCORE_UNSTABLE@" = ""?>
<?ifndef MUSESCORE_UNSTABLE?>
<RegistryValue Value="MuseScore.mscs.$(var.ProgIdSuffix)" Type="string" />
<?endif?>
<RegistryValue Name="Content Type" Value="application/x-musescore+xml" Type="string" />
@ -204,7 +203,7 @@
<RegistryValue Key="DefaultIcon" Value="[INSTALL_ROOT]bin\$(var.ExeName),1" Type="string" />
<RegistryValue Key="shell\open\command" Value="&quot;[INSTALL_ROOT]bin\$(var.ExeName)&quot; &quot;%1&quot;" Type="string" />
</RegistryKey>
<?if "@MUSESCORE_UNSTABLE@" = ""?>
<?ifndef MUSESCORE_UNSTABLE?>
<RegistryValue Root="$(var.RegistryRoot)" Key="SOFTWARE\Classes\MuseScore.Url.musescore\CurVer" Value="MuseScore.Url.musescore.$(var.ProgIdSuffix)" Type="string" />
<?endif?>
@ -218,5 +217,8 @@
<!-- Step 3: Tell WiX to install the shortcut and types -->
<ComponentRef Id="RegisterTypes" />
</FeatureRef>
<?include "properties.wxi"?>
<?include "product_fragment.wxi"?>
</Product>
</Wix>