summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/link.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2018-04-21 00:58:25 +0800
committerruki <[email protected]>2018-04-20 23:50:31 +0800
commitf7aa6e451f1197f59f6f6ca41cf76d200bef50f4 (patch)
tree5faab944eecfc873821d88f23cc878930536b27b /xmake/modules/core/tools/link.lua
parent598ea9abf5fb2439da4c85e323335a6fbeaed6db (diff)
fix generate vs201x project bug
Diffstat (limited to 'xmake/modules/core/tools/link.lua')
-rw-r--r--xmake/modules/core/tools/link.lua24
1 files changed, 9 insertions, 15 deletions
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