From 557680f7d6b2a2e7c3d0f04fb0d6529ac7a6d475 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Mon, 10 Jan 2022 19:02:12 -0600 Subject: add prefer_static built-in option By default, meson will try to look for shared libraries first before static ones. In the meson.build itself, one can use the static keyword to control if a static library will be tried first but there's no simple way for an end user performing a build to switch back and forth at will. Let's cover this usecase by adding an option that allows a user to specify if they want dependency lookups to try static or shared libraries first. The writer of the meson.build can manually specify the static keyword where appropriate which will override the value of this option. --- docs/markdown/Builtin-options.md | 1 + docs/markdown/Configuring-a-build-directory.md | 1 + docs/markdown/snippets/prefer_static.md | 9 +++++++++ 3 files changed, 11 insertions(+) create mode 100644 docs/markdown/snippets/prefer_static.md (limited to 'docs/markdown') diff --git a/docs/markdown/Builtin-options.md b/docs/markdown/Builtin-options.md index c524fe4..1e24144 100644 --- a/docs/markdown/Builtin-options.md +++ b/docs/markdown/Builtin-options.md @@ -81,6 +81,7 @@ machine](#specifying-options-per-machine) section for details. | layout {mirror,flat} | mirror | Build directory layout | no | no | | optimization {0, g, 1, 2, 3, s} | 0 | Optimization level | no | no | | pkg_config_path {OS separated path} | '' | Additional paths for pkg-config to search before builtin paths | yes | no | +| prefer_static | false | Whether to try static linking before shared linking | no | no | | cmake_prefix_path | [] | Additional prefixes for cmake to search before builtin paths | yes | no | | stdsplit | true | Split stdout and stderr in test logs | no | no | | strip | false | Strip targets on install | no | no | diff --git a/docs/markdown/Configuring-a-build-directory.md b/docs/markdown/Configuring-a-build-directory.md index 1eb8478..34bde4d 100644 --- a/docs/markdown/Configuring-a-build-directory.md +++ b/docs/markdown/Configuring-a-build-directory.md @@ -31,6 +31,7 @@ a sample output for a simple project. install_umask 0022 [preserve, 0000-0777] Default umask to apply on permissions of installed files layout mirror [mirror, flat] Build directory layout optimization 3 [0, g, 1, 2, 3, s] Optimization level + prefer_static false [true, false] Whether to try static linking before shared linking strip false [true, false] Strip targets on install unity off [on, off, subprojects] Unity build warning_level 1 [0, 1, 2, 3] Compiler warning level to use diff --git a/docs/markdown/snippets/prefer_static.md b/docs/markdown/snippets/prefer_static.md new file mode 100644 index 0000000..c63323b --- /dev/null +++ b/docs/markdown/snippets/prefer_static.md @@ -0,0 +1,9 @@ +## New prefer_static built-in option + +Users can now set a boolean, `prefer_static`, that controls whether or not +static linking should be tried before shared linking. This option acts as +strictly a preference. If the preferred linking method is not successful, +then Meson will fallback and try the other linking method. Specifically +setting the `static` kwarg in the meson.build will take precedence over +the value of `prefer_static` for that specific `dependency` or +`find_library` call. -- cgit v1.1