Closed AleksLitynski closed 3 years ago
You can already do this by setting the default_library
option to static
.
Also, this is an old and deprecated repo. All issues should go against the mesonbuild/wrapdb
repo instead.
Welcome! This is indeed a reasonable request. Fortunately, though, it's also possible without any modifications.
This is such an important and valued feature that meson has a special buildtype and global option for it: library()
, which respects -Ddefault_library=static
(You may view all available options by running meson configure
in the top of the source tree, though this is admittedly somewhat terse due to necessity.)
The default value of this setting is "shared" which is why it usually creates a shared library only (you can ask for "both" as well) and we generally encourage every library to empower users to select their preferred linking style rather than hardcoding "static_library" or "shared_library". Of course sometimes a library only works correctly as one of the two, which is why we support that.
So, this should already work out of the box for you.
If you have any more questions, feel free to ask. Remember that as per https://mesonbuild.com/index.html#community you can get in touch with us (the meson developers) as well as many experienced users for casual real-time conversation via IRC. This is the best way to get immediate advice or help, especially if you are not sure whether something is a bug or not.
Note that both static_library('sdl')
, and library('sdl')
with the default type set to static, will produce the same file (that is, 'libsdl.a') so you cannot use both at the same time or you will get an error due to conflicting targets.
I'm new to meson, so excuse me if this isn't a reasonable request, but would it be possible to build a static archive of libsdl2 as well?
I think it's as easy as adding this line to meson.build:
If that checks out, I'm happy to open a PR.