From 0f46a3191ff31a89d6969a67f8b50dbedf085dca Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Tue, 5 May 2020 15:49:22 +0100 Subject: [PATCH] CI: Windows: Build LLVM and llvmpipe We will eventually need to build our own LLVM on Windows in order to build libclc and other bits which are required for the d3d12 build, as well as to be able to test SPIR-V/OpenCL on llvmpipe. Start doing this now, building into the base container, and exercise this by building llvmpipe under Windows. Signed-off-by: Daniel Stone Reviewed-by: Jose Fonseca Reviewed-by: Eric Anholt Part-of: --- .gitlab-ci.yml | 3 ++- .gitlab-ci/windows/mesa_build.ps1 | 2 +- .gitlab-ci/windows/mesa_deps.ps1 | 33 ++++++++++++++++++++++++++++--- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 079f9c7979e..6b7b6e4b359 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -211,7 +211,7 @@ arm_test: .windows-docker-vs2019: variables: - WINDOWS_TAG: "2020-03-24" + WINDOWS_TAG: "2020-05-05-llvm" WINDOWS_IMAGE: "$CI_REGISTRY_IMAGE/windows/x64_build:$WINDOWS_TAG" WINDOWS_UPSTREAM_IMAGE: "$CI_REGISTRY/$FDO_UPSTREAM_REPO/windows/x64_build:$WINDOWS_TAG" @@ -222,6 +222,7 @@ windows_build_vs2019: stage: container variables: GIT_STRATEGY: fetch # we do actually need the full repository though + timeout: 4h # LLVM takes ages tags: - windows - shell diff --git a/.gitlab-ci/windows/mesa_build.ps1 b/.gitlab-ci/windows/mesa_build.ps1 index 8d7b79c6497..5c57c29bad9 100644 --- a/.gitlab-ci/windows/mesa_build.ps1 +++ b/.gitlab-ci/windows/mesa_build.ps1 @@ -6,7 +6,7 @@ Get-Date Write-Host "Compiling Mesa" $builddir = New-Item -ItemType Directory -Name "build" Push-Location $builddir.FullName -cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 && meson -Dgallium-drivers=swrast -Dbuild-tests=true .. && ninja test" +cmd.exe /C 'C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 && meson --default-library=static --buildtype=release -Db_vscrt=mt --cmake-prefix-path="C:\llvm-10" --pkg-config-path="C:\llvm-10\lib\pkgconfig;C:\llvm-10\share\pkgconfig;C:\spirv-tools\lib\pkgconfig" -Dllvm=true -Dshared-llvm=false -Dgallium-drivers=swrast -Dbuild-tests=true && ninja test' $buildstatus = $? Pop-Location Remove-Item -Recurse -Path $builddir diff --git a/.gitlab-ci/windows/mesa_deps.ps1 b/.gitlab-ci/windows/mesa_deps.ps1 index 28499e484ce..7fa52ad0053 100644 --- a/.gitlab-ci/windows/mesa_deps.ps1 +++ b/.gitlab-ci/windows/mesa_deps.ps1 @@ -10,7 +10,7 @@ Write-Host "Installing Chocolatey packages" For ($i = 0; $i -lt 5; $i++) { choco install -y python3 --params="/InstallDir:C:\python3" $python_install = $? - choco install --allow-empty-checksums -y cmake git git-lfs ninja pkgconfiglite winflexbison + choco install --allow-empty-checksums -y cmake git git-lfs ninja pkgconfiglite winflexbison --installargs "ADD_CMAKE_TO_PATH=System" $other_install = $? $choco_installed = $other_install -and $python_install if ($choco_installed) { @@ -25,8 +25,9 @@ if (!$choco_installed) { # Add Chocolatey's native install path Update-SessionEnvironment -# Python adds itself to the system environment path, which doesn't get refreshed until we start a new shell -$env:PATH = "C:\python3;C:\python3\scripts;$env:PATH" +# Python and CMake add themselves to the system environment path, which doesn't get refreshed +# until we start a new shell +$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' @@ -52,7 +53,33 @@ Invoke-WebRequest -Uri $msvc_2019_url -OutFile C:\vs_buildtools.exe Get-Date Write-Host "Installing Visual Studio 2019" Start-Process -NoNewWindow -Wait C:\vs_buildtools.exe -ArgumentList '--wait --quiet --norestart --nocache --installPath C:\BuildTools --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Component.VC.ATL --add Microsoft.VisualStudio.Component.VC.ATLMFC --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Graphics.Tools --add Microsoft.VisualStudio.Component.Windows10SDK.18362 --includeRecommended' +if (!$?) { + Write-Host "Failed to install Visual Studio tools" + Exit 1 +} Remove-Item C:\vs_buildtools.exe -Force +Get-Date +Write-Host "Cloning LLVM 10.x" +git clone -b release/10.x --depth=1 https://github.com/llvm/llvm-project llvm-project +if (!$?) { + Write-Host "Failed to clone LLVM repository" + Exit 1 +} + +Get-Date +# slightly convoluted syntax but avoids the CWD being under the PS filesystem meta-path +$llvm_build = New-Item -ItemType Directory -Path ".\llvm-project" -Name "build" +Push-Location -Path $llvm_build.FullName +Write-Host "Compiling LLVM and Clang" +cmd.exe /C 'C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 && cmake ../llvm -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_CRT_RELEASE=MT -DCMAKE_INSTALL_PREFIX="C:\llvm-10" -DLLVM_ENABLE_PROJECTS="clang;lld" -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_OPTIMIZED_TABLEGEN=TRUE -DLLVM_ENABLE_ASSERTIONS=TRUE -DLLVM_INCLUDE_UTILS=OFF -DLLVM_INCLUDE_RUNTIMES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_GO_TESTS=OFF -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_BUILD_LLVM_C_DYLIB=OFF -DLLVM_ENABLE_DIA_SDK=OFF -DCLANG_BUILD_TOOLS=ON && ninja -j4 install' +$buildstatus = $? +Pop-Location +Remove-Item -Recurse -Path $llvm_build +if (!$buildstatus) { + Write-Host "Failed to compile LLVM" + Exit 1 +} + Get-Date Write-Host "Complete" -- 2.30.2