From 89cbbfc291d478d8d55e1abf15915ac9d67be49e Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 21 Nov 2022 21:30:24 -0600 Subject: [PATCH] Derive target architecture based on Qt path --- appveyor.yml | 4 ++-- scripts/build-arch.bat | 24 ++++++++++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ca3539b0..d2b40180 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -39,9 +39,9 @@ before_build: build_script: - cmd: 'set PATH=%OLDPATH%;%QTDIR%\msvc2019_64\bin;%ProgramFiles(x86)%\WiX Toolset v3.11\bin' - - cmd: 'scripts\build-arch.bat Release x64' + - cmd: 'scripts\build-arch.bat Release' - cmd: 'set PATH=%OLDPATH%;%QTDIR%\msvc2019\bin;%ProgramFiles(x86)%\WiX Toolset v3.11\bin' - - cmd: 'scripts\build-arch.bat Release x86' + - cmd: 'scripts\build-arch.bat Release' - cmd: 'scripts\generate-bundle.bat Release' - sh: '[ "$BUILD_TARGET" != linux ] || source /opt/qt515/bin/qt515-env.sh' - sh: '[ "$BUILD_TARGET" != linux ] || PATH=$PATH:$HOME/bin scripts/build-appimage.sh' diff --git a/scripts/build-arch.bat b/scripts/build-arch.bat index 9fe958e7..500cbb5d 100644 --- a/scripts/build-arch.bat +++ b/scripts/build-arch.bat @@ -4,7 +4,6 @@ setlocal enableDelayedExpansion rem Run from Qt command prompt with working directory set to root of repo set BUILD_CONFIG=%1 -set ARCH=%2 rem Convert to lower case for windeployqt if /I "%BUILD_CONFIG%"=="debug" ( @@ -28,22 +27,31 @@ if /I "%BUILD_CONFIG%"=="debug" ( ) ) else ( echo Invalid build configuration - expected 'debug' or 'release' - echo Usage: scripts\build-arch.bat ^(release^|debug^) ^(x86^|x64^|ARM64^) + echo Usage: scripts\build-arch.bat ^(release^|debug^) exit /b 1 ) ) ) -if /I "%ARCH%" NEQ "x86" ( - if /I "%ARCH%" NEQ "x64" ( - if /I "%ARCH%" NEQ "ARM64" ( - echo Invalid build architecture - expected 'x86', 'x64', or 'ARM64' - echo Usage: scripts\build-arch.bat ^(release^|debug^) ^(x86^|x64^|ARM64^) - exit /b 1 +rem Find Qt path to determine our architecture +for /F %%i in ('where qmake') do set QT_PATH=%%i +if not x%QT_PATH:_arm64=%==x%QT_PATH% ( + set ARCH=ARM64 +) else ( + if not x%QT_PATH:_64=%==x%QT_PATH% ( + set ARCH=x64 + ) else ( + if not x%QT_PATH:msvc=%==x%QT_PATH% ( + set ARCH=x86 + ) else ( + echo Unable to determine Qt architecture + goto Error ) ) ) +echo Detected target architecture: %ARCH% + set SIGNTOOL_PARAMS=sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /sha1 b28642b756ebec4884d1063dfa4de803a6dcecdc /v set BUILD_ROOT=%cd%\build