ci: add Windows native build

x86_64-pc-windows-msvc build without mingw dependency. For now it lacks
some key dependencies like lua or shaderc. Will be extended in the
future.
This commit is contained in:
Kacper Michajłow 2024-05-02 01:15:09 +02:00
parent 006c3ce9fe
commit 0ffabf5d45
2 changed files with 135 additions and 0 deletions

View File

@ -86,6 +86,67 @@ jobs:
name: mpv-${{ matrix.target }}
path: mpv-git-*.zip
win32:
runs-on: windows-latest
env:
VS: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise"
CC: "clang"
CXX: "clang++"
CC_LD: "lld"
CXX_LD: "lld"
WINDRES: "llvm-rc"
steps:
- name: Disable autocrlf
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v4
# https://github.com/mesonbuild/meson/pull/11715
- name: Install dependencies
run: |
git clone https://github.com/kasper93/meson --depth 1 -b 8981
python -m pip install build wheel
python -m build --wheel --no-isolation meson
python -m pip install (Get-Item ./meson/dist/meson-*-py3-none-any.whl).FullName
- name: Update Meson WrapDB
run: |
meson wrap update-db
- name: Build
id: build
run: |
$env:PATH = ($env:PATH -split ';' | Where-Object { $_ -ne 'C:\Program Files\LLVM\bin' }) -join ';'
Import-Module "$env:VS\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath $env:VS -SkipAutomaticLocation -DevCmdArguments "-arch=x64 -host_arch=x64"
./ci/build-win32.ps1
- name: Print build log
if: ${{ failure() && steps.build.outcome == 'failure' }}
run: |
cat ./build/meson-logs/meson-log.txt
- name: Run meson tests
id: tests
run: |
Import-Module "$env:VS\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath $env:VS -SkipAutomaticLocation -DevCmdArguments "-arch=x64 -host_arch=x64"
meson test -C build mpv:
- name: Print meson test log
if: ${{ failure() && steps.tests.outcome == 'failure' }}
run: |
cat ./build/meson-logs/testlog.txt
- uses: actions/upload-artifact@v4
with:
name: mpv-x86_64-windows-msvc
path: |
build/mpv.???
!build/mpv.lib
macos:
runs-on: ${{ matrix.os }}
strategy:

74
ci/build-win32.ps1 Normal file
View File

@ -0,0 +1,74 @@
$ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest
$subprojects = "subprojects"
if (-not (Test-Path $subprojects)) {
New-Item -Path $subprojects -ItemType Directory | Out-Null
}
$projects = @(
@{
Path = "$subprojects/ffmpeg.wrap"
URL = "https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg.git"
Revision = "meson-6.1"
Provides = @(
"libavcodec = libavcodec_dep",
"libavdevice = libavdevice_dep",
"libavfilter = libavfilter_dep",
"libavformat = libavformat_dep",
"libavutil = libavutil_dep",
"libswresample = libswresample_dep",
"libswscale = libswscale_dep"
)
},
@{
Path = "$subprojects/libass.wrap"
URL = "https://github.com/libass/libass"
Revision = "master"
},
@{
Path = "$subprojects/libplacebo.wrap"
URL = "https://code.videolan.org/videolan/libplacebo.git"
Revision = "master"
},
# Remove harfbuzz wrap once the new version with build fixes is released.
@{
Path = "$subprojects/harfbuzz.wrap"
URL = "https://github.com/harfbuzz/harfbuzz"
Revision = "main"
Provides = @(
"harfbuzz = libharfbuzz_dep"
)
}
)
foreach ($project in $projects) {
$content = @"
[wrap-git]
url = $($project.URL)
revision = $($project.Revision)
depth = 1
clone-recursive = true
"@
if ($project.ContainsKey('Provides')) {
$provide = "[provide]`n$($project.Provides -join "`n")"
$content += "`n$provide"
}
Set-Content -Path $project.Path -Value $content
}
meson setup build `
-Ddefault_library=static `
-Dlibmpv=true `
-Dtests=true `
-Dgpl=true `
-Dffmpeg:gpl=enabled `
-Dffmpeg:tests=disabled `
-Dffmpeg:programs=disabled `
-Dlcms2:fastfloat=true `
-Dlibplacebo:demos=false `
-Dlibplacebo:lcms=enabled `
-Dlibplacebo:vulkan=enabled `
-Djavascript=enabled
ninja -C build mpv.exe mpv.com libmpv.a
./build/mpv.com -v --no-config