2016-09-06 15:31:41 -04:00
|
|
|
:: Usage:
|
2017-02-27 02:16:48 -05:00
|
|
|
:: call get-gcc-version.bat version architecture
|
2016-09-06 15:31:41 -04:00
|
|
|
|
|
|
|
setlocal
|
|
|
|
|
2017-02-27 02:16:48 -05:00
|
|
|
set VarVersion=%~1
|
|
|
|
if "%VarVersion%"=="" (
|
|
|
|
echo.
|
|
|
|
echo Parameter error.
|
|
|
|
exit /B 1
|
|
|
|
)
|
|
|
|
|
|
|
|
set VarArchitecture=%~2
|
|
|
|
if "%VarArchitecture%"=="" (
|
2016-09-06 15:31:41 -04:00
|
|
|
echo.
|
|
|
|
echo Parameter error.
|
|
|
|
exit /B 1
|
|
|
|
)
|
|
|
|
|
|
|
|
set GCCVersion=
|
2017-02-27 02:16:48 -05:00
|
|
|
set GCCArchitecture=
|
2020-08-03 12:14:32 -04:00
|
|
|
set _Architecture=
|
2016-09-06 15:31:41 -04:00
|
|
|
|
|
|
|
call "%~dp0find-in-path.bat" GCCPath gcc.exe
|
|
|
|
if "%GCCPath%"=="" (
|
|
|
|
echo.
|
|
|
|
echo Cannot find gcc.exe in PATH.
|
2020-08-03 12:14:32 -04:00
|
|
|
exit /B 1
|
2016-09-06 15:31:41 -04:00
|
|
|
)
|
|
|
|
|
2020-08-03 12:14:32 -04:00
|
|
|
for /F "tokens=1-8* delims= " %%A in ('gcc --version') do if "%%A"=="gcc" set _Architecture=%%B& set GCCVersion=%%G
|
2016-09-06 15:31:41 -04:00
|
|
|
|
2017-02-27 02:16:48 -05:00
|
|
|
if "%_Architecture:~1,4%"=="i686" set GCCArchitecture=x86
|
|
|
|
if "%_Architecture:~1,6%"=="x86_64" set GCCArchitecture=x64
|
2020-08-03 12:14:32 -04:00
|
|
|
|
|
|
|
endlocal & set %VarVersion%=%GCCVersion%& set %VarArchitecture%=%GCCArchitecture%
|
|
|
|
exit /B 0
|