Skip to content

Commit

Permalink
Split Windows X86 and X64 installers (#581)
Browse files Browse the repository at this point in the history
IB-7921

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma committed Feb 26, 2024
1 parent 5e8a764 commit a6d5f78
Show file tree
Hide file tree
Showing 11 changed files with 164 additions and 263 deletions.
33 changes: 11 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ jobs:
strategy:
matrix:
toolset: [143, 142]
platform: [x86, x64]
include:
- toolset: 143
image: windows-2022
Expand All @@ -160,47 +161,35 @@ jobs:
uses: actions/checkout@v4
with:
submodules: recursive
- uses: mad9000/actions-find-and-replace-string@3
id: path
with:
source: ${{ github.workspace }}
find: '\'
replace: '/'
replaceAll: true
- name: Prepare vcpkg X64
- name: Prepare vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: 18b028fe785e707265fa0e35590b7537ae1d12ea
vcpkgJsonGlob: ${{ steps.path.outputs.value }}/vcpkg.json
vcpkgJsonGlob: ./vcpkg.json
runVcpkgInstall: true
runVcpkgFormatString: "[`install`, `--recurse`, `--clean-after-build`, `--x-install-root`, `$[env.VCPKG_INSTALLED_DIR]`, `--triplet`, `$[env.VCPKG_DEFAULT_TRIPLET]`, `--x-feature`, `tests`]"
env:
VCPKG_DEFAULT_TRIPLET: x64-windows-v${{ matrix.toolset }}
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg_installed
- name: Prepare vcpkg X86
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: 18b028fe785e707265fa0e35590b7537ae1d12ea
vcpkgJsonGlob: ${{ steps.path.outputs.value }}/vcpkg.json
runVcpkgInstall: true
runVcpkgFormatString: "[`install`, `--recurse`, `--clean-after-build`, `--x-install-root`, `$[env.VCPKG_INSTALLED_DIR]`, `--triplet`, `$[env.VCPKG_DEFAULT_TRIPLET]`, `--x-feature`, `tests`]"
env:
VCPKG_DEFAULT_TRIPLET: x86-windows-v${{ matrix.toolset }}
VCPKG_DEFAULT_TRIPLET: ${{ matrix.platform }}-windows
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg_installed
- name: Install dependencies
run: choco install doxygen.install swig -y > $null
- uses: actions/setup-python@v4
with:
python-version: 3.11
architecture: x86
architecture: ${{ matrix.platform }}
- name: Build xsd
run: .\prepare_win_build_environment.ps1 -xsd
- name: Setup dev env
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.platform }}
- name: Build
run: |
& .\build.ps1 `
-msiversion $env:VERSION `
-toolset ${{ matrix.toolset }} `
-vcpkg_installed ${{ github.workspace }}/vcpkg_installed `
-vcvars "${{ matrix.vcvars }}" `
-platform ${{ matrix.platform }} `
-swig C:/ProgramData/chocolatey/bin/swig.exe `
-doxygen "C:/Program files/doxygen/bin/doxygen.exe" `
-boost
Expand Down
77 changes: 27 additions & 50 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,83 +6,60 @@ param(
[string]$vcpkg_installed = $libdigidocpp,
[string]$buildver = "0",
[string]$msiversion = "3.18.0.$buildver",
[string]$msi_name = "libdigidocpp-$msiversion$env:VER_SUFFIX.msi",
[string]$platform = "x64",
[string]$msi_name = "libdigidocpp-$msiversion$env:VER_SUFFIX.$platform.msi",
[string]$cmake = "cmake.exe",
[string]$generator = "NMake Makefiles",
[string]$toolset = "142",
[string]$vcvars = $null,
[string]$vcver = "",
[string]$heat = "$env:WIX\bin\heat.exe",
[string]$candle = "$env:WIX\bin\candle.exe",
[string]$light = "$env:WIX\bin\light.exe",
[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]$swig = $null,
[string]$doxygen = $null,
[switch]$boost = $false,
[string]$xsd = "$libdigidocpp\xsd",
[string]$sign = $null,
[string]$crosssign = $null,
[switch]$source = $false
[string]$sign = $null
)

