Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wix 4.0 support #582

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ jobs:
architecture: ${{ matrix.platform }}
- name: Build xsd
run: .\prepare_win_build_environment.ps1 -xsd
- name: Install WiX
run: |
dotnet tool install -g wix
wix extension -g add WixToolset.UI.wixext
- name: Setup dev env
uses: ilammy/msvc-dev-cmd@v1
with:
Expand Down
41 changes: 23 additions & 18 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@ param(
[string]$cmake = "cmake.exe",
[string]$generator = "NMake Makefiles",
[string]$vcvars = "vcvarsall",
[string]$wix = "$env:WIX",
[string]$heat = "$wix\bin\heat.exe",
[string]$candle = "$wix\bin\candle.exe",
[string]$light = "$wix\bin\light.exe",
[string]$wix = "wix.exe",
[string]$swig = $null,
[string]$doxygen = $null,
[switch]$boost = $false,
[string]$xsd = "$libdigidocpp\xsd",
[string]$sign = $null
)

# Hack to fetch heat.exe tool
& dotnet new console -o wix-heat --force
& dotnet add wix-heat package WixToolset.Heat
$heat = Get-ChildItem "$env:USERPROFILE\.nuget\packages\WixToolset.Heat" -Include heat.exe -Recurse

$cmakeext = @()
$candleext = @()
$lightext = @()
$wixext = @()
$target = @("all")
if($swig) {
$cmakeext += "-DSWIG_EXECUTABLE=$swig"
$candleext += "-dswig=$swig"
$wixext += "-d", "swig=$swig"
}
if($doxygen) {
$cmakeext += "-DDOXYGEN_EXECUTABLE=$doxygen"
$candleext += "-ddocLocation=$platform/share/doc/libdigidocpp", "DocFilesFragment.wxs"
$lightext += "DocFilesFragment.wixobj"
$wixext += "-d", "docLocation=$platform/share/doc/libdigidocpp", "DocFilesFragment.wxs"
}
if($boost) {
$cmakeext += "-DVCPKG_MANIFEST_FEATURES=tests"
Expand All @@ -54,16 +54,21 @@ foreach($type in @("Debug", "RelWithDebInfo")) {
}

if($doxygen) {
& $heat dir $platform/share/doc/libdigidocpp -nologo -cg Documentation -gg -scom -sreg -sfrag -srd -dr DocumentationFolder -var var.docLocation -out DocFilesFragment.wxs
& $heat[0] dir $platform/share/doc/libdigidocpp -nologo -cg Documentation -gg -scom -sreg -sfrag -srd -dr DocumentationFolder -var var.docLocation -out DocFilesFragment.wxs
}
& $heat dir $platform/include -nologo -cg Headers -gg -scom -sreg -sfrag -srd -dr HeadersFolder -var var.headersLocation -out HeadersFragment.wxs
& $candle -nologo -arch $platform "-dICON=$libdigidocpp/cmake/modules/ID.ico" "-dMSI_VERSION=$msiversion" `
"-dvcpkg=$vcpkg_installed\vcpkg_installed_$platform\$platform-windows" "-dheadersLocation=$platform/include" `
"-dlibdigidocpp=$platform" $candleext $libdigidocpp\libdigidocpp.wxs HeadersFragment.wxs
& $light -nologo -out $msi_name -ext WixUIExtension `
"-dWixUIBannerBmp=$libdigidocpp/cmake/modules/banner.bmp" `
"-dWixUIDialogBmp=$libdigidocpp/cmake/modules/dlgbmp.bmp" `
$lightext libdigidocpp.wixobj HeadersFragment.wixobj

& $heat[0] dir $platform/include -nologo -cg Headers -gg -scom -sreg -sfrag -srd -dr HeadersFolder -var var.headersLocation -out HeadersFragment.wxs
& $wix build -nologo -arch $platform -out $msi_name $wixext `
-ext WixToolset.UI.wixext `
-bv "WixUIBannerBmp=$libdigidocpp/cmake/modules/banner.bmp" `
-bv "WixUIDialogBmp=$libdigidocpp/cmake/modules/dlgbmp.bmp" `
-d "ICON=$libdigidocpp/cmake/modules/ID.ico" `
-d "MSI_VERSION=$msiversion" `
-d "vcpkg=$vcpkg_installed/vcpkg_installed_$platform/$platform-windows" `
-d "libdigidocpp=$platform" `
-d "headersLocation=$platform/include" `
HeadersFragment.wxs `
$libdigidocpp\libdigidocpp.wxs

if($sign) {
signtool.exe sign /a /v /s MY /n "$sign" /fd SHA256 /du http://installer.id.ee `
Expand Down
2 changes: 1 addition & 1 deletion cmake
184 changes: 90 additions & 94 deletions libdigidocpp.wxs
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<?if $(sys.BUILDARCH) = x64 ?>
<?if $(sys.BUILDARCH) = x64 ?>
<?define UpgradeCode = "{93985BBA-6B59-443B-80C8-BA987407F8B8}" ?>
<?define LibrariesGuid = "{57A72AF6-5458-4106-BFC8-A611DAF89A59}" ?>
<?define LibrariesDevGuid = "{9B16F8D1-11AA-4AF4-B8C2-96B4EC7E79CD}" ?>
<?define SchemasGuid = "{C42EE645-286C-4B80-B73E-AF82B8D4D778}" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?define OpenSSLSuffix = "-x64" ?>
<?else?>
<?define UpgradeCode = "{7f1b1519-b527-4130-998d-233f4d050f14}" ?>
<?define LibrariesGuid = "{f730eb17-fafc-440a-88a8-e8795be746b1}" ?>
<?define LibrariesDevGuid = "{f2e01472-129f-4919-9d0a-5d8f49b4598f}" ?>
<?define SchemasGuid = "{66b852a2-68e1-4722-ab63-8e0625c0b3d7}" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?define OpenSSLSuffix = "" ?>
<?endif?>

Expand All @@ -25,118 +22,117 @@
<?define VCPKG = "$(var.vcpkg)\bin" ?>
<?define VCPKG_D = "$(var.vcpkg)\debug\bin" ?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Name="Libdigidocpp $(sys.BUILDARCH)" UpgradeCode="$(var.UpgradeCode)"
Id="*" Language="1033" Version="$(var.MSI_VERSION)" Manufacturer="RIA">
<Package Keywords="Installer" InstallerVersion="500" Compressed="yes"/>
<MediaTemplate EmbedCab="yes" CompressionLevel="high"/>
<Icon Id="ID.ico" SourceFile="$(var.ICON)"/>
<Property Id="ARPPRODUCTICON" Value="ID.ico"/>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
<Package Name="Libdigidocpp $(sys.BUILDARCH)" UpgradeCode="$(var.UpgradeCode)"
Language="1033" Version="$(var.MSI_VERSION)" Manufacturer="RIA" InstallerVersion="500">
<SummaryInformation Keywords="Installer" />
<MediaTemplate EmbedCab="yes" CompressionLevel="high" />
<Icon Id="ID.ico" SourceFile="$(var.ICON)" />
<Property Id="ARPPRODUCTICON" Value="ID.ico" />
<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage=
"A newer version of [ProductName] is already installed. If you are trying to downgrade, please uninstall the newer version first."/>
"A newer version of [ProductName] is already installed. If you are trying to downgrade, please uninstall the newer version first." />
<UI>
<UIRef Id="WixUI_Mondo" />
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg" Order="3">1</Publish>
<Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3">1</Publish>
<ui:WixUI Id="WixUI_Mondo" />
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg" Order="3" />
<Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3" />
</UI>

<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="$(var.PlatformProgramFilesFolder)">
<Directory Id="APPLICATIONFOLDER" Name="libdigidocpp"
FileSource="$(var.libdigidocpp)\bin">
<Component Id="Libraries" Guid="$(var.LibrariesGuid)">
<File Source="$(var.VCPATH)\msvcp140.dll"/>
<File Source="$(var.VCPATH)\msvcp140_1.dll"/>
<File Source="$(var.VCPATH)\msvcp140_2.dll"/>
<File Source="$(var.VCPATH)\vcruntime140.dll"/>
<StandardDirectory Id="ProgramFiles6432Folder">
<Directory Id="APPLICATIONFOLDER" Name="libdigidocpp"
FileSource="$(var.libdigidocpp)\bin">
<Component Id="Libraries" Guid="$(var.LibrariesGuid)">
<File Source="$(var.VCPATH)\msvcp140.dll" />
<File Source="$(var.VCPATH)\msvcp140_1.dll" />
<File Source="$(var.VCPATH)\msvcp140_2.dll" />
<File Source="$(var.VCPATH)\vcruntime140.dll" />
<?if $(sys.BUILDARCH) != x86 ?>
<File Source="$(var.VCPATH)\vcruntime140_1.dll"/>
<File Source="$(var.VCPATH)\vcruntime140_1.dll" />
<?endif?>
<File Source="$(var.VCPKG)\libcrypto-3$(var.OpenSSLSuffix).dll"/>
<File Source="$(var.VCPKG)\libssl-3$(var.OpenSSLSuffix).dll"/>
<File Source="$(var.VCPKG)\legacy.dll"/>
<File Source="$(var.VCPKG)\zlib1.dll"/>
<File Source="$(var.VCPKG)\xerces-c_3_2.dll"/>
<File Source="$(var.VCPKG)\Xalan-C_1_12.dll"/>
<File Source="$(var.VCPKG)\XalanMessages_1_12.dll"/>
<File Source="$(var.VCPKG)\xsec_2_0.dll"/>
<File Name="digidocpp.dll"/>
<File Name="digidoc-tool.exe"/>
<File Source="$(var.libdigidocpp)\etc\digidocpp\digidocpp.conf"/>
<File Source="$(var.VCPKG)\libcrypto-3$(var.OpenSSLSuffix).dll" />
<File Source="$(var.VCPKG)\libssl-3$(var.OpenSSLSuffix).dll" />
<File Source="$(var.VCPKG)\legacy.dll" />
<File Source="$(var.VCPKG)\zlib1.dll" />
<File Source="$(var.VCPKG)\xerces-c_3_2.dll" />
<File Source="$(var.VCPKG)\Xalan-C_1_12.dll" />
<File Source="$(var.VCPKG)\XalanMessages_1_12.dll" />
<File Source="$(var.VCPKG)\xsec_2_0.dll" />
<File Name="digidocpp.dll" />
<File Name="digidoc-tool.exe" />
<File Source="$(var.libdigidocpp)\etc\digidocpp\digidocpp.conf" />
<?ifdef var.swig ?>
<File Name="digidoc_csharp.dll"/>
<File Name="digidoc_java.dll"/>
<File Name="_digidoc_python.pyd"/>
<File Name="digidoc.py"/>
<File Name="digidoc_csharp.dll" />
<File Name="digidoc_java.dll" />
<File Name="_digidoc_python.pyd" />
<File Name="digidoc.py" />
<?endif?>
</Component>
<Component Id="LibrariesDev" Guid="$(var.LibrariesDevGuid)">
<File Source="$(var.VCPATH_D)\msvcp140d.dll"/>
<File Source="$(var.VCPATH_D)\msvcp140_1d.dll"/>
<File Source="$(var.VCPATH_D)\msvcp140_2d.dll"/>
<File Source="$(var.VCPATH_D)\vcruntime140d.dll"/>
</Component>
<Component Id="LibrariesDev" Guid="$(var.LibrariesDevGuid)">
<File Source="$(var.VCPATH_D)\msvcp140d.dll" />
<File Source="$(var.VCPATH_D)\msvcp140_1d.dll" />
<File Source="$(var.VCPATH_D)\msvcp140_2d.dll" />
<File Source="$(var.VCPATH_D)\vcruntime140d.dll" />
<?if $(sys.BUILDARCH) != x86 ?>
<File Source="$(var.VCPATH_D)\vcruntime140_1d.dll"/>
<File Source="$(var.VCPATH_D)\vcruntime140_1d.dll" />
<?endif?>
<File Source="$(var.VCPKG_D)\zlibd1.dll"/>
<File Source="$(var.VCPKG_D)\xerces-c_3_2D.dll"/>
<File Source="$(var.VCPKG_D)\Xalan-C_1_12D.dll"/>
<File Source="$(var.VCPKG_D)\XalanMessages_1_12D.dll"/>
<File Source="$(var.VCPKG_D)\xsec_2_0D.dll"/>
<File Name="digidoc-tool.pdb"/>
<File Name="digidocpp.lib"/>
<File Name="digidocpp.pdb"/>
<File Name="digidocppd.dll"/>
<File Name="digidocppd.lib"/>
<File Name="digidocppd.pdb"/>
<File Source="$(var.VCPKG_D)\zlibd1.dll" />
<File Source="$(var.VCPKG_D)\xerces-c_3_2D.dll" />
<File Source="$(var.VCPKG_D)\Xalan-C_1_12D.dll" />
<File Source="$(var.VCPKG_D)\XalanMessages_1_12D.dll" />
<File Source="$(var.VCPKG_D)\xsec_2_0D.dll" />
<File Name="digidoc-tool.pdb" />
<File Name="digidocpp.lib" />
<File Name="digidocpp.pdb" />
<File Name="digidocppd.dll" />
<File Name="digidocppd.lib" />
<File Name="digidocppd.pdb" />
<?ifdef var.swig ?>
<File Name="digidoc_csharp.pdb"/>
<File Name="digidoc_csharpd.dll"/>
<File Name="digidoc_csharpd.pdb"/>
<File Name="digidoc_java.pdb"/>
<File Name="digidoc_javad.dll"/>
<File Name="digidoc_javad.pdb"/>
<File Name="_digidoc_python.pdb"/>
<File Name="_digidoc_pythond.pyd"/>
<File Name="_digidoc_pythond.pdb"/>
<File Name="digidoc_csharp.pdb" />
<File Name="digidoc_csharpd.dll" />
<File Name="digidoc_csharpd.pdb" />
<File Name="digidoc_java.pdb" />
<File Name="digidoc_javad.dll" />
<File Name="digidoc_javad.pdb" />
<File Name="_digidoc_python.pdb" />
<File Name="_digidoc_pythond.pyd" />
<File Name="_digidoc_pythond.pdb" />
<?endif?>
</Component>
<Directory Id="SchemaFolder" Name="schema"
FileSource="$(var.libdigidocpp)\etc\digidocpp\schema">
<Component Id="Schemas" Guid="$(var.SchemasGuid)">
<File Name="xml.xsd" />
<File Name="conf.xsd" />
<File Name="OpenDocument_manifest.xsd" />
<File Name="OpenDocument_manifest_v1_2.xsd" />
<File Name="xmldsig-core-schema.xsd" />
<File Name="XAdES01903v132-201601.xsd" />
<File Name="XAdES01903v132-201601-relaxed.xsd" />
<File Name="XAdES01903v141-201601.xsd" />
<File Name="ts_119612v020201_201601xsd.xsd" />
<File Name="en_31916201v010101.xsd" />
<File Name="OpenDocument_dsig.xsd" />
</Component>
<Directory Id="SchemaFolder" Name="schema"
FileSource="$(var.libdigidocpp)\etc\digidocpp\schema">
<Component Id="Schemas" Guid="$(var.SchemasGuid)">
<File Name="xml.xsd"/>
<File Name="conf.xsd"/>
<File Name="OpenDocument_manifest.xsd"/>
<File Name="OpenDocument_manifest_v1_2.xsd"/>
<File Name="xmldsig-core-schema.xsd"/>
<File Name="XAdES01903v132-201601.xsd"/>
<File Name="XAdES01903v132-201601-relaxed.xsd"/>
<File Name="XAdES01903v141-201601.xsd"/>
<File Name="ts_119612v020201_201601xsd.xsd"/>
<File Name="en_31916201v010101.xsd"/>
<File Name="OpenDocument_dsig.xsd"/>
</Component>
</Directory>
<Directory Id="HeadersFolder" Name="include"/>
</Directory>
<Directory Id="HeadersFolder" Name="include" />
<?ifdef var.docLocation ?>
<Directory Id="DocumentationFolder" Name="documentation"/>
<Directory Id="DocumentationFolder" Name="documentation" />
<?endif?>
</Directory>
</Directory>
</Directory>

</StandardDirectory>
<Feature Id="InstallLibdigidocpp" Level="1" Title="Libdigidocpp" Display="expand" ConfigurableDirectory="APPLICATIONFOLDER">
<ComponentRef Id="Libraries"/>
<ComponentRef Id="Schemas"/>
<ComponentRef Id="Libraries" />
<ComponentRef Id="Schemas" />
<Feature Id="InstallDevel" Level="1" Title="Development">
<ComponentGroupRef Id="Headers"/>
<ComponentRef Id="LibrariesDev"/>
<ComponentGroupRef Id="Headers" />
<ComponentRef Id="LibrariesDev" />
</Feature>
<?ifdef var.docLocation ?>
<Feature Id="InstallDocumentation" Level="1" Title="Documentation">
<ComponentGroupRef Id="Documentation"/>
<ComponentGroupRef Id="Documentation" />
</Feature>
<?endif?>
</Feature>
</Product>
</Package>
</Wix>
12 changes: 5 additions & 7 deletions prepare_win_build_environment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ param(
[string]$vcpkg = "vcpkg\vcpkg.exe",
[string]$git = "git.exe",
[switch]$xsd = $false,
[switch]$wix = $false,
[switch]$dependencies = $false
)

function xsd() {
if($xsd) {
$client = new-object System.Net.WebClient
& mkdir xsd
foreach($xsdver in @("xsd-4.2.0-x86_64-windows10", "libxsd-4.2.0-windows")) {
Expand All @@ -17,8 +18,9 @@ function xsd() {
}
}

if($xsd) {
xsd
if($wix) {
& dotnet tool install --global wix
& wix extension add -g WixToolset.UI.wixext
}

if($dependencies) {
Expand All @@ -31,7 +33,3 @@ if($dependencies) {
& $vcpkg install --clean-after-build --triplet x64-windows --x-feature=tests --x-install-root=vcpkg_installed_x64
}

if(!$xsd -and !$dependencies) {
xsd
}

Loading