From f7aa6e451f1197f59f6f6ca41cf76d200bef50f4 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 21 Apr 2018 00:58:25 +0800 Subject: fix generate vs201x project bug --- xmake/modules/core/tools/link.lua | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'xmake/modules/core/tools/link.lua') diff --git a/xmake/modules/core/tools/link.lua b/xmake/modules/core/tools/link.lua index c60dd5100..b9f71c7b1 100644 --- a/xmake/modules/core/tools/link.lua +++ b/xmake/modules/core/tools/link.lua @@ -27,26 +27,15 @@ import("core.project.config") -- init it function init(self) - - -- the architecture - local arch = config.get("arch") - - -- init flags for architecture - local flags_arch = "" - if arch == "x86" then - flags_arch = "-machine:x86" - elseif arch == "x64" then - flags_arch = "-machine:x64" - end - + -- init ldflags - _g.ldflags = { "-nologo", "-dynamicbase", "-nxcompat", flags_arch} + _g.ldflags = { "-nologo", "-dynamicbase", "-nxcompat"} -- init arflags - _g.arflags = {"-nologo", flags_arch} + _g.arflags = {"-nologo"} -- init shflags - _g.shflags = {"-nologo", flags_arch} + _g.shflags = {"-nologo"} -- init flags map _g.mapflags = @@ -63,6 +52,11 @@ end -- get the property function get(self, name) + local values = _g[name] + if name == "ldflags" or name == "arflags" or name == "shflags" then + -- switch architecture, @note does cache it in init() + values = table.join(values, "-machine:" .. (config.arch() or "x86")) + end return _g[name] end -- cgit v1.3.1