From 673b7427512d3af498d49ed4792174c74e00f0ab Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Thu, 27 Jan 2022 11:25:53 +0530 Subject: [PATCH] ci: Add a Windows native cross-arm64 job with a new image Needed an update to the windows Dockerfile to: 1. Install the 'UniversalBuildTools' workload for Cerbero 2. Install ARM and ARM64 workloads for cross-uwp-universal in Cerbero 3. Install VS 2019 since we need that for ARM64 NEON support in Opus We can't test UWP in gstreamer.git because glib needs custom patches for that. It will be tested in Cerbero. Part-of: --- .gitlab-ci.yml | 26 ++++++++++++++++--- ci/docker/windows/Dockerfile | 15 ++++++++--- ci/docker/windows/Install.cmd | 7 +++-- ci/meson/vs2019-arm64-cross-file.txt | 23 +++++++++++++++++ ci/meson/vs2019-x64-native-file.txt | 38 ++++++++++++++++++++++++++++ 5 files changed, 99 insertions(+), 10 deletions(-) create mode 100644 ci/meson/vs2019-arm64-cross-file.txt create mode 100644 ci/meson/vs2019-x64-native-file.txt diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dfb4fc0acf..fc6b716ae2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,7 +27,7 @@ variables: ### FEDORA_TAG: '2021-12-03.1' INDENT_TAG: '2021-10-04.0' - WINDOWS_TAG: "2021-10-12.0" + WINDOWS_TAG: "2022-01-26.3" GST_UPSTREAM_REPO: 'gstreamer/gstreamer' FDO_UPSTREAM_REPO: 'gstreamer/gstreamer' @@ -388,6 +388,9 @@ build clang fedora x86_64: -Dvaapi=disabled -Dgst-plugins-base:pango=enabled -Dgst-plugins-good:cairo=enabled + # Needs to not be empty otherwise the newline -> space replace command in + # `script:` will fail + MESON_CROSS_ARGS: ' ' rules: # If this matches, it means the pipeline is running against either the main # or a stable branch, so make it manual @@ -400,8 +403,9 @@ build clang fedora x86_64: # For some reason, options are separated by newline instead of space, so we # have to replace them first. - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ") + - $env:MESON_CROSS_ARGS = $env:MESON_CROSS_ARGS.replace("`n"," ") - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH && - meson build $env:MESON_ARGS && + meson build $env:MESON_ARGS $env:MESON_CROSS_ARGS && ninja -C build" # XXX: Re-enable when uploading stops timing out #artifacts: @@ -409,17 +413,31 @@ build clang fedora x86_64: # when: "always" # paths: # - 'build/meson-logs/' + # - 'vslogs.zip' -build vs2017 amd64: +build vs2019 amd64: extends: '.build windows' variables: ARCH: 'amd64' -build vs2017 x86: +build vs2019 x86: extends: '.build windows' variables: ARCH: 'x86' +build vs2019 arm64 uwp: + extends: '.build windows' + variables: + ARCH: 'arm64' + # pango pulls in cairo which pulls in pixman which doesn't build because of + # https://github.com/mesonbuild/meson/issues/9889 + MESON_CROSS_ARGS: > + -Dgst-plugins-base:pango=disabled + -Dgst-plugins-good:cairo=disabled + -Dgst-devtools:cairo=disabled + --cross-file ci/meson/vs2019-arm64-cross-file.txt + --native-file ci/meson/vs2019-x64-native-file.txt + build msys2 : extends: '.build windows' timeout: '60min' diff --git a/ci/docker/windows/Dockerfile b/ci/docker/windows/Dockerfile index fbaa6e0f00..59ebf79984 100644 --- a/ci/docker/windows/Dockerfile +++ b/ci/docker/windows/Dockerfile @@ -25,17 +25,24 @@ RUN c:\msys64\usr\bin\bash -lc 'pacman -S --noconfirm mingw-w64-ucrt-x86_64-tool COPY Install.cmd C:\TEMP\ ADD https://aka.ms/vscollect.exe C:\TEMP\collect.exe # Download channel for fixed install. -ARG CHANNEL_URL=https://aka.ms/vs/15/release/channel +ARG CHANNEL_URL=https://aka.ms/vs/16/release/channel ADD ${CHANNEL_URL} C:\TEMP\VisualStudio.chman # Download and install Build Tools for Visual Studio 2017 for native desktop workload. -ADD https://aka.ms/vs/15/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe +ADD https://aka.ms/vs/16/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe RUN C:\TEMP\Install.cmd C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache ` --channelUri C:\TEMP\VisualStudio.chman ` --installChannelUri C:\TEMP\VisualStudio.chman ` - --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended` + --add Microsoft.VisualStudio.Workload.VCTools ` + --add Microsoft.VisualStudio.Workload.UniversalBuildTools ` + --add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ` + --add Microsoft.VisualStudio.Component.VC.Tools.ARM ` + --add Microsoft.VisualStudio.Component.UWP.VC.ARM64 ` + --includeRecommended ` --installPath C:\BuildTools RUN Get-ChildItem C:\BuildTools +RUN Get-ChildItem C:\BuildTools\VC\Tools\MSVC +RUN Get-ChildItem 'C:\Program Files (x86)\Windows Kits\10\lib' RUN pip3 install meson @@ -50,4 +57,4 @@ COPY prepare_gst_env.ps1 C:\ RUN C:\prepare_gst_env.ps1 COPY prepare_cerbero_env.sh C:\ -RUN C:\MinGW\msys\1.0\bin\bash.exe --login -c "C:/prepare_cerbero_env.sh" \ No newline at end of file +RUN C:\MinGW\msys\1.0\bin\bash.exe --login -c "C:/prepare_cerbero_env.sh" diff --git a/ci/docker/windows/Install.cmd b/ci/docker/windows/Install.cmd index f3b73d0df7..8b5af12a50 100644 --- a/ci/docker/windows/Install.cmd +++ b/ci/docker/windows/Install.cmd @@ -25,8 +25,11 @@ if "%ERRORLEVEL%"=="3010" ( ) else ( if not "%ERRORLEVEL%"=="0" ( set ERR=%ERRORLEVEL% - call C:\TEMP\collect.exe -zip:C:\vslogs.zip - + if "%CI_PROJECT_PATH%"=="" ( + call C:\TEMP\collect.exe -zip:C:\vslogs.zip + ) else ( + call C:\TEMP\collect.exe -zip:%CI_PROJECT_PATH%\vslogs.zip + ) exit /b !ERR! ) ) diff --git a/ci/meson/vs2019-arm64-cross-file.txt b/ci/meson/vs2019-arm64-cross-file.txt new file mode 100644 index 0000000000..21b05dbb4d --- /dev/null +++ b/ci/meson/vs2019-arm64-cross-file.txt @@ -0,0 +1,23 @@ +[constants] +vs_path = 'C:\BuildTools' +msvc_version = '14.29.30133' +msvc_version_dir = vs_path / 'VC\Tools\MSVC' / msvc_version +msvc_arm64_bindir = msvc_version_dir / 'bin\Hostx64\arm64' +msvc_arm64_libdir = msvc_version_dir / 'lib\arm64' + +[host_machine] +system = 'windows' +cpu_family = 'aarch64' +cpu = 'aarch64' +endian = 'little' + +[properties] +needs_exe_wrapper = true + +[binaries] +lib = msvc_arm64_bindir / 'lib.exe' +c = msvc_arm64_bindir / 'cl.exe' +c_ld = msvc_arm64_bindir / 'link.exe' +cpp = msvc_arm64_bindir / 'cl.exe' +cpp_ld = msvc_arm64_bindir / 'link.exe' +pkgconfig = 'false' diff --git a/ci/meson/vs2019-x64-native-file.txt b/ci/meson/vs2019-x64-native-file.txt new file mode 100644 index 0000000000..f4568d75a6 --- /dev/null +++ b/ci/meson/vs2019-x64-native-file.txt @@ -0,0 +1,38 @@ +[constants] +vs_path = 'C:\BuildTools' +msvc_version = '14.29.30133' +msvc_version_dir = vs_path / 'VC\Tools\MSVC' / msvc_version +msvc_x64_bindir = msvc_version_dir / 'bin\Hostx64\x64' +msvc_x64_libdir = msvc_version_dir / 'lib\x64' +wk_path = 'C:\Program Files (x86)\Windows Kits' +wk_version = '10.0.19041.0' +wk_x64_libdir = wk_path / '10\lib' / wk_version / 'um\x64' +wk_x64_crt_libdir = wk_path / '10\lib' / wk_version / 'ucrt\x64' +# Forcibly link to x64 libs when using native linker, otherwise the LIB +# variable in the env will cause link.exe to pick up libs from the cross +# msvc libdir. A better fix might be to use a wrapper script that calls +# link.exe inside the correct VS environment for x64. +msvc_x64_libs = [msvc_x64_libdir / 'msvcrt.lib', msvc_x64_libdir / 'msvcrtd.lib', msvc_x64_libdir / 'vcruntime.lib', msvc_x64_libdir / 'oldnames.lib', wk_x64_crt_libdir / 'ucrt.lib'] + +[host_machine] +system = 'windows' +cpu_family = 'x86_64' +cpu = 'x86_64' +endian = 'little' + +[properties] +needs_exe_wrapper = true + +[built-in options] +# Ensure that x64 libs are used for linking even when we're inside, say, an +# arm64 VS environment +c_link_args = ['/LIBPATH:' + wk_x64_libdir] + msvc_x64_libs +cpp_link_args = ['/LIBPATH:' + wk_x64_libdir] + msvc_x64_libs + +[binaries] +lib = msvc_x64_bindir / 'lib.exe' +c = msvc_x64_bindir / 'cl.exe' +c_ld = msvc_x64_bindir / 'link.exe' +cpp = msvc_x64_bindir / 'cl.exe' +cpp_ld = msvc_x64_bindir / 'link.exe' +pkgconfig = 'false'