gitlab-ci: build piglit in mesa_deps.ps1
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 3 Jun 2020 16:06:56 +0000 (18:06 +0200)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 2 Dec 2020 09:04:48 +0000 (10:04 +0100)
This will allow us to run Piglit on Windows during CI.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7857>

.gitlab-ci.yml
.gitlab-ci/windows/mesa_deps.ps1

index 8ea791b..f1bf5da 100644 (file)
@@ -425,7 +425,7 @@ arm64_test:
 
 .windows-docker-vs2019:
   variables:
-    WINDOWS_TAG: "2020-11-26-libclc"
+    WINDOWS_TAG: "2020-12-01-piglit"
     WINDOWS_IMAGE: "$CI_REGISTRY_IMAGE/windows/x64_build:$WINDOWS_TAG"
     WINDOWS_UPSTREAM_IMAGE: "$CI_REGISTRY/$FDO_UPSTREAM_REPO/windows/x64_build:$WINDOWS_TAG"
 
@@ -436,6 +436,7 @@ windows_build_vs2019:
   stage: container
   variables:
     GIT_STRATEGY: fetch # we do actually need the full repository though
+  timeout: 2h # LLVM + piglit takes ages
   tags:
     - windows
     - shell
index fa07015..549cc91 100644 (file)
@@ -32,8 +32,8 @@ $env:PATH = "C:\python3;C:\python3\scripts;C:\Program Files\CMake\bin;$env:PATH"
 Start-Process -NoNewWindow -Wait git -ArgumentList 'config --global core.autocrlf false'
 
 Get-Date
-Write-Host "Installing Meson and Mako"
-pip3 install meson mako
+Write-Host "Installing Meson, Mako and numpy"
+pip3 install meson mako numpy
 if (!$?) {
   Write-Host "Failed to install dependencies from pip"
   Exit 1
@@ -129,4 +129,65 @@ if (!$buildstatus) {
 }
 
 Get-Date
+Write-Host "Downloading Freeglut"
+
+$freeglut_zip = 'freeglut-MSVC.zip'
+$freeglut_url = "https://www.transmissionzero.co.uk/files/software/development/GLUT/$freeglut_zip"
+
+For ($i = 0; $i -lt 5; $i++) {
+  Invoke-WebRequest -Uri $freeglut_url -OutFile $freeglut_zip
+  $freeglut_downloaded = $?
+  if ($freeglut_downloaded) {
+    Break
+  }
+}
+
+if (!$freeglut_downloaded) {
+  Write-Host "Failed to download Freeglut"
+  Exit 1
+}
+
+Get-Date
+Write-Host "Installing Freeglut"
+Expand-Archive $freeglut_zip -DestinationPath C:\
+if (!$?) {
+  Write-Host "Failed to install Freeglut"
+  Exit 1
+}
+
+Get-Date
+Write-Host "Downloading glext.h"
+New-Item -ItemType Directory -Path ".\glext" -Name "GL"
+$ProgressPreference = "SilentlyContinue"
+Invoke-WebRequest -Uri 'https://www.khronos.org/registry/OpenGL/api/GL/glext.h' -OutFile '.\glext\GL\glext.h' | Out-Null
+
+Get-Date
+Write-Host "Cloning Piglit"
+git clone --no-progress --single-branch --no-checkout https://gitlab.freedesktop.org/mesa/piglit.git 'C:\src\piglit'
+if (!$?) {
+  Write-Host "Failed to clone Piglit repository"
+  Exit 1
+}
+Push-Location -Path C:\src\piglit
+git checkout f8767f9c9d0afe0ce8d37ddd80a61f73ccfb1cc6
+Pop-Location
+
+Get-Date
+$piglit_build = New-Item -ItemType Directory -Path "C:\src\piglit" -Name "build"
+Push-Location -Path $piglit_build.FullName
+Write-Host "Compiling Piglit"
+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'
+$buildstatus = $?
+ninja -j32 install | Out-Null
+$installstatus = $?
+Pop-Location
+Remove-Item -Recurse -Path $piglit_build
+if (!$buildstatus -Or !$installstatus) {
+  Write-Host "Failed to compile or install Piglit"
+  Exit 1
+}
+
+Copy-Item -Path C:\freeglut\bin\x64\freeglut.dll -Destination C:\Piglit\lib\piglit\bin\freeglut.dll
+
+Get-Date
 Write-Host "Complete"