Add native MSVC build support for Windows - #1477
Conversation
cd41041 to
156b094
Compare
a60ccfd to
a861995
Compare
9b01286 to
a493150
Compare
|
Hi everyone, First of all, apologies for the noise — there were quite a few force‑pushes while I was trying to understand what looked like a regression in the macOS FFmpeg+libvmaf build. I genuinely thought I had introduced the issue myself, and it took a while to figure out what was actually happening. Good news: the PR is now fully green across all platforms, including MSVC, which produces exactly the same VMAF score as the original workflow. A small warning regarding macOS: while investigating, I temporarily removed After dropping all my changes to double‑check, I confirmed that the original workflow also prints this mismatch — it simply goes unnoticed because The difference is very small, but I wanted to highlight it explicitly so reviewers are aware. With everything now stable and the CI behaving consistently, the PR is ready for review. P.S. Ironically, I don’t even use Windows except for gaming — but at least now FFmpeg+libvmaf builds cleanly on MSVC. |
|
Hi @kylophone, just a gentle ping on this PR. I noticed the task list still shows some unfinished items (mainly due to dependencies on other PRs), but the work is actually complete and ready for review. Would really appreciate it if you could take a look whenever you have a moment. Happy to address any feedback! Thanks a lot for maintaining VMAF 🙏 |
I am working my way through the PR backlog. I will be taking a look at this before our next release. |
a493150 to
d6df1bd
Compare
7ff86b3 to
86c9829
Compare
|
@kylophone I've rebased the PR against the latest master and updated the code so everything works again. A couple of notes:
The CI now also tests both the bundled and external pthreads modes on MSVC. Please let me know if you need any further changes. P.S. GitHub Actions is currently hitting network issues (e.g. Chocolatey 503, resource downloads failing), so some CI jobs are red for reasons unrelated to this PR. I don’t have permission to re-run the failed jobs from here. |
e0b09d6 to
75e1b77
Compare
Signed-off-by: David C. Manuelda <StormByte@gmail.com>
Signed-off-by: David C. Manuelda <StormByte@gmail.com>
Signed-off-by: David C. Manuelda <StormByte@gmail.com>
Signed-off-by: David C. Manuelda <StormByte@gmail.com>
- Integrate GerHobbelt/pthread-win32 as bundled implementation - Add -Dbundled_winpthreads option (default: true) - Support detecting external pthreads libraries (pthreadVC3, etc.) Signed-off-by: David C. Manuelda <StormByte@gmail.com>
Signed-off-by: David C. Manuelda <StormByte@gmail.com>
Signed-off-by: David C. Manuelda <StormByte@gmail.com>
Signed-off-by: David C. Manuelda <StormByte@gmail.com>
Signed-off-by: David C. Manuelda <StormByte@gmail.com>
Signed-off-by: David C. Manuelda <StormByte@gmail.com>
Signed-off-by: David C. Manuelda <StormByte@gmail.com>
Signed-off-by: David C. Manuelda <StormByte@gmail.com>
Signed-off-by: David C. Manuelda <StormByte@gmail.com>
Signed-off-by: David C. Manuelda <StormByte@gmail.com>
Signed-off-by: David C. Manuelda <StormByte@gmail.com>
Signed-off-by: David C. Manuelda <StormByte@gmail.com>
Signed-off-by: David C. Manuelda <StormByte@gmail.com>
Building libvmaf with CUDA enabled under MSVC failed because several targets did not receive the winpthread / stdatomic compatibility pieces required on that toolchain: - nvcc fatbin custom targets: missing bundled pthread-win32 include path - cuda_static_lib: missing thread_lib and stdatomic_dependency - CUDA unit tests: same missing deps when compiling picture_cuda.c and ring_buffer.c Additionally: - pass -D_USE_MATH_DEFINES to nvcc so M_PI is defined with the MSVC CRT - replace C99 designated initializers in integer_adm.h with positional ones so the header is valid as C++ host code under nvcc+MSVC Signed-off-by: David C. Manuelda <StormByte@gmail.com>
75e1b77 to
b9a7d03
Compare
|
Hi everyone, Apologies for the additional noise on this PR. I rebased the branch against the latest This should also make life easier for anyone who has been cherry-picking commits from this branch — they will encounter the same merge conflicts when they rebase, so having a clean, up-to-date version here helps keep those references maintainable. No functional changes beyond what was needed to resolve the conflicts. The goal remains the same: solid native MSVC support that continues to work against master. Thanks for your patience! |
Add native MSVC support
This pull request introduces first-class, native MSVC support for
libvmafon Windows.The goal is to enable building, testing, and integrating
libvmafusing the Microsoft Visual C++ toolchain without relying on MinGW/MSYS2, greatly improving compatibility with Windows-native projects and CI environments.Motivation
Until now,
libvmafcould only be built on Windows through MinGW/MSYS2. While functional, this approach had several limitations:This PR adds full native MSVC support, including:
Dependencies / Related PRs
This PR depends on the following PRs being merged first.
Merging them first is especially important to ensure proper credit and authorship for all contributors — particularly for the two PRs that were not authored by me (#1410 and #1428).
Once those PRs are merged upstream, the temporary copies of their commits (included here only for CI to pass) will be removed. This way the original authors receive full and fair attribution in the git history.
The required PRs are:
This ensures:
What’s included
pthread-win32as a git submodule for MSVC buildsmeson,ninja,xxd,cmake)Windows.mddocumentation to include MSVC instructionsCI Improvements
The new GitHub Actions workflow builds both MSYS2 and MSVC in parallel, runs the full test suite under each environment, and uploads artifacts for both toolchains.
Importantly, the inclusion of the Windows MSVC tests (both with FFmpeg and the standalone library) in CI guarantees that Windows support will not be accidentally broken in the future. This provides ongoing assurance and prevents regressions as the project continues to evolve.
Issue reference
Notes
git submodule update --initafter checkout to pull thepthread-win32submodule.About tox tests on Windows
This PR intentionally does not enable the Python
toxtest suite on Windows.While the MSVC build and the C test suite are fully supported, the Python tests rely on several Unix-specific behaviors (e.g.,
fork()-based multiprocessing, POSIX path assumptions, and.exesuffix handling).These issues require non-trivial work to make the tox suite fully compatible with Windows and would significantly increase the scope of this PR.
Windows
toxsupport will be evaluated and implemented in a separate PR once native MSVC support is merged.About the FFmpeg build used in CI
The MSVC CI job also builds FFmpeg to validate that
libvmafintegrates correctly with a Windows-native FFmpeg toolchain. For this purpose, the workflow uses the Meson-based FFmpeg port maintained by the GStreamer project.This port provides a clean Meson build of FFmpeg that supports MSVC out of the box, making it ideal for verifying that
libvmafbuilds and runs correctly in a fully native Windows environment. The Meson-based FFmpeg port is used exclusively for the MSVC job; the Linux and macOS CI jobs continue to use the official FFmpeg repository exactly as before.Status