ci: Improve vs2019 mesa_build.ps1 for remove the need of cmd.exe
authorYonggang Luo <luoyonggang@gmail.com>
Sat, 26 Mar 2022 02:31:50 +0000 (10:31 +0800)
committerMarge Bot <emma+marge@anholt.net>
Thu, 31 Mar 2022 09:16:27 +0000 (09:16 +0000)
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15595>

.gitlab-ci/windows/mesa_build.ps1

index 520cf39..5d5f0f3 100644 (file)
@@ -6,10 +6,43 @@ $env:PYTHONUTF8=1
 
 Get-Date
 Write-Host "Compiling Mesa"
-$builddir = New-Item -ItemType Directory -Name "_build"
-$installdir = New-Item -ItemType Directory -Name "_install"
-Push-Location $builddir.FullName
-cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 && meson --default-library=shared -Dzlib:default_library=static --buildtype=release -Db_ndebug=false -Dc_std=c17 -Dcpp_std=vc++latest -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`" --prefix=`"$installdir`" -Dllvm=enabled -Dshared-llvm=disabled -Dvulkan-drivers=swrast,amd,microsoft-experimental -Dgallium-drivers=swrast,d3d12,zink -Dshared-glapi=enabled -Dgles2=enabled -Dmicrosoft-clc=enabled -Dstatic-libclc=all -Dspirv-to-dxil=true -Dbuild-tests=true -Dwerror=true -Dwarning_level=2 -Dzlib:warning_level=1 -Dlibelf:warning_level=1 && ninja -j32 install && meson test --num-processes 32"
+$builddir = New-Item -Force -ItemType Directory -Name "_build"
+$installdir = New-Item -Force -ItemType Directory -Name "_install"
+$builddir=$builddir.FullName
+$installdir=$installdir.FullName
+$sourcedir=$PWD
+
+Remove-Item -Recurse -Force $builddir
+Remove-Item -Recurse -Force $installdir
+New-Item -ItemType Directory -Path $builddir
+New-Item -ItemType Directory -Path $installdir
+
+Write-Output builddir:$builddir
+Write-Output installdir:$installdir
+Write-Output sourcedir:$sourcedir
+
+$installPath=& "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -version 16.0  -property installationpath
+Write-Output "vswhere.exe installPath: $installPath"
+$installPath="C:\BuildTools"
+Write-Output "Final installPath: $installPath"
+Import-Module (Join-Path $installPath "Common7\Tools\Microsoft.VisualStudio.DevShell.dll")
+Enter-VsDevShell -VsInstallPath $installPath -SkipAutomaticLocation -DevCmdArguments '-arch=x64 -no_logo -host_arch=amd64'
+
+Push-Location $builddir
+
+meson --default-library=shared -Dzlib:default_library=static --buildtype=release -Db_ndebug=false `
+-Dc_std=c17 -Dcpp_std=vc++latest -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" `
+--prefix="$installdir" `
+-Dllvm=enabled -Dshared-llvm=disabled `
+"-Dvulkan-drivers=swrast,amd,microsoft-experimental" "-Dgallium-drivers=swrast,d3d12,zink" `
+-Dshared-glapi=enabled -Dgles2=enabled -Dmicrosoft-clc=enabled -Dstatic-libclc=all -Dspirv-to-dxil=true `
+-Dbuild-tests=true -Dwerror=true -Dwarning_level=2 -Dzlib:warning_level=1 -Dlibelf:warning_level=1 `
+$sourcedir
+
+ninja install -j32
+meson test --num-processes 32
+
 $buildstatus = $?
 Pop-Location