diff options
| author | ruki <[email protected]> | 2020-11-19 22:36:05 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-11-19 22:36:05 +0800 |
| commit | 845936d08ddbf9d0c6c9ba98292de92a1f2e7875 (patch) | |
| tree | 7dc7eca79c8bb22b9a00b895f2d30c77ea9ea68a /xmake/modules/core/tools/cl.lua | |
| parent | 31248cdb8ff9a40e6662d6b2793cdfbad4599f78 (diff) | |
improve set_symbols for msvc
Diffstat (limited to 'xmake/modules/core/tools/cl.lua')
| -rw-r--r-- | xmake/modules/core/tools/cl.lua | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua index f5fac3cb2..0db8df367 100644 --- a/xmake/modules/core/tools/cl.lua +++ b/xmake/modules/core/tools/cl.lua @@ -21,6 +21,7 @@ -- imports import("core.base.option") import("core.base.global") +import("core.base.hashset") import("core.project.project") import("core.language.language") import("private.tools.vstool") @@ -88,14 +89,23 @@ function init(self) }) end --- make the symbol flag -function nf_symbol(self, level, target) - - -- debug? generate *.pdb file +-- make the symbol flags +function nf_symbols(self, levels, target) local flags = nil - if level == "debug" then + local values = hashset.from(levels) + if values:has("debug") then + flags = {} + if values:has("edit") then + table.insert(flags, "-ZI") + elseif values:has("embed") then + table.insert(flags, "-Z7") + else + table.insert(flags, "-Zi") + end + + -- generate *.pdb file local symbolfile = nil - if target and target.symbolfile then + if target and target.symbolfile and not values:has("embed") then symbolfile = target:symbolfile() end if symbolfile then @@ -107,16 +117,13 @@ function nf_symbol(self, level, target) end -- check and add symbol output file - flags = "-Zi -Fd" .. path.join(symboldir, "compile." .. path.filename(symbolfile)) - if self:has_flags({"-Zi", "-FS", "-Fd" .. os.nuldev() .. ".pdb"}, "cxflags", { flagskey = "-Zi -FS -Fd" }) then - flags = "-FS " .. flags + local pdbflags = "-Fd" .. path.join(symboldir, "compile." .. path.filename(symbolfile)) + if self:has_flags({"-FS", "-Fd" .. os.nuldev() .. ".pdb"}, "cxflags", { flagskey = "-FS -Fd" }) then + pdbflags = {"-FS", pdbflags} end - else - flags = "-Zi" + table.join2(flags, pdbflags) end end - - -- none return flags end |
