Skip to content

Commit 814c4e1

Browse files
committed
mesa 21.3.1
0 parents  commit 814c4e1

File tree

6 files changed

+398
-0
lines changed

6 files changed

+398
-0
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mesa.patch eol=lf

.github/workflows/build-mesa.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
2+
name: build-mesa
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
build:
11+
runs-on: windows-2022
12+
steps:
13+
14+
- name: checkout
15+
uses: actions/checkout@v2
16+
17+
- name: build
18+
id: build
19+
shell: cmd
20+
run: call build.cmd
21+
22+
- name: release
23+
id: release
24+
if: steps.build.outputs.MESA_VERSION != ''
25+
uses: actions/create-release@v1
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
with:
29+
tag_name: ${{ steps.build.outputs.MESA_VERSION }}
30+
release_name: ${{ steps.build.outputs.MESA_VERSION }}
31+
body: |
32+
[mesa ${{ steps.build.outputs.MESA_VERSION }} release notes](https://docs.mesa3d.org/relnotes/${{ steps.build.outputs.MESA_VERSION }}.html)
33+
[llvm ${{ steps.build.outputs.LLVM_VERSION }} release notes](https://releases.llvm.org/${{ steps.build.outputs.LLVM_VERSION }}/docs/ReleaseNotes.html)
34+
35+
- name: upload llvmpipe
36+
id: upload-llvmpipe
37+
uses: actions/upload-release-asset@v1
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
with:
41+
upload_url: ${{ steps.release.outputs.upload_url }}
42+
asset_path: "mesa-llvmpipe-${{ steps.build.outputs.MESA_VERSION }}.zip"
43+
asset_name: "mesa-llvmpipe-${{ steps.build.outputs.MESA_VERSION }}.zip"
44+
asset_content_type: application/zip
45+
46+
- name: upload osmesa
47+
id: upload-osmesa
48+
uses: actions/upload-release-asset@v1
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
with:
52+
upload_url: ${{ steps.release.outputs.upload_url }}
53+
asset_path: "mesa-osmesa-${{ steps.build.outputs.MESA_VERSION }}.zip"
54+
asset_name: "mesa-osmesa-${{ steps.build.outputs.MESA_VERSION }}.zip"
55+
asset_content_type: application/zip
56+
57+
- name: upload d3d12
58+
id: upload-d3d12
59+
uses: actions/upload-release-asset@v1
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
with:
63+
upload_url: ${{ steps.release.outputs.upload_url }}
64+
asset_path: "mesa-d3d12-${{ steps.build.outputs.MESA_VERSION }}.zip"
65+
asset_name: "mesa-d3d12-${{ steps.build.outputs.MESA_VERSION }}.zip"
66+
asset_content_type: application/zip

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
llvm
2+
llvm.src
3+
llvm.build
4+
mesa-*
5+
mesa.src
6+
mesa.build
7+
archive-*
8+
winflexbison
9+
*.zip
10+
*.exe
11+

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Automatic build of [mesa][] opengl implementations for 64-bit Windows.
2+
3+
Builds are linked statically to their dependencies, just place necessary dll file next to your exe and it will use it.
4+
5+
Download binary builds as zip archive from [latest release][] page. It provides following builds:
6+
7+
* [llvmpipe][] - software implementation of opengl using llvm jit
8+
* [osmesa][] - off-screen software rendering implementation using llvmpipe
9+
* [d3d12][] - [Collabora & Microsoft][collabora] implementation of opengl using D3D12
10+
11+
To build locally run `build.cmd` batch file, make sure you have installed all necessary dependencies (see the beginning of file).
12+
13+
[mesa]: https://www.mesa3d.org/
14+
[llvmpipe]: https://docs.mesa3d.org/drivers/llvmpipe.html
15+
[osmesa]: https://docs.mesa3d.org/osmesa.html
16+
[d3d12]: https://docs.mesa3d.org/drivers/d3d12.html
17+
[collabora]: https://www.collabora.com/news-and-blog/news-and-events/introducing-opencl-and-opengl-on-directx.html
18+
[latest release]: https://github.com/mmozeiko/build-mesa/releases/latest

build.cmd

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
@echo off
2+
setlocal enabledelayedexpansion
3+
4+
set LLVM_VERSION=13.0.0
5+
set MESA_VERSION=21.3.1
6+
7+
set PATH=%CD%\llvm\bin;%CD%\winflexbison;%PATH%
8+
9+
rem *** check dependencies ***
10+
11+
where /q python.exe || (
12+
echo ERROR: "python.exe" not found
13+
exit /b 1
14+
)
15+
16+
where /q pip.exe || (
17+
echo ERROR: "pip.exe" not found
18+
exit /b 1
19+
)
20+
21+
where /q meson.exe || (
22+
pip install meson
23+
where /q meson.exe || (
24+
echo ERROR: "meson.exe" not found
25+
exit /b 1
26+
)
27+
)
28+
29+
python -c "import mako" 2>nul || (
30+
pip install mako
31+
python -c "import mako" 2>nul || (
32+
echo ERROR: "mako" module not found for python
33+
exit /b 1
34+
)
35+
)
36+
37+
where /q git.exe || (
38+
echo ERROR: "git.exe" not found
39+
exit /b 1
40+
)
41+
42+
where /q curl.exe || (
43+
echo ERROR: "curl.exe" not found
44+
exit /b 1
45+
)
46+
47+
if exist "%ProgramFiles%\7-Zip\7z.exe" (
48+
set SZIP="%ProgramFiles%\7-Zip\7z.exe"
49+
) else (
50+
where /q 7za.exe || (
51+
echo ERROR: 7-Zip installation or "7za.exe" not found
52+
exit /b 1
53+
)
54+
set SZIP=7za.exe
55+
)
56+
57+
where /q cmake.exe || (
58+
echo ERROR: "cmake.exe" not found
59+
exit /b 1
60+
)
61+
62+
where /q ninja.exe || (
63+
curl -Lsf -o ninja-win.zip https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-win.zip || exit /b 1
64+
%SZIP% x -bb0 -y ninja-win.zip 1>nul 2>nul || exit /b 1
65+
del ninja-win.zip 1>nul 2>nul
66+
)
67+
68+
rem *** Visual Studio environment ***
69+
70+
where /Q cl.exe || (
71+
set __VSCMD_ARG_NO_LOGO=1
72+
for /f "tokens=*" %%i in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath') do set VS=%%i
73+
if "!VS!" equ "" (
74+
echo ERROR: Visual Studio installation not found
75+
exit /b 1
76+
)
77+
call "!VS!\VC\Auxiliary\Build\vcvarsall.bat" amd64 || exit /b 1
78+
)
79+
80+
rem *** download sources ***
81+
82+
echo Downloading llvm
83+
curl -sfL https://github.com/llvm/llvm-project/releases/download/llvmorg-%LLVM_VERSION%/llvm-%LLVM_VERSION%.src.tar.xz ^
84+
| %SZIP% x -bb0 -txz -si -so ^
85+
| %SZIP% x -bb0 -ttar -si -aoa 1>nul 2>nul
86+
move llvm-%LLVM_VERSION%.src llvm.src
87+
88+
echo Downloading mesa
89+
curl -sfL https://archive.mesa3d.org//mesa-%MESA_VERSION%.tar.xz ^
90+
| %SZIP% x -bb0 -txz -si -so ^
91+
| %SZIP% x -bb0 -ttar -si -aoa 1>nul 2>nul
92+
move mesa-%MESA_VERSION% mesa.src
93+
git apply -p0 --directory=mesa.src mesa.patch || exit /b 1
94+
95+
echo Downloading win_flex_bison
96+
if not exist winflexbison (
97+
mkdir winflexbison
98+
pushd winflexbison
99+
curl -sfL -o win_flex_bison-2.5.24.zip https://github.com/lexxmark/winflexbison/releases/download/v2.5.24/win_flex_bison-2.5.24.zip || exit /b 1
100+
%SZIP% x -bb0 -y win_flex_bison-2.5.24.zip 1>nul 2>nul || exit /b 1
101+
del win_flex_bison-2.5.24.zip 1>nul 2>nul
102+
popd
103+
)
104+
105+
del "@PaxHeader" "HEAD" "pax_global_header" 1>nul 2>nul
106+
107+
rem *** llvm ***
108+
109+
cmake ^
110+
-G Ninja ^
111+
-S llvm.src ^
112+
-B llvm.build ^
113+
-D CMAKE_INSTALL_PREFIX="%CD%\llvm" ^
114+
-D CMAKE_BUILD_TYPE="Release" ^
115+
-D BUILD_SHARED_LIBS=OFF ^
116+
-D LLVM_TARGETS_TO_BUILD="X86" ^
117+
-D LLVM_ENABLE_BACKTRACES=OFF ^
118+
-D LLVM_ENABLE_UNWIND_TABLES=OFF ^
119+
-D LLVM_ENABLE_CRASH_OVERRIDES=OFF ^
120+
-D LLVM_ENABLE_TERMINFO=OFF ^
121+
-D LLVM_ENABLE_LIBXML2=OFF ^
122+
-D LLVM_ENABLE_LIBEDIT=OFF ^
123+
-D LLVM_ENABLE_LIBPFM=OFF ^
124+
-D LLVM_ENABLE_ZLIB=OFF ^
125+
-D LLVM_ENABLE_Z3_SOLVER=OFF ^
126+
-D LLVM_ENABLE_WARNINGS=OFF ^
127+
-D LLVM_ENABLE_PEDANTIC=OFF ^
128+
-D LLVM_ENABLE_WERROR=OFF ^
129+
-D LLVM_ENABLE_ASSERTIONS=OFF ^
130+
-D LLVM_BUILD_UTILS=OFF ^
131+
-D LLVM_BUILD_TESTS=OFF ^
132+
-D LLVM_BUILD_DOCS=OFF ^
133+
-D LLVM_BUILD_EXAMPLES=OFF ^
134+
-D LLVM_BUILD_BENCHMARKS=OFF ^
135+
-D LLVM_INCLUDE_UTILS=OFF ^
136+
-D LLVM_INCLUDE_TESTS=OFF ^
137+
-D LLVM_INCLUDE_DOCS=OFF ^
138+
-D LLVM_INCLUDE_EXAMPLES=OFF ^
139+
-D LLVM_INCLUDE_BENCHMARKS=OFF ^
140+
-D LLVM_ENABLE_BINDINGS=OFF ^
141+
-D LLVM_OPTIMIZED_TABLEGEN=ON ^
142+
-D LLVM_ENABLE_PLUGINS=OFF ^
143+
-D LLVM_USE_CRT_RELEASE=MT ^
144+
-D LLVM_ENABLE_IDE=OFF || exit /b 1
145+
ninja -C llvm.build
146+
ninja -C llvm.build install || exit /b 1
147+
148+
rem *** mesa llvmpipe ***
149+
150+
rd /s /q mesa.build 1>nul 2>nul
151+
meson setup ^
152+
mesa.build ^
153+
mesa.src ^
154+
--prefix="%CD%\mesa-llvmpipe" ^
155+
--default-library=static ^
156+
-Dbuildtype=release ^
157+
-Db_ndebug=true ^
158+
-Db_vscrt=mt ^
159+
-Dllvm=enabled ^
160+
-Dplatforms=windows ^
161+
-Dosmesa=true ^
162+
-Dgallium-drivers=swrast || exit /b 1
163+
ninja -C mesa.build install || exit /b 1
164+
165+
rem *** mesa d3d12 ***
166+
167+
rd /s /q mesa.build 1>nul 2>nul
168+
meson setup ^
169+
mesa.build ^
170+
mesa.src ^
171+
--prefix="%CD%\mesa-d3d12" ^
172+
--default-library=static ^
173+
-Dbuildtype=release ^
174+
-Db_ndebug=true ^
175+
-Db_vscrt=mt ^
176+
-Dllvm=disabled ^
177+
-Dplatforms=windows ^
178+
-Dosmesa=false ^
179+
-Dgallium-drivers=d3d12 || exit /b 1
180+
ninja -C mesa.build install || exit /b 1
181+
182+
rem *** done ***
183+
rem output is in mesa-d3d12 and mesa-llvmpipe folders
184+
185+
if "%GITHUB_WORKFLOW%" neq "" (
186+
mkdir archive-llvmpipe
187+
pushd archive-llvmpipe
188+
copy /y ..\mesa-llvmpipe\bin\opengl32.dll .
189+
%SZIP% a -mx=9 ..\mesa-llvmpipe-%MESA_VERSION%.zip
190+
popd
191+
192+
mkdir archive-osmesa
193+
pushd archive-osmesa
194+
copy /y ..\mesa-llvmpipe\bin\osmesa.dll .
195+
copy /y ..\mesa-llvmpipe\lib\osmesa.lib .
196+
copy /y ..\mesa-llvmpipe\include\GL\osmesa.h .
197+
%SZIP% a -mx=9 ..\mesa-osmesa-%MESA_VERSION%.zip
198+
popd
199+
200+
mkdir archive-d3d12
201+
pushd archive-d3d12
202+
copy /y ..\mesa-d3d12\bin\opengl32.dll .
203+
copy /y "%ProgramFiles(x86)%\Windows Kits\10\Redist\D3D\x64\dxil.dll" .
204+
%SZIP% a -mx=9 ..\mesa-d3d12-%MESA_VERSION%.zip
205+
popd
206+
207+
echo ::set-output name=LLVM_VERSION::%LLVM_VERSION%
208+
echo ::set-output name=MESA_VERSION::%MESA_VERSION%
209+
)

0 commit comments

Comments
 (0)