Meson build system
Hello,
in this issue, we talked about exploring meson as an alternate build system. The first prototype is ready and can be found here. The build currently works like that:
$ ./generate_lnInclude.py
$ ./generate_meson_build.py
$ /path/to/the/correct/version/of/meson.py setup your_build_directory
$ ninja -C your_build_directory
the ./generate_meson_build.py
command requires the OpenFOAM environment to be set, the other 3 commands don't.
Note that you currently need this version of meson. I will work to get that merged into the original meson.
Please don't forget that this is just the first prototype. Today is literally the first day that it builds on my machine without Allwmake being run prior. So don't suggest things that are obvious like "you forgot the add the license notes in some files" or "you still have some todo comments" or "you need to cleanup the code". Please only suggest non-obvious things. If the build does not work on your machine, it is probably because the dependency lookup of things like scotch or metis or kahip is only tested for my machine.
generate_lnInclude.py
makes symlinks into lnInclude directories and generate_meson_build.py
is a very hacky script that creates the meson.build
files.
If we like this Prototype and we decide to continue working on meson I will remove the necessity for generate_lnInclude.py
. We would ship the meson.build files, so generate_meson_build.py
would be either never run, or only run by build-system developers.
If running generate_meson_build.py
does not work on your machine or you want to look at the results without having to setup everything, this patch are the generated meson.build files.
Before you do performance tests of meson vs wmake, you should note that we currently link some things a bit different than wmake, so linking will get faster.
What I like about this meson/prototype:
-
Meson is far better at knowing if something needs to be rebuild or not. If you forget to add a file to Make/files, but you include that file,
wmake
will not rebuild your code if you change this file. if you change a meson.build file, meson will rebuild all targets affected by the changes, but not rebuild the other targets. -
Unlike wmake, meson is used by a lot of other projects. This means better tooling support, better community support and better documentation. It also means newcomers to the projects might already know meson.
-
If everything is up to date, ./Allwmake takes a long time, but
ninja
takes less than a second if everything is up to date. -
The meson.build files are really easy to read, no comparison the the wmake folder that has bash scripts and hard to read makefiles. For an outsider, it is far easier to read those meson.build files and understand than, than to read and understand the root/wmake folder. The only part complicated thing in the meson.build files are the two topological sorts at the bottom of root/meson.build (the
foreach step : [1,1,1,1,1,1,1,1,1,1,1,1,1,1,0]
loops). Note that I'm currently working on getting this algorithm into the meson master branch (see https://github.com/mesonbuild/meson/issues/8178).
What do you think of this prototype?