summaryrefslogtreecommitdiff
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
parent598ea9abf5fb2439da4c85e323335a6fbeaed6db (diff)
fix generate vs201x project bug
-rw-r--r--CHANGELOG.md8
-rw-r--r--xmake/modules/core/tools/link.lua24
2 files changed, 15 insertions, 17 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8e1b94a7b..1f620d6d0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,19 +9,21 @@
* Add builtin rules: `mode:debug`, `mode:release`, `mode:profile` and `mode:check`
* Add `is_mode`, `is_arch` and `is_plat` builtin apis in the custom scripts
* Add color256 codes
+* [#160](https://github.com/tboox/xmake/issues/160): Add Qt compilation environment support and add `qt.console`, `qt.application` rules
### Changes
* Add FAQ to the auto-generated xmake.lua
* Support android NDK >= r14
* Improve warning flags for swiftc
-* Improve custom rules
+* [#167](https://github.com/tboox/xmake/issues/167): Improve custom rules
### Bugs fixed
* Fix force to add flags bug
* [#157](https://github.com/tboox/xmake/issues/157): Fix generate pdb file error if it's output directory does not exists
* Fix strip all symbols bug for macho target file
+* [#168](https://github.com/tboox/xmake/issues/168): Fix generate vs201x project bug with x86/x64 architectures
## v2.1.9
@@ -454,19 +456,21 @@
* 添加内建规则:`mode:debug`, `mode:release`, `mode:profile`和`mode:check`
* 添加`is_mode`, `is_arch` 和`is_plat`内置接口到自定义脚本域
* 添加color256代码
+* [#160](https://github.com/tboox/xmake/issues/160): 增加对Qt SDK编译环境的跨平台支持,并且增加`qt.console`, `qt.application`等规则
### 改进
* 添加FAQ到自动生成的xmake.lua文件,方便用户快速上手
* 支持Android NDK >= r14的版本
* 改进swiftc对warning flags的支持
-* 改进自定义规则:`rule()`
+* [#167](https://github.com/tboox/xmake/issues/167): 改进自定义规则:`rule()`
### Bugs修复
* 修复无法通过`add_ldflags("xx", "xx", {force = true})`强制设置多个flags的问题
* [#157](https://github.com/tboox/xmake/issues/157): 修复pdb符号输出目录不存在情况下编译失败问题
* 修复对macho格式目标strip all符号失效问题
+* [#168](https://github.com/tboox/xmake/issues/168): 修复生成vs201x工程插件,在x64下失败的问题
## v2.1.9
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