diff options
| author | ruki <[email protected]> | 2022-12-13 21:04:31 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-12-13 21:04:31 +0800 |
| commit | a8b0c74065f49c2720776f2d7bb65c4e3b4c3ef9 (patch) | |
| tree | 38ea25619303f30fcba6357aa569fca5cf5b01ea /xmake/core/project | |
| parent | 06876b8b33ae91a5dd12f8b94b295f3546885c8a (diff) | |
add default componments
Diffstat (limited to 'xmake/core/project')
| -rw-r--r-- | xmake/core/project/package.lua | 5 | ||||
| -rw-r--r-- | xmake/core/project/target.lua | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/xmake/core/project/package.lua b/xmake/core/project/package.lua index fcd89afa3..9e899d2a3 100644 --- a/xmake/core/project/package.lua +++ b/xmake/core/project/package.lua @@ -146,6 +146,11 @@ function _instance:components() return self:get("components") end +-- get default components +function _instance:components_default() + return self:get("__components_default") +end + -- get components list with link order function _instance:components_orderlist() return self:get("__components_orderlist") diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 2b38e4245..5e70431e9 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -416,9 +416,10 @@ function _instance:get_from_pkgs(name, opt) local configinfo = self:pkgconfig(pkg:name()) -- get values from package components -- e.g. `add_packages("sfml", {components = {"graphics", "window"}})` - if configinfo and configinfo.components and pkg:components() then + local components_default = pkg:components_default() + if configinfo and (configinfo.components or components_default) and pkg:components() then local components_enabled = hashset.new() - for _, comp in ipairs(table.wrap(configinfo.components)) do + for _, comp in ipairs(table.join(configinfo.components or {}, components_default)) do components_enabled:insert(comp) for _, dep in ipairs(table.wrap(pkg:component_orderdeps(comp))) do components_enabled:insert(dep) |
