Skip to content

Commit

Permalink
Wix 4.0 support
Browse files Browse the repository at this point in the history
IB-7780

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma committed Jan 12, 2024
1 parent 94268d7 commit 5bf6e8d
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 100 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ jobs:
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Install WiX
run: |
dotnet tool install --global wix
wix extension -g add WixToolset.UI.wixext
- name: Build
run: |
cmake -S . -B build `
Expand Down
24 changes: 15 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,21 @@ else()
get_target_property(qtCore_install_prefix Qt6::qmake IMPORTED_LOCATION)
get_filename_component(qtCore_install_prefix ${qtCore_install_prefix} DIRECTORY)
add_custom_target(installer DEPENDS ${PROJECT_NAME}
COMMAND "$ENV{WIX}bin\\candle.exe" -nologo -arch ${PLATFORM}
-dMSI_VERSION=${VERSION} -dqt_path=${qtCore_install_prefix}
-dqt_suffix=$<$<CONFIG:Debug>:d> -dqtconf=${CMAKE_SOURCE_DIR}/qt.conf -dlibs_path="${SSL_PATH}"
-dupdater_path=$<TARGET_FILE:${PROJECT_NAME}> ${CMAKE_SOURCE_DIR}/idupdater.wxs
${CMAKE_SOURCE_DIR}/cmake/modules/WelcomeDlg2.wxs ${CMAKE_SOURCE_DIR}/cmake/modules/WixUI_Minimal2.wxs
COMMAND "$ENV{WIX}bin\\light.exe" -nologo -o "${MSI_FILE}.msi" -ext WixUIExtension
idupdater.wixobj WelcomeDlg2.wixobj WixUI_Minimal2.wixobj
-dWixUIDialogBmp=${CMAKE_SOURCE_DIR}/cmake/modules/dlgbmp.bmp
-dWixUIBannerBmp=${CMAKE_SOURCE_DIR}/cmake/modules/banner.bmp
COMMAND "wix.exe" build -nologo
-arch ${PLATFORM}
-ext WixToolset.UI.wixext
-bv WixUIDialogBmp=${CMAKE_SOURCE_DIR}/cmake/modules/dlgbmp.bmp
-bv WixUIBannerBmp=${CMAKE_SOURCE_DIR}/cmake/modules/banner.bmp
-d MSI_VERSION=${VERSION}
-d appicon=${CMAKE_SOURCE_DIR}/appicon.ico
-d qt_path=${qtCore_install_prefix}
-d qt_suffix=$<$<CONFIG:Debug>:d>
-d libs_path="${SSL_PATH}"
-d updater_path=$<TARGET_FILE:${PROJECT_NAME}>
${CMAKE_SOURCE_DIR}/idupdater.wxs
${CMAKE_SOURCE_DIR}/cmake/modules/WelcomeDlg.wxs
${CMAKE_SOURCE_DIR}/cmake/modules/WixUI_Minimal.wxs
-o "${MSI_FILE}.msi"
)
if(SIGNCERT)
if(CROSSSIGNCERT)
Expand Down
2 changes: 1 addition & 1 deletion cmake
163 changes: 73 additions & 90 deletions idupdater.wxs
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>

<!--
"%WIX%\bin\candle.exe" idupdater.wxs -dMSI_VERSION=3.9.5
-dqt_path=C:\Qt\6.6.1\msvc2019
-dlibs_path="C:\OpenSSL-Win64\bin"
-dupdater_path=id-updater.exe
"%WIX%\bin\light.exe" -out idupdater.msi idupdater.wixobj -v -ext WixUIExtension
-->

<?if $(sys.BUILDARCH) = x64 ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?if $(sys.BUILDARCH) = x64 ?>
<?define OpenSSLSuffix = "-x64" ?>
<?else ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?else?>
<?define OpenSSLSuffix = "" ?>
<?endif ?>
<?endif?>

<?if $(env.VisualStudioVersion) = "17.0" ?>
<?define VCVER = "143" ?>
Expand All @@ -25,83 +12,79 @@

<?if $(var.qt_suffix) = "d" ?>
<?define VCPATH = "$(env.VCTOOLSREDISTDIR)\Debug_NonRedist\$(sys.BUILDARCH)\Microsoft.VC$(var.VCVER).DebugCRT" ?>
<?else ?>
<?else?>
<?define VCPATH = "$(env.VCTOOLSREDISTDIR)\$(sys.BUILDARCH)\Microsoft.VC$(var.VCVER).CRT" ?>
<?endif ?>
<?endif?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Name="Open-EID Updater" UpgradeCode="d3aa8bd7-e1e6-46d0-97a6-c9b87d2b830b"
Id="*" Language="1033" Version="$(var.MSI_VERSION)" Codepage="1251" Manufacturer="RIA">
<Package Keywords="Installer" InstallerVersion="500" Compressed="yes" InstallScope="perMachine"/>
<MediaTemplate EmbedCab="yes" CompressionLevel="high"/>
<Icon Id="idupdater.exe" SourceFile="$(var.updater_path)"/>
<Property Id="ARPPRODUCTICON" Value="idupdater.exe"/>
<Property Id="AUTO_UPDATE" Value="1"/>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
<Package Name="Open-EID Updater" UpgradeCode="d3aa8bd7-e1e6-46d0-97a6-c9b87d2b830b"
Language="1033" Version="$(var.MSI_VERSION)" Codepage="1251" Manufacturer="RIA" InstallerVersion="500">
<SummaryInformation Keywords="Installer" />
<MediaTemplate EmbedCab="yes" CompressionLevel="high" />
<Icon Id="appicon.ico" SourceFile="$(var.appicon)" />
<Property Id="ARPPRODUCTICON" Value="appicon.ico" />
<Property Id="AUTO_UPDATE" Value="1" />
<MajorUpgrade AllowSameVersionUpgrades="yes" Schedule="afterInstallInitialize" DowngradeErrorMessage=
"A newer version of [ProductName] is already installed. If you are trying to downgrade, please uninstall the newer version first."/>
<Condition Message="[ProductName] requires Windows 7 or higher.">
<![CDATA[Installed OR (VersionNT >= 601)]]>
</Condition>
<UIRef Id="WixUI_Minimal2" />
"A newer version of [ProductName] is already installed. If you are trying to downgrade, please uninstall the newer version first." />
<Launch Condition="Installed OR (VersionNT &gt;= 601)" Message="[ProductName] requires Windows 7 or higher." />
<ui:WixUI Id="WixUI_Minimal2" />

<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id='$(var.PlatformProgramFilesFolder)'>
<Directory Id="APPLICATIONFOLDER" Name="Open-EID">
<Component Id="Application" Guid="ce49ec96-dc54-4b51-adae-8d5dd82b15d1">
<File Id="id_updater.exe" Source="$(var.updater_path)" KeyPath='yes'/>
<RegistryValue Root="HKMU" Key="Software\[Manufacturer]\Open-EID"
Name="Installed" Value="[APPLICATIONFOLDER]" Type="string"/>
<StandardDirectory Id="ProgramFiles6432Folder">
<Directory Id="APPLICATIONFOLDER" Name="Open-EID">
<Component Id="Application" Guid="ce49ec96-dc54-4b51-adae-8d5dd82b15d1">
<File Id="id_updater.exe" Source="$(var.updater_path)" KeyPath="yes" />
<RegistryValue Root="HKMU" Key="Software\[Manufacturer]\Open-EID"
Name="Installed" Value="[APPLICATIONFOLDER]" Type="string" />
<?if $(sys.BUILDARCH) = x64 ?>
<RegistryValue Root="HKMU" Key="Software\Wow6432Node\[Manufacturer]\Open-EID"
Name="Installed" Value="[APPLICATIONFOLDER]" Type="string"/>
<?endif ?>
<?ifdef var.qt_path ?>
<File Source="$(var.VCPATH)\msvcp140$(var.qt_suffix).dll"/>
<File Source="$(var.VCPATH)\vcruntime140$(var.qt_suffix).dll"/>
<?if $(sys.BUILDARCH) = x64 AND $(env.VisualStudioVersion) != "15.0" ?>
<File Source="$(var.VCPATH)\msvcp140_1$(var.qt_suffix).dll"/>
<File Source="$(var.VCPATH)\msvcp140_2$(var.qt_suffix).dll"/>
<File Source="$(var.VCPATH)\vcruntime140_1$(var.qt_suffix).dll"/>
<?endif ?>
<File Source="$(var.libs_path)\libcrypto-3$(var.OpenSSLSuffix).dll"/>
<File Source="$(var.libs_path)\libssl-3$(var.OpenSSLSuffix).dll"/>
<File Source="$(var.qt_path)\Qt6Core$(var.qt_suffix).dll"/>
<File Source="$(var.qt_path)\Qt6Gui$(var.qt_suffix).dll"/>
<File Source="$(var.qt_path)\Qt6Network$(var.qt_suffix).dll"/>
<File Source="$(var.qt_path)\Qt6PrintSupport$(var.qt_suffix).dll"/>
<File Source="$(var.qt_path)\Qt6Svg$(var.qt_suffix).dll"/>
<File Source="$(var.qt_path)\Qt6Widgets$(var.qt_suffix).dll"/>
<File Source="$(var.qt_path)\D3DCompiler_47.dll"/>
<File Source="$(var.qt_path)\opengl32sw.dll"/>
<File Source="$(var.qt_path)\Qt6SvgWidgets$(var.qt_suffix).dll"/>
<RegistryValue Root="HKMU" Key="Software\Wow6432Node\[Manufacturer]\Open-EID"
Name="Installed" Value="[APPLICATIONFOLDER]" Type="string" />
<?endif?>
</Component>
<?ifdef var.qt_path ?>
<Directory Id="platforms" Name="platforms" FileSource="$(var.qt_path)\..\plugins\platforms">
<Component Id="qwindows.dll">
<File Name="qwindows$(var.qt_suffix).dll"/>
</Component>
</Directory>
<Directory Id="tls" Name="tls" FileSource="$(var.qt_path)\..\plugins\tls">
<Component Id="qopensslbackend.dll">
<File Name="qopensslbackend$(var.qt_suffix).dll"/>
</Component>
</Directory>
<Directory Id="styles" Name="styles" FileSource="$(var.qt_path)\..\plugins\styles">
<Component Id="qwindowsvistastyle.dll">
<File Name="qwindowsvistastyle$(var.qt_suffix).dll"/>
</Component>
</Directory>
<Directory Id="imageformats" Name="imageformats" FileSource="$(var.qt_path)\..\plugins\imageformats">
<Component Id="imageformats.dll" Guid="4ae32624-e869-4e4c-8a1c-624c31133ce3">
<File Name="qjpeg$(var.qt_suffix).dll"/>
<File Name="qsvg$(var.qt_suffix).dll"/>
</Component>
</Directory>
<File Source="$(var.VCPATH)\msvcp140$(var.qt_suffix).dll" />
<File Source="$(var.VCPATH)\vcruntime140$(var.qt_suffix).dll" />
<?if $(sys.BUILDARCH) = x64 ?>
<File Source="$(var.VCPATH)\msvcp140_1$(var.qt_suffix).dll" />
<File Source="$(var.VCPATH)\msvcp140_2$(var.qt_suffix).dll" />
<File Source="$(var.VCPATH)\vcruntime140_1$(var.qt_suffix).dll" />
<?endif?>
<File Source="$(var.libs_path)\libcrypto-3$(var.OpenSSLSuffix).dll" />
<File Source="$(var.libs_path)\libssl-3$(var.OpenSSLSuffix).dll" />
<File Source="$(var.qt_path)\Qt6Core$(var.qt_suffix).dll" />
<File Source="$(var.qt_path)\Qt6Gui$(var.qt_suffix).dll" />
<File Source="$(var.qt_path)\Qt6Network$(var.qt_suffix).dll" />
<File Source="$(var.qt_path)\Qt6PrintSupport$(var.qt_suffix).dll" />
<File Source="$(var.qt_path)\Qt6Svg$(var.qt_suffix).dll" />
<File Source="$(var.qt_path)\Qt6Widgets$(var.qt_suffix).dll" />
<File Source="$(var.qt_path)\D3DCompiler_47.dll" />
<File Source="$(var.qt_path)\opengl32sw.dll" />
<File Source="$(var.qt_path)\Qt6SvgWidgets$(var.qt_suffix).dll" />
<?endif?>
</Component>
<?ifdef var.qt_path ?>
<Directory Id="platforms" Name="platforms" FileSource="$(var.qt_path)\..\plugins\platforms">
<Component Id="qwindows.dll">
<File Name="qwindows$(var.qt_suffix).dll" />
</Component>
</Directory>
<Directory Id="tls" Name="tls" FileSource="$(var.qt_path)\..\plugins\tls">
<Component Id="qopensslbackend.dll">
<File Name="qopensslbackend$(var.qt_suffix).dll" />
</Component>
</Directory>
<Directory Id="styles" Name="styles" FileSource="$(var.qt_path)\..\plugins\styles">
<Component Id="qwindowsvistastyle.dll">
<File Name="qwindowsvistastyle$(var.qt_suffix).dll" />
</Component>
</Directory>
<Directory Id="imageformats" Name="imageformats" FileSource="$(var.qt_path)\..\plugins\imageformats">
<Component Id="imageformats.dll" Guid="4ae32624-e869-4e4c-8a1c-624c31133ce3">
<File Name="qsvg$(var.qt_suffix).dll" />
</Component>
</Directory>
<?endif?>
</Directory>
</Directory>
</StandardDirectory>

<Feature Id="Install" Title="Open-EID" ConfigurableDirectory="APPLICATIONFOLDER">
<ComponentRef Id="Application" />
Expand All @@ -113,14 +96,14 @@
<?endif?>
</Feature>

<CustomAction Id="ScheduleUpdater" FileKey="id_updater.exe" Impersonate="no" Execute="deferred"
ExeCommand="-weekly" Return="ignore"/>
<CustomAction Id="UnScheduleUpdater" FileKey="id_updater.exe" Impersonate="no" Execute="deferred"
ExeCommand="-remove" Return="ignore"/>
<CustomAction Id="ScheduleUpdater" Impersonate="no" Execute="deferred"
ExeCommand="-weekly" Return="ignore" FileRef="id_updater.exe" />
<CustomAction Id="UnScheduleUpdater" Impersonate="no" Execute="deferred"
ExeCommand="-remove" Return="ignore" FileRef="id_updater.exe" />

<InstallExecuteSequence>
<Custom Action="ScheduleUpdater" Before="InstallFinalize">(NOT Installed) AND (AUTO_UPDATE = 1)</Custom>
<Custom Action="UnScheduleUpdater" After="InstallInitialize">REMOVE="ALL"</Custom>
<Custom Action="ScheduleUpdater" Before="InstallFinalize" Condition="(NOT Installed) AND (AUTO_UPDATE = 1)" />
<Custom Action="UnScheduleUpdater" After="InstallInitialize" Condition="REMOVE=&quot;ALL&quot;" />
</InstallExecuteSequence>
</Product>
</Package>
</Wix>

0 comments on commit 5bf6e8d

Please sign in to comment.