• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 # Compiling Piglit
2 
3 $ProgressPreference = "SilentlyContinue"
4 $MyPath = $MyInvocation.MyCommand.Path | Split-Path -Parent
5 . "$MyPath\mesa_init_msvc.ps1"
6 
7 $source_dir = Join-Path -Path "$PWD" -ChildPath "src"
8 $waffle_source = Join-Path -Path "$source_dir" -ChildPath "waffle"
9 $waffle_install = Join-Path -Path "$PWD" -ChildPath "waffle"
10 $piglit_source = Join-Path -Path "$PWD" -ChildPath "Piglit"
11 
12 Write-Host "Cloning Waffle at:"
13 Get-Date
14 New-Item -ItemType Directory -Path "$waffle_source" | Out-Null
15 Push-Location -Path $waffle_source
16 git init
17 git remote add origin https://gitlab.freedesktop.org/mesa/waffle.git
18 git fetch --depth 1 origin 950a1f35a718bc2a8e1dda75845e52651bb331a7 # of branch master
19 if (!$?) {
20   Write-Host "Failed to fetch Waffle repository"
21   Pop-Location
22   Exit 1
23 }
24 git checkout FETCH_HEAD
25 Pop-Location
26 
27 Write-Host "Compiling Waffle at:"
28 Get-Date
29 $waffle_build = Join-Path -Path "$source_dir" -ChildPath "waffle\build"
30 New-Item -ItemType Directory -Path "$waffle_build" | Out-Null
31 Push-Location -Path $waffle_build
32 meson setup `
33 --buildtype=release `
34 --default-library=static `
35 --prefix="$waffle_install" && `
36 ninja -j32 install
37 if (!$?) {
38   Write-Host "Failed to compile or install Waffle"
39   Pop-Location
40   Exit 1
41 }
42 Pop-Location
43 Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path "$waffle_build" | Out-Null
44 
45 Write-Host "Downloading glext.h at:"
46 Get-Date
47 New-Item -ItemType Directory -Path "$source_dir\glext\GL" | Out-Null
48 Invoke-WebRequest -Uri 'https://github.com/KhronosGroup/OpenGL-Registry/raw/main/api/GL/glext.h' -OutFile "$source_dir\glext\GL\glext.h" | Out-Null
49 
50 Write-Host "Cloning Piglit at:"
51 Get-Date
52 New-Item -ItemType Directory -Path "$piglit_source" | Out-Null
53 Push-Location -Path $piglit_source
54 git init
55 git remote add origin https://gitlab.freedesktop.org/mesa/piglit.git
56 git fetch --depth 1 origin 814046fe6942eac660ee4a6cc5fcc54011a49945 # of branch main
57 if (!$?) {
58   Write-Host "Failed to fetch Piglit repository"
59   Pop-Location
60   Exit 1
61 }
62 git checkout FETCH_HEAD
63 
64 Write-Host "Compiling Piglit at:"
65 Get-Date
66 cmake -S . -B . `
67 -GNinja `
68 -DCMAKE_BUILD_TYPE=Release `
69 -DPIGLIT_USE_WAFFLE=ON `
70 -DWaffle_INCLUDE_DIRS="$waffle_install\include\waffle-1" `
71 -DWaffle_LDFLAGS="$waffle_install\lib\libwaffle-1.a" `
72 -DGLEXT_INCLUDE_DIR="$source_dir\glext" && `
73 ninja -j32
74 if (!$?) {
75   Write-Host "Failed to compile Piglit"
76   Pop-Location
77   Exit 1
78 }
79 Pop-Location
80 
81 $depsInstallPath="C:\mesa-deps"
82 $piglit_bin = "$piglit_source\bin"
83 
84 # Hard link Agility SDK into subfolder of piglit
85 $agility_dest = New-Item -ItemType Directory -Path $piglit_bin -Name 'D3D12'
86 New-Item -ItemType HardLink -path $agility_dest\D3D12Core.dll -Value $depsInstallPath\bin\D3D12\D3D12Core.dll
87 New-Item -ItemType HardLink -path $agility_dest\d3d12SDKLayers.dll -Value $depsInstallPath\bin\D3D12\d3d12SDKLayers.dll
88 
89 # Hard link WARP next to piglit
90 New-Item -ItemType HardLink -path $piglit_bin\d3d10warp.dll -Value $depsInstallPath\bin\d3d10warp.dll
91 
92 Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path "$source_dir" | Out-Null
93 Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path "$waffle_install" | Out-Null
94 
95 # Cleanup piglit intermediate files
96 Get-ChildItem -Force -ErrorAction SilentlyContinue -Recurse "$piglit_source" | Where-Object {
97   if($_.FullName -match "CMake|.git|.lib"){
98     Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path $_.FullName | Out-Null
99   }
100 }
101 
102 Write-Host "Compiling Piglit finished at:"
103 Get-Date
104