Skip to content

Commit

Permalink
Build script: Allow cancel build if LLVM is missing
Browse files Browse the repository at this point in the history
Code cleanup. Use double if statements instead of temp variables.
  • Loading branch information
pal1000 committed Feb 27, 2018
1 parent fc5f84a commit 0ea701c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion buildenvconf.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Version | 2.7.14
ARCH | x64
pip version | 9.0.1
setuptools version | 38.5.1
pywin32 / pywin32 version | 222
pywin32 / pywin32 version | 223
scons version | 3.0.1
Mako version | 1.0.7
MarkupSafe version | 1.0
Expand Down
39 changes: 18 additions & 21 deletions buildscript/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
:build_llvm
@if EXIST %mesa%\llvm set /p buildllvm=Begin LLVM build. Only needs to run once for each ABI and version. Proceed (y/n):
@if /I NOT "%buildllvm%"=="y" GOTO prep_mesa
@echo.
@if EXIST %mesa%\llvm echo.
@cd %mesa%\llvm
@if EXIST %abi% RD /S /Q %abi%
@if EXIST cmake-%abi% RD /S /Q cmake-%abi%
Expand All @@ -64,10 +64,7 @@
@if /I "%ninja%"=="y" set PATH=%mesa%\ninja\;%PATH%
@if %abi%==x64 set toolchain=%toolchain% Win64
@if "%toolchain%"=="Ninja Win64" set toolchain=Ninja
@set x64compile=n
@if %hostabi%==amd64 set x64compile=1
@if /I NOT "%ninja%"=="y" set x64compile=%x64compile%2
@if %x64compile%==12 set x64compiler= -Thost=x64
@if /I NOT "%ninja%"=="y" if %hostabi%==amd64 set x64compiler= -Thost=x64
@set llvmbuildsys=%CD%
@if "%toolchain%"=="Ninja" call %vsenv%
@if "%toolchain%"=="Ninja" cd %llvmbuildsys%
Expand Down Expand Up @@ -95,16 +92,15 @@
@echo Error: Git not found. Auto-patching disabled.
@set prepfail=1
)
@if NOT EXIST mesa if %prepfail%==1 echo Fatal: Both Mesa code and Git are missing. At least one is required. Execution halted.
@if NOT EXIST mesa if %prepfail%==1 GOTO distcreate
@if NOT EXIST mesa echo Warning: Mesa3D source code not found.
@if NOT EXIST mesa set prepfail=%prepfail%2
@if %prepfail% EQU 12 echo Fatal: Both Mesa code and Git are missing. At least one is required. Execution halted.
@if %prepfail% EQU 12 GOTO exit
@if NOT EXIST mesa set /p haltmesabuild=Press Y to abort execution. Press any other key to download Mesa via Git:
@if /I "%haltmesabuild%"=="y" GOTO exit
@if /I "%haltmesabuild%"=="y" GOTO distcreate
@if NOT EXIST mesa set branch=master
@if NOT EXIST mesa set /p branch=Enter Mesa source code branch name - defaults to master:
@if NOT EXIST mesa echo.
@if NOT EXIST mesa git clone --depth=1 --branch=%branch% git://anongit.freedesktop.org/mesa/mesa mesa
@if NOT EXIST mesa git clone --recurse-submodules --depth=1 --branch=%branch% git://anongit.freedesktop.org/mesa/mesa mesa
@cd mesa
@set LLVM=%mesa%\llvm\%abi%
@rem set /p mesaver=<VERSION
Expand All @@ -124,25 +120,26 @@
@echo.
@cd %mesa%\mesa
@set sconscmd=python %sconsloc% build=release platform=windows machine=%longabi% libgl-gdi
@set /p osmesa=Do you want to build off-screen rendering drivers (y/n):
@echo.
@if /I "%osmesa%"=="y" set sconscmd=%sconscmd% osmesa
@if NOT EXIST %LLVM% set sconscmd=%sconscmd% llvm=no
@if NOT EXIST %LLVM% GOTO build_with_vs
@set disablellvm=n
@set /p disablellvm=Build Mesa without LLVM (y/n). Only softpipe and osmesa swrast will be available:
@echo.
@if /I "%disablellvm%"=="y" set sconscmd=%sconscmd% llvm=no
@if /I "%disablellvm%"=="y" GOTO build_with_vs
@set llvmless=n
@if EXIST %LLVM% set /p llvmless=Build Mesa without LLVM (y/n). Only softpipe and osmesa will be available:
@if EXIST %LLVM% echo.
@if NOT EXIST %LLVM% set /p llvmless=Build Mesa without LLVM (y=yes/n=quit). Only softpipe and osmesa will be available:
@if NOT EXIST %LLVM% echo.
@if /I "%llvmless%"=="y" set sconscmd=%sconscmd% llvm=no
@if /I "%llvmless%"=="y" GOTO build_with_vs
@if /I NOT "%llvmless%"=="y" if NOT EXIST %LLVM% GOTO distcreate
@set swrdrv=n
@if %abi%==x64 set /p swrdrv=Do you want to build swr drivers? (y=yes):
@echo.
@if %abi%==x64 echo.
@if /I "%swrdrv%"=="y" set sconscmd=%sconscmd% swr=1
@set /p graw=Do you want to build graw library (y/n):
@echo.
@if /I "%graw%"=="y" set sconscmd=%sconscmd% graw-gdi

