diff options
| author | ruki <[email protected]> | 2020-04-10 22:51:49 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-04-10 11:10:58 +0800 |
| commit | 3bd2ebba2b83e23a06a66e298ea6eaeead5a5bc8 (patch) | |
| tree | 5cb51a4347cf6c117a1a1902aaeacdbd0888bd3e | |
| parent | 9336b598043c56e35e109134cab23fdeb52f5f78 (diff) | |
pass configs to package/xmake
| -rw-r--r-- | xmake/modules/lib/detect/check_cxsnippets.lua | 6 | ||||
| -rw-r--r-- | xmake/modules/package/tools/xmake.lua | 20 |
2 files changed, 18 insertions, 8 deletions
diff --git a/xmake/modules/lib/detect/check_cxsnippets.lua b/xmake/modules/lib/detect/check_cxsnippets.lua index 9c6307f77..4a55ba32a 100644 --- a/xmake/modules/lib/detect/check_cxsnippets.lua +++ b/xmake/modules/lib/detect/check_cxsnippets.lua @@ -191,8 +191,14 @@ function main(snippets, opt) local ok = try { function () + if option.get("diagnosis") then + cprint("${dim}> %s", compiler.compcmd(sourcefile, objectfile, opt)) + end compiler.compile(sourcefile, objectfile, opt) if #links > 0 then + if option.get("diagnosis") then + cprint("${dim}> %s", linker.linkcmd("binary", {"cc", "cxx"}, objectfile, binaryfile, opt)) + end linker.link("binary", {"cc", "cxx"}, objectfile, binaryfile, opt) end return true diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua index 774bb4790..b50f20a7e 100644 --- a/xmake/modules/package/tools/xmake.lua +++ b/xmake/modules/package/tools/xmake.lua @@ -24,10 +24,11 @@ import("core.base.option") -- get configs function _get_configs(package, configs) local configs = configs or {} - local cflags = package:config("cflags") - local cxflags = package:config("cxflags") - local cxxflags = package:config("cxxflags") - local asflags = package:config("asflags") + local cflags = table.join(table.wrap(package:config("cflags")), get_config("cflags")) + local cxflags = table.join(table.wrap(package:config("cxflags")), get_config("cxflags")) + local cxxflags = table.join(table.wrap(package:config("cxxflags")), get_config("cxxflags")) + local asflags = table.join(table.wrap(package:config("asflags")), get_config("asflags")) + local ldflags = table.join(table.wrap(package:config("ldflags")), get_config("ldflags")) if package:is_plat("windows") then local vs_runtime = package:config("vs_runtime") if vs_runtime then @@ -41,16 +42,19 @@ function _get_configs(package, configs) end table.insert(configs, "--mode=" .. (package:debug() and "debug" or "release")) if cflags then - table.insert(configs, "--cflags=" .. cflags) + table.insert(configs, "--cflags=" .. os.args(table.concat(cflags, ' '))) end if cxflags then - table.insert(configs, "--cxflags=" .. cxflags) + table.insert(configs, "--cxflags=" .. os.args(table.concat(cxflags, ' '))) end if cxxflags then - table.insert(configs, "--cxxflags=" .. cxxflags) + table.insert(configs, "--cxxflags=" .. os.args(table.concat(cxxflags, ' '))) end if asflags then - table.insert(configs, "--asflags=" .. asflags) + table.insert(configs, "--asflags=" .. os.args(table.concat(asflags, ' '))) + end + if ldflags then + table.insert(configs, "--ldflags=" .. os.args(table.concat(ldflags, ' '))) end return configs end |
