From d62bec58ed5adc7b50dfb5ca82a06d07bf412a8d Mon Sep 17 00:00:00 2001 From: prodea2 Date: Sat, 25 Mar 2017 16:41:34 +0200 Subject: [PATCH] Build script fixes: - ensure all variables are defined, supports Mesa quick rebuilds; - properly load VS2015 fallback environment with VS2017. It was working just because we were lucky. --- buildscript/build.cmd | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/buildscript/build.cmd b/buildscript/build.cmd index c767452b..e9917687 100644 --- a/buildscript/build.cmd +++ b/buildscript/build.cmd @@ -10,10 +10,10 @@ @if %abi%==x64 set minabi=64 @set vsenv=%ProgramFiles% @if NOT "%ProgramW6432%"=="" set vsenv=%vsenv% (x86) -@set vsenv=%vsenv%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars%minabi%.bat -@if EXIST "%vsenv%" @set toolchain=Visual Studio 15 2017 -@if NOT EXIST "%vsenv%" @set toolchain=Visual Studio 14 -@if NOT EXIST "%vsenv%" @set vsenv=%VS140COMNTOOLS%..\..\VC\bin\vcvars%minabi%.bat +@set vsenv15=%vsenv%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars%minabi%.bat +@if EXIST "%vsenv15%" @set toolchain=Visual Studio 15 2017 +@if NOT EXIST "%vsenv15%" @set toolchain=Visual Studio 14 +@set vsenv14=%VS140COMNTOOLS%..\..\VC\bin\vcvars%minabi%.bat @if %abi%==x64 @set toolchain=%toolchain% Win64 @set gcc=%mesa%mingw-w64-%abi%\mingw%minabi%\bin @set vsenvloaded=0 @@ -27,6 +27,8 @@ @RD /S /Q cmake-%abi% @md cmake-%abi% @cd cmake-%abi% +@if EXIST "%vsenv15%" set vsenv=%vsenv15% +@if NOT EXIST "%vsenv15%" set vsenv=%vsenv14% @set vsenvloaded=1 @call "%vsenv%" @set PATH=%mesa%cmake\%abi%\bin\;%PATH% @@ -59,8 +61,8 @@ @cd "%mesa%mesa" @RD /S /Q build\windows-%longabi% @set /p openswr=Do you want to build OpenSWR drivers? (y=yes): -@set buildswr= -@if /i %openswr%==y @set buildswr=swr=1 +@set buildswr=0 +@if /i %openswr%==y @set buildswr=1 @set mingw=n @set mingwtest=0 @if EXIST "%gcc%" @set mingwtest=1 @@ -68,7 +70,8 @@ @set msys2=%mesa%msys64\msys2_shell.cmd @if EXIST "%msys2%" @set mingwtest=%mingwtest%2 @rem if %mingwtest%==12 @set /p mingw=Do you want to build with MinGW-W64 instead of Visual Studio (y=yes): -@set buildmingw= +@set mesatoolchain=default +@set restartcond=0 @set PATH=%mesa%Python\%abi%\;%mesa%Python\%abi%\Scripts\;%mesa%flexbison\;%mesa%m4\%abi%\usr\bin\;%PATH% @pip install -U mako @pip freeze > requirements.txt @@ -77,7 +80,7 @@ @if /i NOT %mingw%==y GOTO build_with_vs :build_with_mingw -@set buildmingw=toolchain=crossmingw +@set mesatoolchain=crossmingw @copy "%gcc%\%altabi%-w64-mingw32-gcc-ar.exe" "%gcc%\%altabi%-w64-mingw32-ar.exe" @copy "%gcc%\%altabi%-w64-mingw32-gcc-ranlib.exe" "%gcc%\%altabi%-w64-mingw32-ranlib.exe" @call "%msys2%" -use-full-path @@ -91,12 +94,20 @@ pip freeze > requirements.txt pip install -r requirements.txt --upgrade cd $mesa cd mesa -scons build=release platform=windows machine=x86 toolchain=crossmingw libgl-gdi -@GOTO exit +@GOTO build_mesa_exec :build_with_vs -@if %vsenvloaded%==0 call "%vsenv%" -@cmd /k "scons build=release platform=windows machine=%longabi% %buildmingw% %buildswr% libgl-gdi" +@if %vsenvloaded%==0 call "%vsenv14%" +@if %vsenvloaded%==1 @set restartcond=1 +@if EXIST "%vsenv15%" @set restartcond=%restartcond%2 +@if %restartcond%==12 ( +@echo "A Visual Studio build environment is already loaded. The script will now restart to flush loaded environment. +@pause +@GOTO exit +) + +:build_mesa_exec +@cmd /k "scons build=release platform=windows machine=%longabi% toolchain=%mesatoolchain% swr=%buildswr% libgl-gdi" :exit exit \ No newline at end of file