diff options
| author | ruki <[email protected]> | 2016-07-24 22:32:07 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-07-24 22:32:07 +0800 |
| commit | d03e84b7370c337dc121e4427d20e0948e977356 (patch) | |
| tree | 9155330f93c28befd8a8fa1f7508675d17c6cd8a | |
| parent | ac2b15dd34b40f1cf24d91856192b26cd772686e (diff) | |
enable pdb for windows
| -rwxr-xr-x | xmake/actions/clean/main.lua | 3 | ||||
| -rwxr-xr-x | xmake/actions/package/main.lua | 6 | ||||
| -rw-r--r-- | xmake/core/project/target.lua | 18 | ||||
| -rw-r--r-- | xmake/core/tool/archiver.lua | 13 | ||||
| -rw-r--r-- | xmake/core/tool/compiler.lua | 11 | ||||
| -rw-r--r-- | xmake/core/tool/linker.lua | 15 | ||||
| -rw-r--r-- | xmake/tools/ar.lua | 5 | ||||
| -rwxr-xr-x | xmake/tools/cl.lua | 19 | ||||
| -rwxr-xr-x | xmake/tools/gcc.lua | 2 | ||||
| -rwxr-xr-x | xmake/tools/link.lua | 12 | ||||
| -rw-r--r-- | xmake/tools/swiftc.lua | 2 |
11 files changed, 92 insertions, 14 deletions
diff --git a/xmake/actions/clean/main.lua b/xmake/actions/clean/main.lua index 5657e586a..8acfa6df9 100755 --- a/xmake/actions/clean/main.lua +++ b/xmake/actions/clean/main.lua @@ -62,6 +62,9 @@ function _on_clean_target(target) -- remove the target arguments file if exists _remove(target:targetfile() .. ".arg") + -- remove the symbol file + _remove(target:symbolfile()) + -- remove the object files _remove(target:objectfiles()) diff --git a/xmake/actions/package/main.lua b/xmake/actions/package/main.lua index 257c88d3b..4219e6800 100755 --- a/xmake/actions/package/main.lua +++ b/xmake/actions/package/main.lua @@ -40,6 +40,12 @@ function _package_library(target) -- copy the library file to the output directory os.cp(target:targetfile(), format("%s/%s.pkg/lib/$(mode)/$(plat)/$(arch)/%s", outputdir, targetname, path.filename(target:targetfile()))) + -- copy the symbol file to the output directory + local symbolfile = target:symbolfile() + if os.isfile(symbolfile) then + os.cp(symbolfile, format("%s/%s.pkg/lib/$(mode)/$(plat)/$(arch)/%s", outputdir, targetname, path.filename(symbolfile))) + end + -- copy the config.h to the output directory local configheader = target:configheader() if configheader then diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 7da6bd7a7..50d018038 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -119,6 +119,24 @@ function target:targetfile() return path.join(targetdir, filename) end +-- get the symbol file +function target:symbolfile() + + -- check + assert(self) + + -- the target directory + local targetdir = self:get("targetdir") or config.get("buildir") + assert(targetdir and type(targetdir) == "string") + + -- the symbol file name + local filename = target.filename(self:name(), "symbol") + assert(filename) + + -- make the symbol file path + return path.join(targetdir, filename) +end + -- get the config header files function target:configheader(outputdir) diff --git a/xmake/core/tool/archiver.lua b/xmake/core/tool/archiver.lua index 50cee5c65..81a9d060a 100644 --- a/xmake/core/tool/archiver.lua +++ b/xmake/core/tool/archiver.lua @@ -161,6 +161,12 @@ function archiver:_addflags_from_target(flags, target) for _, strip in ipairs(table.wrap(target:get("strip"))) do table.join2(flags, self:strip(strip)) end + + -- add the symbol flags + local symbolfile = target:symbolfile() + for _, symbol in ipairs(table.wrap(target:get("symbols"))) do + table.join2(flags, self:symbol(symbol, symbolfile)) + end end -- add flags from the platform @@ -247,6 +253,13 @@ function archiver:strip(level) return self:_tool().strip(level) end +-- make the symbol flag +function archiver:symbol(level, symbolfile) + + -- make it + return self:_tool().symbol(level, symbolfile) +end + -- check the given flags function archiver:check(flags) diff --git a/xmake/core/tool/compiler.lua b/xmake/core/tool/compiler.lua index 5125aecea..849a380cb 100644 --- a/xmake/core/tool/compiler.lua +++ b/xmake/core/tool/compiler.lua @@ -162,8 +162,11 @@ function compiler:_addflags_from_target(flags, target) end -- add the symbol flags - for _, symbol in ipairs(table.wrap(target:get("symbols"))) do - table.join2(flags, self:symbol(symbol)) + if target.symbolfile then + local symbolfile = target:symbolfile() + for _, symbol in ipairs(table.wrap(target:get("symbols"))) do + table.join2(flags, self:symbol(symbol, symbolfile)) + end end -- add the warning flags @@ -379,10 +382,10 @@ function compiler:compcmd(sourcefile, objectfile, target) end -- make the symbol flag -function compiler:symbol(level) +function compiler:symbol(level, symbolfile) -- make it - return self:_tool().symbol(level) + return self:_tool().symbol(level, symbolfile) end -- make the language flag diff --git a/xmake/core/tool/linker.lua b/xmake/core/tool/linker.lua index c464a4cdf..e054517f5 100644 --- a/xmake/core/tool/linker.lua +++ b/xmake/core/tool/linker.lua @@ -210,6 +210,14 @@ function linker:_addflags_from_target(flags, target) for _, strip in ipairs(table.wrap(target:get("strip"))) do table.join2(flags, self:strip(strip)) end + + -- add the symbol flags + if target.symbolfile then + local symbolfile = target:symbolfile() + for _, symbol in ipairs(table.wrap(target:get("symbols"))) do + table.join2(flags, self:symbol(symbol, symbolfile)) + end + end end -- add flags from the platform @@ -351,6 +359,13 @@ function linker:strip(level) return self:_tool().strip(level) end +-- make the symbol flag +function linker:symbol(level, symbolfile) + + -- make it + return self:_tool().symbol(level, symbolfile) +end + -- make the linklib flag function linker:linklib(lib) diff --git a/xmake/tools/ar.lua b/xmake/tools/ar.lua index d7d37acbc..d745a6c33 100644 --- a/xmake/tools/ar.lua +++ b/xmake/tools/ar.lua @@ -58,6 +58,11 @@ function strip(level) return maps[level] or "" end +-- make the symbol flag +function symbol(level, symbolfile) + return "" +end + -- make the archive command function archivecmd(objectfiles, targetfile, flags) diff --git a/xmake/tools/cl.lua b/xmake/tools/cl.lua index 9a6847398..991ec5ef0 100755 --- a/xmake/tools/cl.lua +++ b/xmake/tools/cl.lua @@ -87,16 +87,19 @@ function get(name) end -- make the symbol flag -function symbol(level) +function symbol(level, symbolfile) - -- the maps - local maps = - { - debug = "-Z7" - } + -- debug? generate *.pdb file + if level == "debug" then + if symbolfile then + return "-ZI -Fd" .. symbolfile + else + return "-ZI" + end + end - -- make it - return maps[level] or "" + -- none + return "" end -- make the warning flag diff --git a/xmake/tools/gcc.lua b/xmake/tools/gcc.lua index beb4a154e..f049fe32e 100755 --- a/xmake/tools/gcc.lua +++ b/xmake/tools/gcc.lua @@ -86,7 +86,7 @@ function strip(level) end -- make the symbol flag -function symbol(level) +function symbol(level, symbolfile) -- the maps local maps = diff --git a/xmake/tools/link.lua b/xmake/tools/link.lua index c15b53616..c606edb74 100755 --- a/xmake/tools/link.lua +++ b/xmake/tools/link.lua @@ -74,6 +74,18 @@ function strip(level) return "" end +-- make the symbol flag +function symbol(level, symbolfile) + + -- debug? generate *.pdb file + if level == "debug" and symbolfile then + return "-debug -pdb:" .. symbolfile + end + + -- none + return "" +end + -- make the linklib flag function linklib(lib) diff --git a/xmake/tools/swiftc.lua b/xmake/tools/swiftc.lua index 596ea1801..e159e0ca4 100644 --- a/xmake/tools/swiftc.lua +++ b/xmake/tools/swiftc.lua @@ -75,7 +75,7 @@ function get(name) end -- make the symbol flag -function symbol(level) +function symbol(level, symbolfile) -- the maps local maps = |
