ruki vor 3 Jahren
Ursprung
Commit
cf3880d718
1 geänderte Dateien mit 21 neuen und 6 gelöschten Zeilen
  1. 21 6
      scripts/test.lua

+ 21 - 6
scripts/test.lua

@@ -14,6 +14,7 @@ local options =
 ,   {'a', "arch",       "kv", nil, "Set the given architecture."                }
 ,   {'m', "mode",       "kv", nil, "Set the given mode."                        }
 ,   {'j', "jobs",       "kv", nil, "Set the build jobs."                        }
+,   {'f', "configs",    "kv", nil, "Set the configs."                           }
 ,   {nil, "linkjobs",   "kv", nil, "Set the link jobs."                         }
 ,   {nil, "cflags",     "kv", nil, "Set the cflags."                            }
 ,   {nil, "cxxflags",   "kv", nil, "Set the cxxflags."                          }
@@ -102,13 +103,27 @@ function _require_packages(argv, packages)
     if argv.linkjobs then
         table.insert(require_argv, "--linkjobs=" .. argv.linkjobs)
     end
-    if argv.mode == "debug" and argv.kind == "shared" then
-        table.insert(require_argv, "--extra={debug=true,configs={shared=true}}")
-    elseif argv.mode == "debug" then
-        table.insert(require_argv, "--extra={debug=true}")
-    elseif argv.kind == "shared" then
-        table.insert(require_argv, "--extra={configs={shared=true}}")
+    local extra = {}
+    if argv.mode == "debug" then
+        extra.debug = true
+    end
+    if argv.kind == "shared" then
+        extra.configs = extra.configs or {}
+        extra.configs.shared = true
+    end
+    local configs = argv.configs
+    if configs then
+        extra.system  = false
+        extra.configs = extra.configs or {}
+        local extra_configs, errors = ("{" .. configs .. "}"):deserialize()
+        if extra_configs then
+            table.join2(extra.configs, extra_configs)
+        else
+            raise(errors)
+        end
     end
+    local extra_str = string.serialize(extra, {indent = false, strip = true})
+    table.insert(require_argv, "--extra=" .. extra_str)
     table.join2(require_argv, packages)
     os.vexecv("xmake", require_argv)
 end