-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Meson presets #10421
Comments
Machine files can already contain built-in/project options (anything that is a |
@eli-schwartz how to do it automatically like cmake --preset 'clang-release'? CMake then reads preset from file (not only cache -D variables, but also binary dir, destdir, toolchain file, build configuration and other), and configure itself. Next thing we can do 'cmake --build --preset 'clang-release', and if build subpreset 'clang-release' is defined and inherits first preset, then we can use build configuration and other fancy things. |
I'm not sure I understand the question.
Becomes
This is the same way you'd use any machine file. What is a "build subpreset"? Only meson setup has configuration options, running ninja doesn't have configuration options -- all you can do is control system resource usage e.g. parallelism by way of number of cores, system load, etc. or debug ninja itself via |
@eli-schwartz I see. So, one native file per preset. It is possible to set builddir in native file? CMake Presets have such a feature. Let's say : meson --native-file presets/release.ini #should define also build directrory, where meson runs.
meson --compile --native-file presets/release.ini #should invoke ninja in that build directory
meson --install --native-file presets/release.ini #should invoke ninja in that build directory And such with all meson commands. It is possible now? Build subpreset define CMake build options (parallelism, sysload and more), which, in fact, goes to ninja or any other generator (VS, XCode) |
Presets make zero sense for the compile and install commands. They will not be added to Meson and if cmake supports this then this is a bug in cmake's option parsing because they use flags instead of subcommands. This should be reported to cmake upstream and fixed. |
This is currently not possible. Also it is ambiguous if the builddir is relative (is it relative to your current directory or to the source tree?) and probably broken if it is absolute (only works on one machine, cannot be checked into git) so I wonder what the best choice here is? Intuitively this doesn't feel like a profile setting, which I guess is why no one thought to make it one before. |
@eli-schwartz differences between native files and CMake presets:
|
Meson already has presets for test, but they are used via Having special names to build a specific group of targets is possible via I see no point in confusingly sharing a file format for setting up configuration options that also supports ignoring most of the file and just using a builddir for non--setup commands. Also, the command-line option to specify a preset is longer to type than I still believe that cmake is wrong here, but okay, apparently they deliberately added broken concepts. 🤷♂️ |
It seems to me most is already covered by native files indeed. Not sure it really makes sense to have the builddir in a preset, worst case you can also just ship a small configure.sh wrapper that calls "meson setup builddir --native-file presets/foo.ini" if you really want. |
It would be nice to support MesonPresets.json file in source root, which should be like CMakePresets.json. Then subprojects can define their preferred build modes with presets, and main projects too.
And for use writing JSON once is better, than wrtite a bunch of commandline options every time. And for IDEs JSON is good.
I do not think than CMakePresets.json can be supported directly, but file like this (for automating commandline options and just write like meson --preset to get automatic build is very nice for CI and reproducible builds approach in conjunction with cross-file.
The text was updated successfully, but these errors were encountered: