summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpportunity <[email protected]>2020-01-19 10:55:59 +0800
committerOpportunity <[email protected]>2020-01-19 13:01:09 +0800
commit67114b6ee85043644728ac86da46dc70373dce71 (patch)
tree39cdc1148e885b3fd51693bd427a52dabae6664e
parent64e5558f64182191e39037f3bbce9a1b7bdf3a5b (diff)
fix run targets
-rw-r--r--xmake/actions/config/xmake.lua3
-rw-r--r--xmake/actions/run/xmake.lua16
2 files changed, 16 insertions, 3 deletions
diff --git a/xmake/actions/config/xmake.lua b/xmake/actions/config/xmake.lua
index 1f04ce1a8..6cb5b2247 100644
--- a/xmake/actions/config/xmake.lua
+++ b/xmake/actions/config/xmake.lua
@@ -129,8 +129,7 @@ task("config")
, {category = "Other Configuration"}
, {nil, "debugger", "kv", "auto" , "The Debugger" }
- , {nil, "ccache", "kv", true , "Enable or disable the c/c++ compiler cache."
- , " --ccache=[y|n]" }
+ , {nil, "ccache", "kv", true , "Enable or disable the c/c++ compiler cache." }
, {'o', "buildir", "kv", "build" , "Set the build directory." }
, {}
diff --git a/xmake/actions/run/xmake.lua b/xmake/actions/run/xmake.lua
index f33184be5..bfdce3af1 100644
--- a/xmake/actions/run/xmake.lua
+++ b/xmake/actions/run/xmake.lua
@@ -49,7 +49,21 @@ task("run")
" --workdir=`pwd`" }
, {}
, {nil, "target", "v", nil , "The target name. It will run all default targets if this parameter is not specified."
- , values = function () return try{ function () return table.keys(import("core.project.project").targets()) end } end }
+ , values = function ()
+ return try{
+ function ()
+ import("core.project.project")
+ local targets = project.targets()
+ local runable = {}
+ for k, v in pairs(targets) do
+ if v:script("run") or v:get("kind") == "binary" then
+ table.insert(runable, k)
+ end
+ end
+ return runable
+ end
+ }
+ end }
, {nil, "arguments", "vs", nil , "The target arguments" }
}
}