summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-10-27 23:55:19 +0800
committerruki <[email protected]>2022-10-27 23:55:19 +0800
commitfbe995a3b9d8b4672e55882d14d49678053d3415 (patch)
tree215d8d4f71670a2b19d34744bd9bde341aa84b7f
parent57674e8882d2c3d002a8212623bab76e42b4aaf7 (diff)
improve tools.xmake
-rw-r--r--xmake/core/main.lua2
-rw-r--r--xmake/modules/package/tools/xmake.lua6
2 files changed, 7 insertions, 1 deletions
diff --git a/xmake/core/main.lua b/xmake/core/main.lua
index e5feb7d14..173eb002c 100644
--- a/xmake/core/main.lua
+++ b/xmake/core/main.lua
@@ -125,9 +125,11 @@ function main._init()
-- get project directory and project file from the argument option
local options, err = main._basicparse()
+ utils.dump(options)
if not options then
return false, err
end
+ print("options.project", options.project)
-- init project paths only for xmake engine
if xmake._NAME == "xmake" then
diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua
index bcef47abe..1c74a6851 100644
--- a/xmake/modules/package/tools/xmake.lua
+++ b/xmake/modules/package/tools/xmake.lua
@@ -142,6 +142,7 @@ end
function _set_builtin_argv(argv)
-- if the package cache directory is modified,
-- we need to force the project directory to be specified to avoid interference by the upper level xmake.lua.
+ -- and we also need to put `-P` in the first argument to avoid option.parse() parsing errors
local cachedir = os.getenv("XMAKE_PKG_CACHEDIR") or global.get("pkg_cachedir")
if cachedir then
table.insert(argv, "-P")
@@ -249,8 +250,11 @@ function install(package, configs, opt)
end
-- pass configurations
- local argv = {"f", "-y", "-c"}
+ -- we need to put `-P` in the first argument of _set_builtin_argv() to avoid option.parse() parsing errors
+ local argv = {"f"}
_set_builtin_argv(argv)
+ table.insert(argv, "-y")
+ table.insert(argv, "-c")
for name, value in pairs(_get_configs(package, configs)) do
value = tostring(value):trim()
if type(name) == "number" then