summaryrefslogtreecommitdiff
path: root/xmake/plugins
diff options
context:
space:
mode:
authorruki <[email protected]>2023-02-03 22:32:32 +0800
committerruki <[email protected]>2023-02-03 22:32:32 +0800
commitc3b0e85ebcc5583deaa87a7391b3dd09fa48ccf7 (patch)
treee9ec9a79b76beb1f1bb52957a174bc46d1b27efa /xmake/plugins
parent02f7c8dd80563a6737e2b65709f16b3d56fdff6a (diff)
show target linker and compiler flags
Diffstat (limited to 'xmake/plugins')
-rw-r--r--xmake/plugins/show/info/target.lua21
1 files changed, 20 insertions, 1 deletions
diff --git a/xmake/plugins/show/info/target.lua b/xmake/plugins/show/info/target.lua
index 0da708361..f98a8aaeb 100644
--- a/xmake/plugins/show/info/target.lua
+++ b/xmake/plugins/show/info/target.lua
@@ -20,6 +20,7 @@
-- imports
import("core.base.option")
+import("core.base.hashset")
import("core.project.config")
import("core.project.project")
import("core.language.language")
@@ -59,7 +60,7 @@ function _show_target(target)
local values_from_deps = target:get_from_deps(valuename)
local values_from_opts = target:get_from_opts(valuename)
local values_from_pkgs = target:get_from_pkgs(valuename)
- values = table.join(values or {}, values_from_deps or {}, values_from_opts or {}, values_from_pkgs or {})
+ values = table.unique(table.join(values or {}, values_from_deps or {}, values_from_opts or {}, values_from_pkgs or {}))
if #values > 0 then
cprint(" ${color.dump.string}%s${clear}:", valuename)
for _, value in ipairs(values) do
@@ -76,6 +77,24 @@ function _show_target(target)
cprint(" ${color.dump.reference}->${clear} %s", file)
end
end
+ local sourcekinds = hashset.new()
+ for _, sourcebatch in pairs(target:sourcebatches()) do
+ if sourcebatch.sourcekind then
+ sourcekinds:insert(sourcebatch.sourcekind)
+ end
+ end
+ for _, sourcekind in sourcekinds:keys() do
+ local compinst = target:compiler(sourcekind)
+ if compinst then
+ cprint(" ${color.dump.string}compflags (%s)${clear}: %s", sourcekind, compinst:program())
+ cprint(" ${color.dump.reference}->${clear} %s", os.args(compinst:compflags({target = target})))
+ end
+ end
+ local linker = target:linker()
+ if linker then
+ cprint(" ${color.dump.string}linkflags (%s)${clear}: %s", linker:kind(), linker:program())
+ cprint(" ${color.dump.reference}->${clear} %s", os.args(linker:linkflags({target = target})))
+ end
end
function main(name)