diff options
| author | ruki <[email protected]> | 2020-06-22 22:57:24 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-06-22 11:44:26 +0800 |
| commit | f78cbc917b997ffaee1f4663472064d5d9515760 (patch) | |
| tree | 78ba8f204ed0992292c171ee385b3f39fa1c662e | |
| parent | e890b1203d110f8b66cb61da6699bdc19e1b5651 (diff) | |
add kind config for package
| -rw-r--r-- | xmake/actions/require/impl/package.lua | 1 | ||||
| -rw-r--r-- | xmake/core/package/package.lua | 11 |
2 files changed, 10 insertions, 2 deletions
diff --git a/xmake/actions/require/impl/package.lua b/xmake/actions/require/impl/package.lua index 9bc25e3a4..c0f7f7d0e 100644 --- a/xmake/actions/require/impl/package.lua +++ b/xmake/actions/require/impl/package.lua @@ -139,6 +139,7 @@ function _parse_require(require_str, requires_extra, parentinfo) version = version, plat = require_extra.plat, -- require package in the given platform arch = require_extra.arch, -- require package in the given architecture + kind = require_extra.kind, -- default: library, set package kind, e.g. binary, library, we can set `kind = "binary"` to only detect binary program and ignore library. alias = require_extra.alias, -- set package alias name group = require_extra.group, -- only uses the first package in same group system = require_extra.system, -- default: true, we can set it to disable system package manually diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index d47f0fc4e..5dabc8f0b 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -244,9 +244,16 @@ function _instance:revision(url_alias) return self:sourcehash(url_alias) end --- get the package kind, binary or nil(static, shared) +-- get the package kind, binary or nil(library) function _instance:kind() - return self:get("kind") + local kind = self:get("kind") + if not kind then + local requireinfo = self:requireinfo() + if requireinfo then + kind = requireinfo.kind + end + end + return kind end -- get the filelock of the whole package directory |
