From 00f82602d2d71e86e3d5654bf07537a6f5fe199c Mon Sep 17 00:00:00 2001 From: hunbernd Date: Mon, 24 Jan 2022 22:28:01 +0100 Subject: [PATCH] Added support for other msys2 environments --- build_scripts/Windows-msys2/build/build.bat | 1 + .../Windows-msys2/build/env-base.bat | 76 ++++++++++++++----- build_scripts/Windows-msys2/build/env.bat | 8 +- 3 files changed, 60 insertions(+), 25 deletions(-) diff --git a/build_scripts/Windows-msys2/build/build.bat b/build_scripts/Windows-msys2/build/build.bat index 4d366f28c..c9ad27f9f 100644 --- a/build_scripts/Windows-msys2/build/build.bat +++ b/build_scripts/Windows-msys2/build/build.bat @@ -66,6 +66,7 @@ echo %RS_QMAKE_CONFIG% > buildinfo.txt echo %RsBuildConfig% >> buildinfo.txt echo %RsArchitecture% >> buildinfo.txt echo Qt %QtVersion% >> buildinfo.txt +echo %RsToolchain% >> buildinfo.txt echo %RsCompiler% >> buildinfo.txt call "%ToolsPath%\msys2-path.bat" "%SourcePath%" MSYS2SourcePath diff --git a/build_scripts/Windows-msys2/build/env-base.bat b/build_scripts/Windows-msys2/build/env-base.bat index 9d9fa5379..883884262 100644 --- a/build_scripts/Windows-msys2/build/env-base.bat +++ b/build_scripts/Windows-msys2/build/env-base.bat @@ -1,6 +1,4 @@ :: Process commandline parameter -set Param32=0 -set Param64=0 set ParamRelease=0 set ParamDebug=0 set ParamAutologin=0 @@ -12,14 +10,36 @@ set ParamIndexing=0 set ParamNoupdate=0 set CoreCount=%NUMBER_OF_PROCESSORS% set RS_QMAKE_CONFIG= +set RsToolchain= +set tcc=0 :parameter_loop if "%~1" NEQ "" ( for /f "tokens=1,2 delims==" %%a in ("%~1") do ( if "%%~a"=="32" ( - set Param32=1 + set RsToolchain=mingw32 + set /A tcc=tcc+1 ) else if "%%~a"=="64" ( - set Param64=1 + set RsToolchain=mingw64 + set /A tcc=tcc+1 + ) else if "%%~a"=="mingw32" ( + set RsToolchain=mingw32 + set /A tcc=tcc+1 + ) else if "%%~a"=="mingw64" ( + set RsToolchain=mingw64 + set /A tcc=tcc+1 + ) else if "%%~a"=="ucrt64" ( + set RsToolchain=ucrt64 + set /A tcc=tcc+1 + ) else if "%%~a"=="clang64" ( + set RsToolchain=clang64 + set /A tcc=tcc+1 + ) else if "%%~a"=="clang32" ( + set RsToolchain=clang32 + set /A tcc=tcc+1 + ) else if "%%~a"=="clangarm64" ( + set RsToolchain=clangarm64 + set /A tcc=tcc+1 ) else if "%%~a"=="release" ( set ParamRelease=1 ) else if "%%~a"=="debug" ( @@ -52,22 +72,37 @@ if "%~1" NEQ "" ( goto parameter_loop ) -if "%Param32%"=="1" ( - if "%Param64%"=="1" ( - echo. - echo 32-bit or 64-bit? - goto :usage - ) - - set RsBit=32 - set RsArchitecture=x86 - set RsMSYS2Architecture=i686 +if %tcc% NEQ 1 ( + echo Multiple or no toolchain specified + goto :usage ) -if "%Param64%"=="1" ( - set RsBit=64 +if "%RsToolchain%"=="mingw32" ( + set RsArchitecture=x86 + set RsMSYS2Architecture=i686 + set MSYSTEM=MINGW32 +) else if "%RsToolchain%"=="mingw64" ( set RsArchitecture=x64 set RsMSYS2Architecture=x86_64 + set MSYSTEM=MINGW64 +) else if "%RsToolchain%"=="ucrt64" ( + set RsArchitecture=x64 + set RsMSYS2Architecture=ucrt-x86_64 + set MSYSTEM=UCRT64 +) else if "%RsToolchain%"=="clang64" ( + set RsArchitecture=x64 + set RsMSYS2Architecture=clang-x86_64 + set MSYSTEM=CLANG64 + set ParamClang=1 +) else if "%RsToolchain%"=="clang32" ( + set RsArchitecture=x86 + set RsMSYS2Architecture=clang-i686 + set MSYSTEM=CLANG32 + set ParamClang=1 +) else if "%RsToolchain%"=="clangarm64" ( + set RsArchitecture=arm64 + set RsMSYS2Architecture=clang-aarch64 + set MSYSTEM=CLANGARM64 ) if "%ParamClang%"=="1" ( @@ -76,8 +111,6 @@ if "%ParamClang%"=="1" ( set RsCompiler=GCC ) -if "%RsBit%"=="" goto :usage - if "%ParamRelease%"=="1" ( if "%ParamDebug%"=="1" ( echo. @@ -108,10 +141,13 @@ exit /B 0 :usage echo. -echo Usage: 32^|64 release^|debug [autologin plugins webui singlethread clang indexing noupdate] ["CONFIG+=..."] +echo Usage: 32^|64^|other release^|debug [autologin plugins webui singlethread clang indexing noupdate] ["CONFIG+=..."] echo. echo Mandatory parameter -echo 32^|64 32-bit or 64-bit Version +echo 32^|64 32-bit or 64-bit version (same as mingw32 or mingw64) +echo Or you can specify any other toolchain supported by msys2: +echo mingw32^|mingw64^|clang32^|clang64^|ucrt64^|clangarm64 +echo More info: https://www.msys2.org/docs/environments echo release^|debug Build release or debug version echo. echo Optional parameter (need clean when changed) diff --git a/build_scripts/Windows-msys2/build/env.bat b/build_scripts/Windows-msys2/build/env.bat index bfe2afeba..c8cb71ff4 100644 --- a/build_scripts/Windows-msys2/build/env.bat +++ b/build_scripts/Windows-msys2/build/env.bat @@ -2,8 +2,6 @@ call "%~dp0env-base.bat" %* if errorlevel 2 exit /B 2 if errorlevel 1 goto error_env -set MSYSTEM=MINGW%RsBit% - set BuildPath=%EnvRootPath%\builds set DeployPath=%EnvRootPath%\deploy @@ -14,10 +12,10 @@ if not exist "%DeployPath%" mkdir "%DeployPath%" call "%ToolsPath%\get-qt-version.bat" QtVersion if "%QtVersion%"=="" %cecho% error "Cannot get Qt version." & exit /B 1 -set RsMinGWPath=%EnvMSYS2BasePath%\mingw%RsBit% +set RsMinGWPath=%EnvMSYS2BasePath%\%RsToolchain% -set RsBuildPath=%BuildPath%\Qt-%QtVersion%-%RsArchitecture%-%RsCompiler%-%RsBuildConfig% -set RsDeployPath=%DeployPath%\Qt-%QtVersion%%RsType%-%RsArchitecture%-%RsCompiler%-%RsBuildConfig% +set RsBuildPath=%BuildPath%\Qt-%QtVersion%-%RsToolchain%-%RsCompiler%-%RsBuildConfig% +set RsDeployPath=%DeployPath%\Qt-%QtVersion%%RsType%-%RsToolchain%-%RsCompiler%-%RsBuildConfig% set RsPackPath=%DeployPath% set RsArchiveAdd= set RsWebuiPath=%RootPath%\%SourceName%-webui