1 Get-Date
2 Write-Host "Downloading Freeglut"
3 
4 $freeglut_zip = 'freeglut-MSVC.zip'
5 $freeglut_url = "https://www.transmissionzero.co.uk/files/software/development/GLUT/$freeglut_zip"
6 
7 For ($i = 0; $i -lt 5; $i++) {
8   Invoke-WebRequest -Uri $freeglut_url -OutFile $freeglut_zip
9   $freeglut_downloaded = $?
10   if ($freeglut_downloaded) {
11     Break
12   }
13 }
14 
15 if (!$freeglut_downloaded) {
16   Write-Host "Failed to download Freeglut"
17   Exit 1
18 }
19 
20 Get-Date
21 Write-Host "Installing Freeglut"
22 Expand-Archive $freeglut_zip -DestinationPath C:\
23 if (!$?) {
24   Write-Host "Failed to install Freeglut"
25   Exit 1
26 }
27 
28 Get-Date
29 Write-Host "Downloading glext.h"
30 New-Item -ItemType Directory -Path ".\glext" -Name "GL"
31 $ProgressPreference = "SilentlyContinue"
32 Invoke-WebRequest -Uri 'https://www.khronos.org/registry/OpenGL/api/GL/glext.h' -OutFile '.\glext\GL\glext.h' | Out-Null
33 
34 Get-Date
35 Write-Host "Cloning Piglit"
36 git clone --no-progress --single-branch --no-checkout https://gitlab.freedesktop.org/mesa/piglit.git 'C:\src\piglit'
37 if (!$?) {
38   Write-Host "Failed to clone Piglit repository"
39   Exit 1
40 }
41 Push-Location -Path C:\src\piglit
42 git checkout f7f2a6c2275cae023a27b6cc81be3dda8c99492d
43 Pop-Location
44 
45 Get-Date
46 $piglit_build = New-Item -ItemType Directory -Path "C:\src\piglit" -Name "build"
47 Push-Location -Path $piglit_build.FullName
48 Write-Host "Compiling Piglit"
49 cmd.exe /C 'C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 && cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="C:\Piglit" -DGLUT_INCLUDE_DIR=C:\freeglut\include -DGLUT_glut_LIBRARY_RELEASE=C:\freeglut\lib\x64\freeglut.lib -DGLEXT_INCLUDE_DIR=.\glext && ninja -j32'
50 $buildstatus = $?
51 ninja -j32 install | Out-Null
52 $installstatus = $?
53 Pop-Location
54 Remove-Item -Recurse -Path $piglit_build
55 if (!$buildstatus -Or !$installstatus) {
56   Write-Host "Failed to compile or install Piglit"
57   Exit 1
58 }
59 
60 Copy-Item -Path C:\freeglut\bin\x64\freeglut.dll -Destination C:\Piglit\lib\piglit\bin\freeglut.dll
61 
62 Get-Date
63 Write-Host "Cloning spirv-samples"
64 git clone --no-progress --single-branch --no-checkout https://github.com/dneto0/spirv-samples.git  C:\spirv-samples\
65 Push-Location -Path C:\spirv-samples\
66 git checkout 7ac0ad5a7fe0ec884faba1dc2916028d0268eeef
67 Pop-Location
68 
69 Get-Date
70 Write-Host "Complete"
71