Move character set command line flags from switch lists to defines
This commit is contained in:
parent
84cb655069
commit
309ef32ff8
@ -390,7 +390,7 @@
|
|||||||
|
|
||||||
|
|
||||||
function make.defines(cfg, toolset)
|
function make.defines(cfg, toolset)
|
||||||
_p(' DEFINES +=%s', make.list(table.join(toolset.getdefines(cfg.defines), toolset.getundefines(cfg.undefines))))
|
_p(' DEFINES +=%s', make.list(table.join(toolset.getdefines(cfg.defines, cfg), toolset.getundefines(cfg.undefines))))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,11 +29,6 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
msc.cflags = {
|
msc.cflags = {
|
||||||
characterset = {
|
|
||||||
Default = { '/D"_UNICODE"', '/D"UNICODE"' },
|
|
||||||
MBCS = '/D"_MBCS"',
|
|
||||||
Unicode = { '/D"_UNICODE"', '/D"UNICODE"' },
|
|
||||||
},
|
|
||||||
clr = {
|
clr = {
|
||||||
On = "/clr",
|
On = "/clr",
|
||||||
Unsafe = "/clr",
|
Unsafe = "/clr",
|
||||||
@ -133,8 +128,27 @@
|
|||||||
-- Decorate defines for the MSVC command line.
|
-- Decorate defines for the MSVC command line.
|
||||||
--
|
--
|
||||||
|
|
||||||
function msc.getdefines(defines)
|
msc.defines = {
|
||||||
local result = {}
|
characterset = {
|
||||||
|
Default = { '/D"_UNICODE"', '/D"UNICODE"' },
|
||||||
|
MBCS = '/D"_MBCS"',
|
||||||
|
Unicode = { '/D"_UNICODE"', '/D"UNICODE"' },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function msc.getdefines(defines, cfg)
|
||||||
|
local result
|
||||||
|
|
||||||
|
-- HACK: I need the cfg to tell what the character set defines should be. But
|
||||||
|
-- there's lots of legacy code using the old getdefines(defines) signature.
|
||||||
|
-- For now, detect one or two arguments and apply the right behavior; will fix
|
||||||
|
-- it properly when the I roll out the adapter overhaul
|
||||||
|
if cfg and defines then
|
||||||
|
result = config.mapFlags(cfg, msc.defines)
|
||||||
|
else
|
||||||
|
result = {}
|
||||||
|
end
|
||||||
|
|
||||||
for _, define in ipairs(defines) do
|
for _, define in ipairs(defines) do
|
||||||
table.insert(result, '/D"' .. define .. '"')
|
table.insert(result, '/D"' .. define .. '"')
|
||||||
end
|
end
|
||||||
|
@ -196,7 +196,7 @@
|
|||||||
function suite.defines()
|
function suite.defines()
|
||||||
defines "DEF"
|
defines "DEF"
|
||||||
prepare()
|
prepare()
|
||||||
test.contains({ '/D"DEF"' }, msc.getdefines(cfg.defines))
|
test.contains({ '/D"DEF"' }, msc.getdefines(cfg.defines, cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.undefines()
|
function suite.undefines()
|
||||||
@ -317,19 +317,19 @@
|
|||||||
|
|
||||||
function suite.cflags_onCharSetDefault()
|
function suite.cflags_onCharSetDefault()
|
||||||
prepare()
|
prepare()
|
||||||
test.contains('/D"_UNICODE"', msc.getcflags(cfg))
|
test.contains('/D"_UNICODE"', msc.getdefines(cfg.defines, cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.cflags_onCharSetUnicode()
|
function suite.cflags_onCharSetUnicode()
|
||||||
characterset "Unicode"
|
characterset "Unicode"
|
||||||
prepare()
|
prepare()
|
||||||
test.contains('/D"_UNICODE"', msc.getcflags(cfg))
|
test.contains('/D"_UNICODE"', msc.getdefines(cfg.defines, cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.cflags_onCharSetMBCS()
|
function suite.cflags_onCharSetMBCS()
|
||||||
characterset "MBCS"
|
characterset "MBCS"
|
||||||
prepare()
|
prepare()
|
||||||
test.contains('/D"_MBCS"', msc.getcflags(cfg))
|
test.contains('/D"_MBCS"', msc.getdefines(cfg.defines, cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user