Skip to content

Add meson build system - #471

Open
moi15moi wants to merge 12 commits into
FFMS:masterfrom
moi15moi:Add-meson
Open

Add meson build system#471
moi15moi wants to merge 12 commits into
FFMS:masterfrom
moi15moi:Add-meson

Conversation

@moi15moi

@moi15moi moi15moi commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

This is a second attempt to add meson build system support (#338) since I believe meson is now a bit more mature. It is still pretty new compare to autotools, but as some benefits (ex: easy cross-compilation, IDE support, support MSVC out of the box).

I did it just for fun, but since it allow to build the unit tests with MSVC, I thought it might be a good idea to share it.

I also tested all the possibilities (ffmpeg->shared + ffms2->shared build, ffmpeg->static+ ffms2->shared build, etc...) in this PR to be sure to cover as many use case as possible.

The second commit is a "bonus", but can be useful since, in the last release, I believe you forgot to include the x86 build (see issue #470). If you want, I can add a arm64 build since windows arm is slowly getting a bit more common.

Also, if you want me to add renovate to automatically update subprojects/AviSynth+.wrap version, tell me.

@moi15moi
moi15moi force-pushed the Add-meson branch 2 times, most recently from 100349f to 8dcda06 Compare February 2, 2026 01:56
@dwbuiten

dwbuiten commented Apr 5, 2026

Copy link
Copy Markdown
Member

If this covers 100% of the functionality of configure, I would love to just nuke autoconf and use only meson.

Comment thread meson.build Outdated
@moi15moi
moi15moi force-pushed the Add-meson branch 4 times, most recently from 3794c8f to 675daae Compare April 6, 2026 20:32
@moi15moi

moi15moi commented Apr 6, 2026

Copy link
Copy Markdown
Contributor Author

If this covers 100% of the functionality of configure, I would love to just nuke autoconf and use only meson.

Yes, it does.
I removed autotools and msbuild support.

I also decided to add a small test on top of introducing meson.
The test assure that our header are always compatible with c99 (to avoid issue like this one: #472 (comment))

PS: Note that you can also use muon to build the project, but you need at least to use a version that include this commit due to a bug (so, muon 0.6.0 and over work fine). muon is usefull for distro that doesn't ship meson 1.3.0 or newer. It allow to build on any distro where gcc support c++11 (because muon simply require gcc 4.5 and c++11 was added in gcc 4.8.1). It is fairly simple to build muon from scratch. See the bootstraping instruction here.

@moi15moi
moi15moi force-pushed the Add-meson branch 2 times, most recently from 084a03d to 605ed85 Compare April 9, 2026 14:03
@moi15moi

moi15moi commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

I just fixed the conflict due to 0fa01d0

Comment thread meson.build
Comment thread test/meson.build Outdated
@myrsloik

Copy link
Copy Markdown
Contributor

Don't remove the the msvc build. It's very useful for testing and debugging and people who want to contribute easily.

@Ichunjo

Ichunjo commented Apr 25, 2026

Copy link
Copy Markdown
  • Maybe I'm missing something but what's the point of adding cygwin?
  • Also, on Windows, why not also using clang and clang++?

Comment thread .github/workflows/ci-meson.yml Outdated
@moi15moi

Copy link
Copy Markdown
Contributor Author

Don't remove the the msvc build. It's very useful for testing and debugging and people who want to contribute easily.

I don't use visual studio, but the option --backend vs doesn't work well for you?

@moi15moi

Copy link
Copy Markdown
Contributor Author
  • Maybe I'm missing something but what's the point of adding cygwin?

Simply, to be sure we still support this platform.

  • Also, on Windows, why not also using clang and clang++?

Because we don't use it in the master branch.

@Ichunjo

Ichunjo commented Apr 25, 2026

Copy link
Copy Markdown
  • Maybe I'm missing something but what's the point of adding cygwin?

Simply, to be sure we still support this platform.

What I was implying is: does it still make sense to support this platform?

  • Also, on Windows, why not also using clang and clang++?

Because we don't use it in the master branch.

Well, maybe it's time to change!

@moi15moi

Copy link
Copy Markdown
Contributor Author

@dwbuiten Do you have any interest in this PR?

@seiya-git

Copy link
Copy Markdown
Contributor

Why still need Cygwin and MSYS if everything can be installed/builded without it?

moi15moi added 7 commits July 30, 2026 09:40
…lease

The workflow "Release Windows artifacts" will be runned when we create a new github release. It will automatically create the .7z file containing the x86 + x64 build and add it to the release.
We cannot use ffmpeg oackage available on cygwin repo because the build doesn't contain a HEVC decoder.
See: https://cygwin.com/pipermail/cygwin/2026-March/259560.html
…vailable to build the project

This allow to fix these errors when compiling on cygwin:
```
../src/vapoursynth/VSHelper4.h:76:9: error: there are no arguments to 'posix_memalign' that depend on a template parameter, so a declaration of 'posix_memalign' must be available [-fpermissive]
   76 |     if (posix_memalign(&tmp, alignment, size))
      |         ^~~~~~~~~~~~~~
../src/index/ffmsindex.cpp:122:20: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
  122 |         pair.Key = strdup(en->key);
      |                    ^~~~~~
      |                    strcmp
```
moi15moi added 5 commits July 30, 2026 09:40
Fix these errors reported by clang:
```
FAILED: [code=1] test/c99_header.p/test.c.o
clang -Itest/c99_header.p -Itest -I../test -I../include -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -Werror -std=c99 -O3 -pedantic -MD -MQ test/c99_header.p/test.c.o -MF test/c99_header.p/test.c.o.d -o test/c99_header.p/test.c.o -c ../test/test.c
In file included from ../test/test.c:2:
../include/ffms.h:436:30: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
  436 | FFMS_API(int) FFMS_GetVersion();
      |                              ^
      |                               void
../include/ffms.h:437:31: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
  437 | FFMS_API(int) FFMS_GetLogLevel();
      |                               ^
      |                                void
```
@moi15moi

Copy link
Copy Markdown
Contributor Author

Why still need Cygwin and MSYS if everything can be installed/builded without it?

MSYS2 is still needed because it provides gcc and clang. GCC and Clang often produce faster and more optimized binaries than MSVC.
For cygwin, I just added it to be sure we still support this platform. Since ffmpeg support it, I believe we should also try our best to support it.

@myrsloik

Copy link
Copy Markdown
Contributor

Just out of curiosity, why don't you simply model this after the bestsource build system/CI? After my latest changes it builds everything with clang and on windows msvc as well. In addition to that it attaches both clang and msvc binaries for windows on release automatically.

This has clogged my github notifications for long enough.

@moi15moi

Copy link
Copy Markdown
Contributor Author

why don't you simply model this after the bestsource build system/CI?

What do you my by "bestsource build system"?
bestsource also use meson, so I'm not sure what you mean.

For the CI, from what I can see, bestsource has

  • build-non-windows-wheel (linux_aarch64, ubuntu-24.04-arm)
  • build-non-windows-wheel (linux_x86_64, ubuntu-latest)
  • build-non-windows-wheel (macosx_arm64, macos-15)
  • build-non-windows-wheel (macosx_x86_64, macos-15-intel)
  • build-windows-wheel
  • build-windows-msvc

ffms2 still doesn't support wheels, so except build-windows-msvc, all of the jobs doesn't really make sense for ffms2.
build-windows-msvc is pretty much the same as my Build on Windows / Test Windows MSVC except that it cache ffmpeg.

I believe it is a good practice to compile code on many platform as possible.
The only differences with the master branch CI is that now, I build the project with clang in msys2, I added cygwin and that I also build the project with muon.

PS: Note that I will add python wheels support to ffms2 in another PR. I am trying first to simply replace autotools with meson first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants