summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-02-13 22:19:55 +0800
committerruki <[email protected]>2018-02-13 07:59:33 +0800
commit658c0ccdc65b63658a21735b21f806923f2fa70b (patch)
treecd7c7cd2196c5e6c2cdad0bcaaae49c8e86093fc
parentcb8e49968ac0a6a602b9d3db74ecb01358ac2115 (diff)
fix pnd output directory bug
-rw-r--r--CHANGELOG.md2
-rw-r--r--xmake/modules/core/tools/cl.lua17
2 files changed, 18 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 29859b7d8..6b191f12a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@
### 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
## v2.1.9
@@ -441,6 +442,7 @@
### Bugs修复
* 修复无法通过`add_ldflags("xx", "xx", {force = true})`强制设置多个flags的问题
+* [#157](https://github.com/tboox/xmake/issues/157): 修复pdb符号输出目录不存在情况下编译失败问题
## v2.1.9
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index 91946eefb..c0f4b369c 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -97,7 +97,19 @@ function nf_symbol(self, level, target)
-- debug? generate *.pdb file
local flags = nil
if level == "debug" then
+ local symbolfile = nil
if target and target.symbolfile then
+ symbolfile = target:symbolfile()
+ end
+ if symbolfile then
+
+ -- ensure the object directory
+ local symboldir = path.directory(symbolfile)
+ if not os.isdir(symboldir) then
+ os.mkdir(symboldir)
+ end
+
+ -- check and add symbol output file
flags = "-Zi -Fd" .. target:symbolfile()
if self:has_flags({"-Zi", "-FS", "-Fd" .. os.tmpfile() .. ".pdb"}) then
flags = "-FS " .. flags
@@ -360,7 +372,10 @@ end
function _compile1(self, sourcefile, objectfile, depinfo, flags)
-- ensure the object directory
- os.mkdir(path.directory(objectfile))
+ local objectdir = path.directory(objectfile)
+ if not os.isdir(objectdir) then
+ os.mkdir(objectdir)
+ end
-- compile it
local outdata = try