:build_with_vs
@set /p osmesa=Do you want to build off-screen rendering drivers (y/n):
@echo.
@if /I "%osmesa%"=="y" set sconscmd=%sconscmd% osmesa
@where /q python.exe
@IF ERRORLEVEL 1 set PATH=%mesa%\Python\;%PATH%
@set ERRORLEVEL=0
Expand Down
5 changes: 3 additions & 2 deletions buildscript/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ You can use the portable version if you don't want to bloat your system too much
The build script can grab Mesa3D code if Git is in PATH. It asks for the branch to pull from. Otherwise manually extract in `.`. Be warned that the archive is double packed. Rename extracted folder to `mesa`.
- [LLVM source code](http://llvm.org/);

Extract LLVM code in `.`. Rename extracted folder to `llvm`. LLVM 4.0 is the minimum version supported by this build scrpt as Visual Studio 2017 is the only version supported. Required to build high-performance drivers and libraries llvmpipe, swr, osmesa gallium and graw.
Extract LLVM code in `.`. Rename extracted folder to `llvm`. LLVM 4.0 is the minimum version supported by this build scrpt as Visual Studio 2017 is the only version supported. Required to build high-performance drivers and libraries llvmpipe, swr, osmesa gallium JIT and graw.
- [Ninja build system](https://github.com/ninja-build/ninja/releases)

Optional, it reduces LLVM build size as it works with single configuration. Unlike Visual Studio MsBuild which requires a Release and a Debug configuration at minimum. Development on Ninja stalled shortly after 1.8.2 release for unknown reason though. If used, extract Ninja in `.\ninja`. My script asks if you want to do this before starting LLVM build. LLVM must be built in release mode with install target. This build script does it automatically or you can look [here](https://wiki.qt.io/MesaLlvmpipe).

- [CMake 32 or 64 bit](https://cmake.org/download/#latest);

You may use the installer or you can extract the zipped version in `.\cmake`. Required to build LLVM just-in-time recompiler used by Mesa high-performance drivers and libraries llvmpipe, swr, osmesa gallium and graw.
You may use the installer or you can extract the zipped version in `.\cmake`. Required to build LLVM just-in-time recompiler used by Mesa high-performance drivers and libraries llvmpipe, swr, osmesa gallium JIT and graw.
- [Flex and Bison](https://sourceforge.net/projects/winflexbison/);

Extract in `.\flexbison`.
Expand Down Expand Up @@ -83,6 +83,7 @@ The script acts like a Wizard asking for the following during execution:
- if you want to build Mesa3D;
- if you want to build off-screen rendering driver(s);
- if LLVM is available asks if you want to use it;
- if LLVM is missing asks if you want to build without it;
- if LLVM is used you are asked if you want to build swr, graw respectively;
- if you want to do a clean build;
- if you want to organize binaries in a single location (distribution creation).
Expand Down

0 comments on commit 0ea701c

Please sign in to comment.