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