if (!$vcvars) {
switch ($toolset) {
'142' { $vcvars = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" }
'143' { $vcvars = "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" }
}
}
if ($vcver) {
$vcver = "-vcvars_ver=$vcver"
}

$cmakeext = @()
$candleext = @()
$lightext = @()
$target = @("all")
if($swig) {
$cmakeext += "-DSWIG_EXECUTABLE=$swig"
$candleext += "-dswig=$swig"
}
if($doxygen) {
$cmakeext += "-DDOXYGEN_EXECUTABLE=$doxygen"
$candleext += "-ddocLocation=x86/share/doc/libdigidocpp", "DocFilesFragment.wxs"
$candleext += "-ddocLocation=$platform/share/doc/libdigidocpp", "DocFilesFragment.wxs"
$lightext += "DocFilesFragment.wixobj"
}
if($boost) {
$cmakeext += "-DVCPKG_MANIFEST_FEATURES=tests"
}
if($source) {
Remove-Item source -Force -Recurse
New-Item -ItemType directory -Path source > $null
Get-ChildItem -Path $libdigidocpp | % { Copy-Item $_.fullname source -Recurse -Force -Exclude build,doc,.git }
& $heat dir source -nologo -cg Source -gg -scom -sreg -sfrag -srd -dr SourceFolder -var var.sourceLocation -out SourceFilesFragment.wxs
$candleext += "-dsourceLocation=source", "SourceFilesFragment.wxs"
$lightext += "SourceFilesFragment.wixobj"
$target += "check"
}

foreach($platform in @("x86", "x64")) {
foreach($type in @("Debug", "RelWithDebInfo")) {
$buildpath = $platform+$type
Remove-Item $buildpath -Force -Recurse -ErrorAction Ignore
& $vcvars $platform $vcver "&&" $cmake -B $buildpath -S $libdigidocpp "-G$generator" `
"-DCMAKE_BUILD_TYPE=$type" `
"-DCMAKE_INSTALL_PREFIX=$platform" `
"-DCMAKE_INSTALL_LIBDIR=bin" `
"-DCMAKE_TOOLCHAIN_FILE=$vcpkg_dir/scripts/buildsystems/vcpkg.cmake" `
"-DVCPKG_TARGET_TRIPLET=$platform-windows-v$toolset" `
"-DVCPKG_INSTALLED_DIR=$vcpkg_installed\vcpkg_installed_$platform" `
"-DXSD_ROOT=$xsd" `
"-DSIGNCERT=$sign" `
"-DCROSSSIGNCERT=$crosssign" `
$cmakeext "&&" $cmake --build $buildpath --target check "&&" $cmake --build $buildpath --target install
}
foreach($type in @("Debug", "RelWithDebInfo")) {
$buildpath = $platform+$type
& $vcvars $platform "&&" $cmake --fresh -B $buildpath -S $libdigidocpp "-G$generator" `
"-DCMAKE_BUILD_TYPE=$type" `
"-DCMAKE_INSTALL_PREFIX=$platform" `
"-DCMAKE_INSTALL_LIBDIR=bin" `
"-DCMAKE_TOOLCHAIN_FILE=$vcpkg_dir/scripts/buildsystems/vcpkg.cmake" `
"-DVCPKG_INSTALLED_DIR=$vcpkg_installed\vcpkg_installed_$platform" `
"-DXSD_ROOT=$xsd" `
"-DSIGNCERT=$sign" `
$cmakeext "&&" $cmake --build $buildpath --target $target "&&" $cmake --install $buildpath
}

if($doxygen) {
& $heat dir x86/share/doc/libdigidocpp -nologo -cg Documentation -gg -scom -sreg -sfrag -srd -dr DocumentationFolder -var var.docLocation -out DocFilesFragment.wxs
& $heat dir $platform/share/doc/libdigidocpp -nologo -cg Documentation -gg -scom -sreg -sfrag -srd -dr DocumentationFolder -var var.docLocation -out DocFilesFragment.wxs
}
& $heat dir x86/include -nologo -cg Headers -gg -scom -sreg -sfrag -srd -dr HeadersFolder -var var.headersLocation -out HeadersFragment.wxs
& $vcvars x86 "&&" $candle -nologo "-dICON=$libdigidocpp/cmake/modules/ID.ico" "-dMSI_VERSION=$msiversion" `
"-dvcpkg_x86=$vcpkg_installed\vcpkg_installed_x86\x86-windows-v$toolset" "-dvcpkg_x64=$vcpkg_installed\vcpkg_installed_x64\x64-windows-v$toolset" `
"-dheadersLocation=x86/include" "-dlibdigidocpp=." $candleext $libdigidocpp\libdigidocpp.wxs HeadersFragment.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" `
Expand Down
Loading

0 comments on commit a6d5f78

Please sign in to comment.