RetroShare/build_scripts/Windows/build/env.bat

106 lines
2.6 KiB
Batchfile
Raw Normal View History

2018-06-17 11:51:58 -04:00
:: Process commandline parameter
set ParamRelease=0
set ParamDebug=0
set ParamVersion=0
set ParamAutologin=0
set ParamPlugins=0
set ParamTor=0
:parameter_loop
if "%~1" NEQ "" (
for /f "tokens=1,2 delims==" %%a in ("%~1") do (
if "%%~a"=="release" (
set ParamRelease=1
) else if "%%~a"=="debug" (
set ParamDebug=1
) else if "%%~a"=="version" (
set ParamVersion=1
) else if "%%~a"=="autologin" (
set ParamAutologin=1
) else if "%%~a"=="plugins" (
set ParamPlugins=1
) else if "%%~a"=="tor" (
set ParamTor=1
) else (
echo.
echo Unknown parameter %1
goto :usage
)
)
shift /1
goto parameter_loop
)
if "%ParamRelease%"=="1" (
if "%ParamDebug%"=="1" (
echo.
2018-06-17 11:51:58 -04:00
echo Release or Debug?
goto :usage
)
2018-06-17 11:51:58 -04:00
set RsBuildConfig=release
) else if "%ParamDebug%"=="1" (
set RsBuildConfig=debug
) else goto :usage
if "%ParamTor%"=="1" (
set RsType=-tor
) else (
set RsType=
)
set BuildPath=%EnvRootPath%\builds
set DeployPath=%EnvRootPath%\deploy
if not exist "%BuildPath%" mkdir "%BuildPath%"
if not exist "%DeployPath%" mkdir "%DeployPath%"
:: Check Qt environment
set QtPath=
call "%ToolsPath%\find-in-path.bat" QtPath qmake.exe
2018-05-07 00:42:52 -04:00
if "%QtPath%"=="" %cecho% error "Please run command in the Qt Command Prompt." & exit /B 1
:: Check MinGW environment
set MinGWPath=
call "%ToolsPath%\find-in-path.bat" MinGWPath gcc.exe
2018-05-07 00:42:52 -04:00
if "%MinGWPath%"=="" %cecho% error "Please run command in the Qt Command Prompt." & exit /B 1
:: Get Qt version
call "%ToolsPath%\get-qt-version.bat" QtVersion
2018-05-07 00:42:52 -04:00
if "%QtVersion%"=="" %cecho% error "Cannot get Qt version." & exit /B 1
:: Get gcc versions
call "%ToolsPath%\get-gcc-version.bat" GCCVersion
if "%GCCVersion%"=="" %cecho% error "Cannot get gcc version." & exit /B 1
set BuildLibsPath=%EnvRootPath%\build-libs\gcc-%GCCVersion%
2018-06-17 11:51:58 -04:00
set RsBuildPath=%BuildPath%\Qt-%QtVersion%-%RsBuildConfig%
set RsDeployPath=%DeployPath%\Qt-%QtVersion%%RsType%-%RsBuildConfig%
set RsPackPath=%DeployPath%
set RsArchiveAdd=
2016-10-04 15:45:59 -04:00
if not exist "%~dp0env-mod.bat" goto no_mod
call "%~dp0env-mod.bat"
if errorlevel 1 exit /B %ERRORLEVEL%
2016-10-04 15:45:59 -04:00
:no_mod
2018-06-17 11:51:58 -04:00
exit /B 0
:usage
echo.
echo Usage: release^|debug [version autologin plugins]
echo.
echo Mandatory parameter
echo release^|debug Build release or debug version
echo.
echo Optional parameter (need clean when changed)
echo version Create version information from git
echo autologin Build with autologin
echo plugins Build plugins
echo.
echo Parameter for pack
echo tor Pack tor version
echo.
exit /B 2