From 322c807b3ce3f40216b65466e3f3ae17487ac856 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Wed, 1 Jun 2022 23:48:45 +0800 Subject: [PATCH] ci/vs2019: Install all build artifacts into C:\mesa-deps By building everything under `deps` directory, remove the `deps` after them installed. We can use spirv-as from Vulkan-SDK, so that test won't depends on mesa-deps Signed-off-by: Yonggang Luo Reviewed-by: Jesse Natalie Part-of: --- .gitlab-ci/windows/mesa_build.ps1 | 6 +++-- .gitlab-ci/windows/mesa_deps_build.ps1 | 33 ++++++++++++++++--------- .gitlab-ci/windows/spirv2dxil_check.ps1 | 2 +- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/.gitlab-ci/windows/mesa_build.ps1 b/.gitlab-ci/windows/mesa_build.ps1 index 7eeadc09621..1772b1846d0 100644 --- a/.gitlab-ci/windows/mesa_build.ps1 +++ b/.gitlab-ci/windows/mesa_build.ps1 @@ -32,6 +32,8 @@ Write-Output sourcedir:$sourcedir $MyPath = $MyInvocation.MyCommand.Path | Split-Path -Parent . "$MyPath\mesa_vs_init.ps1" +$depsInstallPath="C:\mesa-deps" + Push-Location $builddir meson ` @@ -40,8 +42,8 @@ meson ` --buildtype=release ` -Db_ndebug=false ` -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" ` +--cmake-prefix-path="$depsInstallPath" ` +--pkg-config-path="$depsInstallPath\lib\pkgconfig;$depsInstallPath\share\pkgconfig" ` --prefix="$installdir" ` -Dllvm=enabled ` -Dshared-llvm=disabled ` diff --git a/.gitlab-ci/windows/mesa_deps_build.ps1 b/.gitlab-ci/windows/mesa_deps_build.ps1 index d2421cc5e99..c931dd9f24f 100644 --- a/.gitlab-ci/windows/mesa_deps_build.ps1 +++ b/.gitlab-ci/windows/mesa_deps_build.ps1 @@ -66,9 +66,11 @@ $MyPath = $MyInvocation.MyCommand.Path | Split-Path -Parent # downloads so must be done after Chocolatey use [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls13; +Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "deps" | Out-Null + Get-Date Write-Host "Cloning LLVM release/12.x" -git clone -b release/12.x --depth=1 https://github.com/llvm/llvm-project llvm-project +git clone -b release/12.x --depth=1 https://github.com/llvm/llvm-project deps/llvm-project if (!$?) { Write-Host "Failed to clone LLVM repository" Exit 1 @@ -79,25 +81,28 @@ if (!$?) { # a tag matching LLVM 12.0.0 Get-Date Write-Host "Cloning SPIRV-LLVM-Translator" -git clone https://github.com/KhronosGroup/SPIRV-LLVM-Translator llvm-project/llvm/projects/SPIRV-LLVM-Translator +git clone https://github.com/KhronosGroup/SPIRV-LLVM-Translator deps/llvm-project/llvm/projects/SPIRV-LLVM-Translator if (!$?) { Write-Host "Failed to clone SPIRV-LLVM-Translator repository" Exit 1 } -Push-Location llvm-project/llvm/projects/SPIRV-LLVM-Translator +Push-Location deps/llvm-project/llvm/projects/SPIRV-LLVM-Translator git checkout 5b641633b3bcc3251a52260eee11db13a79d7258 Pop-Location +$depsInstallPath="C:\mesa-deps" + Get-Date # slightly convoluted syntax but avoids the CWD being under the PS filesystem meta-path -$llvm_build = New-Item -ItemType Directory -ErrorAction SilentlyContinue -Force -Path ".\llvm-project" -Name "build" +$llvm_build = New-Item -ItemType Directory -ErrorAction SilentlyContinue -Force -Path ".\deps\llvm-project" -Name "build" Push-Location -Path $llvm_build.FullName Write-Host "Compiling LLVM and Clang" cmake ../llvm ` -GNinja ` -DCMAKE_BUILD_TYPE=Release ` -DLLVM_USE_CRT_RELEASE=MT ` --DCMAKE_INSTALL_PREFIX="C:\llvm-10" ` +-DCMAKE_PREFIX_PATH="$depsInstallPath" ` +-DCMAKE_INSTALL_PREFIX="$depsInstallPath" ` -DLLVM_ENABLE_PROJECTS="clang;lld" ` -DLLVM_TARGETS_TO_BUILD="AMDGPU;X86" ` -DLLVM_OPTIMIZED_TABLEGEN=TRUE ` @@ -122,7 +127,7 @@ if (!$buildstatus) { } Get-Date -$libclc_build = New-Item -ItemType Directory -Path ".\llvm-project" -Name "build-libclc" +$libclc_build = New-Item -ItemType Directory -Path ".\deps\llvm-project" -Name "build-libclc" Push-Location -Path $libclc_build.FullName Write-Host "Compiling libclc" # libclc can only be built with Ninja, because CMake's VS backend doesn't know how to compile new language types @@ -132,7 +137,7 @@ cmake ../libclc ` -DCMAKE_CXX_FLAGS="-m64" ` -DCMAKE_POLICY_DEFAULT_CMP0091=NEW ` -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded ` --DCMAKE_INSTALL_PREFIX="C:\llvm-10" ` +-DCMAKE_INSTALL_PREFIX="$depsInstallPath" ` -DLIBCLC_TARGETS_TO_BUILD="spirv-mesa3d-;spirv64-mesa3d-" && ` ninja -j32 install $buildstatus = $? @@ -146,18 +151,18 @@ Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path $llvm_build Get-Date Write-Host "Cloning SPIRV-Tools" -git clone -b "sdk-$env:VULKAN_SDK_VERSION" --depth=1 https://github.com/KhronosGroup/SPIRV-Tools +git clone -b "sdk-$env:VULKAN_SDK_VERSION" --depth=1 https://github.com/KhronosGroup/SPIRV-Tools deps/SPIRV-Tools if (!$?) { Write-Host "Failed to clone SPIRV-Tools repository" Exit 1 } -git clone -b "sdk-$env:VULKAN_SDK_VERSION" --depth=1 https://github.com/KhronosGroup/SPIRV-Headers SPIRV-Tools/external/SPIRV-Headers +git clone -b "sdk-$env:VULKAN_SDK_VERSION" --depth=1 https://github.com/KhronosGroup/SPIRV-Headers deps/SPIRV-Tools/external/SPIRV-Headers if (!$?) { Write-Host "Failed to clone SPIRV-Headers repository" Exit 1 } Write-Host "Building SPIRV-Tools" -$spv_build = New-Item -ItemType Directory -Path ".\SPIRV-Tools" -Name "build" +$spv_build = New-Item -ItemType Directory -Path ".\deps\SPIRV-Tools" -Name "build" Push-Location -Path $spv_build.FullName # SPIRV-Tools doesn't use multi-threaded MSVCRT, but we need it to cmake .. ` @@ -165,7 +170,7 @@ cmake .. ` -DCMAKE_BUILD_TYPE=Release ` -DCMAKE_POLICY_DEFAULT_CMP0091=NEW ` -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded ` --DCMAKE_INSTALL_PREFIX="C:\spirv-tools" && ` +-DCMAKE_INSTALL_PREFIX="$depsInstallPath" && ` ninja -j32 install $buildstatus = $? Pop-Location @@ -175,6 +180,12 @@ if (!$buildstatus) { Exit 1 } +function Remove-Symlinks { + Get-ChildItem -Force -ErrorAction SilentlyContinue @Args | Where-Object { if($_.Attributes -match "ReparsePoint"){$_.Delete()} } +} +Remove-Symlinks -Path "deps" -Recurse +Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path "deps" | Out-Null + Get-Date Write-Host "Downloading Vulkan-Runtime" Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/$env:VULKAN_SDK_VERSION/windows/VulkanRT-$env:VULKAN_SDK_VERSION-Installer.exe" -OutFile 'C:\vulkan-runtime.exe' | Out-Null diff --git a/.gitlab-ci/windows/spirv2dxil_check.ps1 b/.gitlab-ci/windows/spirv2dxil_check.ps1 index bfa9fdc3dea..7edf6ac90b4 100644 --- a/.gitlab-ci/windows/spirv2dxil_check.ps1 +++ b/.gitlab-ci/windows/spirv2dxil_check.ps1 @@ -18,7 +18,7 @@ foreach ($spvasm in $spvasm_files) { $spv_version = $Matches[1] } - $as_output = C:\spirv-tools\bin\spirv-as.exe --target-env spv$spv_version --preserve-numeric-ids -o $spvfile $spvasm 2>&1 | % { if ($_ -is [System.Management.Automation.ErrorRecord]) { $_.Exception.Message } else { $_ } } | Out-String + $as_output = . "$env:VULKAN_SDK\Bin\spirv-as.exe" --target-env spv$spv_version --preserve-numeric-ids -o $spvfile $spvasm 2>&1 | % { if ($_ -is [System.Management.Automation.ErrorRecord]) { $_.Exception.Message } else { $_ } } | Out-String if ($LASTEXITCODE -ne 0) { Write-Output "$test_name Skip: Unable to assemble shader" Write-Output "$as_output`n"