diff options
| author | ruki <[email protected]> | 2021-07-27 00:48:06 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-07-26 22:49:20 +0800 |
| commit | 00774c391fbe8a56cf523fdc7f72cc79f1f7f4f3 (patch) | |
| tree | 255dff9ac59abec4b0797ff1092023d40c85da52 | |
| parent | 25f50f1c07e20ea4ed6e6f1c0c7f5f410d87724a (diff) | |
improve to generate local package
| -rw-r--r-- | xmake/actions/package/local/main.lua | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/xmake/actions/package/local/main.lua b/xmake/actions/package/local/main.lua index beaaa8862..21c807091 100644 --- a/xmake/actions/package/local/main.lua +++ b/xmake/actions/package/local/main.lua @@ -26,6 +26,19 @@ import("core.project.config") import("core.project.project") import("lib.luajit.bit") +-- get link deps +function _get_linkdeps(target) + local linkdeps = {} + for _, depname in ipairs(target:get("deps")) do + local dep = project.target(depname) + if not ((target:is_binary() or target:is_shared()) and dep:is_static()) then + table.join2(linkdeps, _get_linkdeps(dep)) + table.insert(linkdeps, dep:name()) + end + end + return linkdeps +end + -- package binary function _package_binary(target) @@ -48,10 +61,7 @@ function _package_binary(target) -- generate xmake.lua local file = io.open(path.join(packagedir, "xmake.lua"), "w") if file then - local deps = {} - for _, dep in ipairs(target:orderdeps()) do - table.insert(deps, dep:name()) - end + local deps = _get_linkdeps(target) file:print("package(\"%s\")", packagename) local homepage = option.get("homepage") if homepage then @@ -130,10 +140,7 @@ function _package_library(target) -- generate xmake.lua local file = io.open(path.join(packagedir, "xmake.lua"), "w") if file then - local deps = {} - for _, dep in ipairs(target:orderdeps()) do - table.insert(deps, dep:name()) - end + local deps = _get_linkdeps(target) file:print("package(\"%s\")", packagename) local homepage = option.get("homepage") if homepage then |
