summaryrefslogtreecommitdiff
path: root/xmake/modules/package/tools/meson.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2025-05-09 20:41:12 +0800
committerGitHub <[email protected]>2025-05-09 20:41:12 +0800
commitd88bd9c5ace6c64981420569fb886f7c646135c0 (patch)
treef4c6b8b797e9b48f417762167ddfcfada415bd3d /xmake/modules/package/tools/meson.lua
parent5046da0147f80e4548d7b30fd867d1388e6995ab (diff)
parentd2510d16dbb6812e2a23721f1de4467b32099a4e (diff)
Merge pull request #6409 from Arthapz/fix-cmake-meson-sharedlibraries
(cmake, meson) append shared/static libraries flag by default when installing packages
Diffstat (limited to 'xmake/modules/package/tools/meson.lua')
-rw-r--r--xmake/modules/package/tools/meson.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/xmake/modules/package/tools/meson.lua b/xmake/modules/package/tools/meson.lua
index 2e75e0459..c4821d549 100644
--- a/xmake/modules/package/tools/meson.lua
+++ b/xmake/modules/package/tools/meson.lua
@@ -330,6 +330,7 @@ function _get_configs(package, configs, opt)
-- add prefix
configs = configs or {}
+ opt._configs_str = string.serialize(configs, {indent = false, strip = true})
table.insert(configs, "--prefix=" .. (opt.prefix or package:installdir()))
table.insert(configs, "--libdir=lib")
@@ -351,6 +352,14 @@ function _get_configs(package, configs, opt)
table.insert(configs, "-Db_sanitize=address")
end
+ -- add library kind
+ if package:is_library() then
+ local has_already_libflag = opt._configs_str and opt._configs_str:find("default_library", 1, true)
+ if not has_already_libflag then
+ table.insert(configs, "-Ddefault_library=".. (package:config("shared") and "shared" or "static"))
+ end
+ end
+
-- add vs runtimes flags
if package:is_plat("windows") then
table.insert(configs, "--vsenv")