1Get-Date
2Write-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
7For ($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
15if (!$freeglut_downloaded) {
16  Write-Host "Failed to download Freeglut"
17  Exit 1
18}
19
20Get-Date
21Write-Host "Installing Freeglut"
22Expand-Archive $freeglut_zip -DestinationPath C:\
23if (!$?) {
24  Write-Host "Failed to install Freeglut"
25  Exit 1
26}
27
28$MyPath = $MyInvocation.MyCommand.Path | Split-Path -Parent
29. "$MyPath\mesa_vs_init.ps1"
30
31Get-Date
32Write-Host "Downloading glext.h"
33New-Item -ItemType Directory -Path ".\glext" -Name "GL"
34$ProgressPreference = "SilentlyContinue"
35Invoke-WebRequest -Uri 'https://www.khronos.org/registry/OpenGL/api/GL/glext.h' -OutFile '.\glext\GL\glext.h' | Out-Null
36
37Get-Date
38Write-Host "Cloning Piglit"
39git clone --no-progress --single-branch --no-checkout https://gitlab.freedesktop.org/mesa/piglit.git 'C:\src\piglit'
40if (!$?) {
41  Write-Host "Failed to clone Piglit repository"
42  Exit 1
43}
44Push-Location -Path C:\src\piglit
45git checkout f7f2a6c2275cae023a27b6cc81be3dda8c99492d
46Pop-Location
47
48Get-Date
49$piglit_build = New-Item -ItemType Directory -Path "C:\src\piglit" -Name "build"
50Push-Location -Path $piglit_build.FullName
51Write-Host "Compiling Piglit"
52cmake .. `
53-GNinja `
54-DCMAKE_BUILD_TYPE=Release `
55-DCMAKE_INSTALL_PREFIX="C:\Piglit" `
56-DGLUT_INCLUDE_DIR=C:\freeglut\include `
57-DGLUT_glut_LIBRARY_RELEASE=C:\freeglut\lib\x64\freeglut.lib `
58-DGLEXT_INCLUDE_DIR=.\glext && `
59ninja -j32
60$buildstatus = $?
61ninja -j32 install | Out-Null
62$installstatus = $?
63Pop-Location
64Remove-Item -Recurse -Path $piglit_build
65if (!$buildstatus -Or !$installstatus) {
66  Write-Host "Failed to compile or install Piglit"
67  Exit 1
68}
69
70Copy-Item -Path C:\freeglut\bin\x64\freeglut.dll -Destination C:\Piglit\lib\piglit\bin\freeglut.dll
71
72Get-Date
73Write-Host "Cloning spirv-samples"
74git clone --no-progress --single-branch --no-checkout https://github.com/dneto0/spirv-samples.git  C:\spirv-samples\
75Push-Location -Path C:\spirv-samples\
76git checkout 36372636df06a24c4e2de1551beee055db01b91d
77Pop-Location
78
79Get-Date
80Write-Host "Cloning Vulkan and GL Conformance Tests"
81$deqp_source = "C:\src\VK-GL-CTS\"
82git clone --no-progress --single-branch https://github.com/lfrb/VK-GL-CTS.git -b windows-flush $deqp_source
83if (!$?) {
84  Write-Host "Failed to clone deqp repository"
85  Exit 1
86}
87
88Push-Location -Path $deqp_source
89# --insecure is due to SSL cert failures hitting sourceforge for zlib and
90# libpng (sigh).  The archives get their checksums checked anyway, and git
91# always goes through ssh or https.
92py .\external\fetch_sources.py --insecure
93Pop-Location
94
95Get-Date
96$deqp_build = New-Item -ItemType Directory -Path "C:\deqp"
97Push-Location -Path $deqp_build.FullName
98Write-Host "Compiling deqp"
99cmake -S $($deqp_source) `
100-B . `
101-GNinja `
102-DCMAKE_BUILD_TYPE=Release `
103-DDEQP_TARGET=default && `
104ninja -j32
105$buildstatus = $?
106Pop-Location
107if (!$buildstatus -Or !$installstatus) {
108  Write-Host "Failed to compile or install deqp"
109  Exit 1
110}
111
112# Copy test result templates
113Copy-Item -Path "$($deqp_source)\doc\testlog-stylesheet\testlog.css" -Destination $deqp_build
114Copy-Item -Path "$($deqp_source)\doc\testlog-stylesheet\testlog.xsl" -Destination $deqp_build
115
116# Copy Vulkan must-pass list
117$deqp_mustpass = New-Item -ItemType Directory -Path $deqp_build -Name "mustpass"
118$root_mustpass = Join-Path -Path $deqp_source -ChildPath "external\vulkancts\mustpass\master"
119$files = Get-Content "$($root_mustpass)\vk-default.txt"
120foreach($file in $files) {
121  Get-Content "$($root_mustpass)\$($file)" | Add-Content -Path "$($deqp_mustpass)\vk-master.txt"
122}
123Remove-Item -Force -Recurse $deqp_source
124
125Get-Date
126$url = 'https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe';
127Write-Host ('Downloading {0} ...' -f $url);
128Invoke-WebRequest -Uri $url -OutFile 'rustup-init.exe';
129Write-Host "Installing rust toolchain"
130C:\rustup-init.exe -y;
131Remove-Item C:\rustup-init.exe;
132
133Get-Date
134Write-Host "Installing deqp-runner"
135$env:Path += ";$($env:USERPROFILE)\.cargo\bin"
136cargo install --git https://gitlab.freedesktop.org/anholt/deqp-runner.git
137
138Get-Date
139Write-Host "Complete"
140