|
1 | 1 | #powershell -ExecutionPolicy ByPass -File build.ps1 |
2 | 2 | param( |
3 | 3 | [string]$libdigidocpp = $PSScriptRoot, |
4 | | - [string]$platform = "x64", |
| 4 | + [string]$platform = $env:VSCMD_ARG_TGT_ARCH, |
| 5 | + [string]$build_number = $(if ($null -eq $env:BUILD_NUMBER) {"0"} else {$env:BUILD_NUMBER}), |
| 6 | + [string]$msiversion = "4.1.0.$build_number", |
| 7 | + [string]$msi_name = "libdigidocpp-$msiversion$env:VER_SUFFIX.$platform.msi", |
5 | 8 | [string]$git = "git.exe", |
6 | 9 | [string]$vcpkg = "vcpkg\vcpkg.exe", |
7 | 10 | [string]$vcpkg_dir = (split-path -parent $vcpkg), |
8 | 11 | [string]$vcpkg_installed = $libdigidocpp, |
9 | 12 | [string]$vcpkg_installed_platform = "$vcpkg_installed\vcpkg_installed_$platform", |
10 | | - [string]$build_number = $(if ($null -eq $env:BUILD_NUMBER) {"0"} else {$env:BUILD_NUMBER}), |
11 | | - [string]$msiversion = "4.1.0.$build_number", |
12 | | - [string]$msi_name = "libdigidocpp-$msiversion$env:VER_SUFFIX.$platform.msi", |
| 13 | + [string]$vcpkg_triplet = "$platform-windows", |
13 | 14 | [string]$cmake = "cmake.exe", |
14 | 15 | [string]$generator = "NMake Makefiles", |
15 | | - [string]$vcvars = "vcvarsall", |
16 | 16 | [string]$swig = $null, |
17 | 17 | [string]$doxygen = $null, |
18 | 18 | [switch]$boost = $false, |
@@ -43,40 +43,49 @@ if($doxygen) { |
43 | 43 | $cmakeext += "-DDOXYGEN_EXECUTABLE=$doxygen" |
44 | 44 | $wixext += "-d", "docLocation=$(Get-Location)/$platform/share/doc/libdigidocpp" |
45 | 45 | } |
| 46 | +if($env:VSCMD_ARG_HOST_ARCH -ne "arm64") { |
| 47 | + $cmakeext += "-DCMAKE_DISABLE_FIND_PACKAGE_Python3=yes" |
| 48 | + $wixext += "-d", "disablePython=1" |
| 49 | + if($platform -eq "arm64") { |
| 50 | + $boost = $false |
| 51 | + } |
| 52 | +} |
46 | 53 | if($boost) { |
47 | 54 | $cmakeext += "-DVCPKG_MANIFEST_FEATURES=tests" |
48 | 55 | $target += "check" |
49 | 56 | } |
50 | 57 |
|
51 | 58 | foreach($type in @("Debug", "RelWithDebInfo")) { |
52 | 59 | $buildpath = $platform+$type |
53 | | - & $vcvars $platform "&&" $cmake --fresh -B $buildpath -S $libdigidocpp "-G$generator" ` |
| 60 | + & $cmake --fresh -B $buildpath -S $libdigidocpp "-G$generator" $cmakeext ` |
54 | 61 | "-DCMAKE_BUILD_TYPE=$type" ` |
55 | 62 | "-DCMAKE_INSTALL_PREFIX=$platform" ` |
56 | 63 | "-DCMAKE_INSTALL_LIBDIR=bin" ` |
57 | 64 | "-DCMAKE_TOOLCHAIN_FILE=$vcpkg_dir/scripts/buildsystems/vcpkg.cmake" ` |
58 | 65 | "-DVCPKG_INSTALLED_DIR=$vcpkg_installed_platform" ` |
59 | | - "-DSIGNCERT=$sign" ` |
60 | | - $cmakeext "&&" $cmake --build $buildpath --target $target "&&" $cmake --install $buildpath |
| 66 | + "-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet" ` |
| 67 | + "-DSIGNCERT=$sign" |
| 68 | + & $cmake --build $buildpath --target $target |
| 69 | + & $cmake --install $buildpath |
61 | 70 | } |
62 | 71 |
|
63 | 72 | if($sign) { |
64 | | - & $vcvars $platform "&&" signtool.exe sign /a /v /s MY /n "$sign" /fd SHA256 /du http://installer.id.ee ` |
| 73 | + & signtool.exe sign /a /v /s MY /n "$sign" /fd SHA256 /du http://installer.id.ee ` |
65 | 74 | /tr http://timestamp.digicert.com /td SHA256 ` |
66 | | - $vcpkg_installed_platform/$platform-windows/bin/*.dll ` |
67 | | - $vcpkg_installed_platform/$platform-windows/debug/bin/*.dll |
| 75 | + $vcpkg_installed_platform/$vcpkg_triplet/bin/*.dll ` |
| 76 | + $vcpkg_installed_platform/$vcpkg_triplet/debug/bin/*.dll |
68 | 77 | } |
69 | 78 |
|
70 | | -& $vcvars $platform "&&" wix build -nologo -arch $platform -out $msi_name $wixext ` |
| 79 | +& wix build -nologo -arch $platform -out $msi_name $wixext ` |
71 | 80 | -ext WixToolset.UI.wixext ` |
72 | 81 | -bv "WixUIBannerBmp=$libdigidocpp/banner.bmp" ` |
73 | 82 | -bv "WixUIDialogBmp=$libdigidocpp/dlgbmp.bmp" ` |
74 | 83 | -d "ICON=$libdigidocpp/ID.ico" ` |
75 | | - -d "vcpkg=$vcpkg_installed_platform/$platform-windows" ` |
| 84 | + -d "vcpkg=$vcpkg_installed_platform/$vcpkg_triplet" ` |
76 | 85 | -d "libdigidocpp=$(Get-Location)/$platform" ` |
77 | 86 | $libdigidocpp\libdigidocpp.wxs |
78 | 87 |
|
79 | 88 | if($sign) { |
80 | | - & $vcvars $platform "&&" signtool.exe sign /a /v /s MY /n "$sign" /fd SHA256 /du http://installer.id.ee ` |
| 89 | + & signtool.exe sign /a /v /s MY /n "$sign" /fd SHA256 /du http://installer.id.ee ` |
81 | 90 | /tr http://timestamp.digicert.com /td SHA256 "$msi_name" |
82 | 91 | } |
0 commit comments