Fix mapping of exception handler and rtti values in tool adapters

This commit is contained in:
Jason Perkins 2015-06-23 16:52:17 -04:00
parent 41dec88056
commit d35a5f5ebf
2 changed files with 21 additions and 21 deletions

View File

@ -106,21 +106,21 @@
-- --
gcc.cxxflags = { gcc.cxxflags = {
exceptionhandling = {
Off = "-fno-exceptions"
},
flags = { flags = {
NoBufferSecurityCheck = "-fno-stack-protector", NoBufferSecurityCheck = "-fno-stack-protector",
["C++11"] = "-std=c++11", ["C++11"] = "-std=c++11",
["C++14"] = "-std=c++14", ["C++14"] = "-std=c++14",
},
rtti = {
Off = "-fno-rtti"
} }
} }
function gcc.getcxxflags(cfg) function gcc.getcxxflags(cfg)
local flags = config.mapFlags(cfg, gcc.cxxflags) local flags = config.mapFlags(cfg, gcc.cxxflags)
if cfg.exceptionhandling == p.OFF then
table.insert(flags, '-fno-exceptions')
end
if cfg.rtti == p.OFF then
table.insert(flags, '-fno-rtti')
end
return flags return flags
end end

View File

@ -7,10 +7,12 @@
--- ---
premake.tools.msc = {} local p = premake
local msc = premake.tools.msc
local project = premake.project p.tools.msc = {}
local config = premake.config local msc = p.tools.msc
local project = p.project
local config = p.config
-- --
@ -103,20 +105,18 @@
-- Returns list of C++ compiler flags for a configuration. -- Returns list of C++ compiler flags for a configuration.
-- --
msc.cxxflags = {
rtti = {
Off = "/GR-"
}
}
function msc.getcxxflags(cfg) function msc.getcxxflags(cfg)
local flags = {} local flags = config.mapFlags(cfg, msc.cxxflags)
if cfg.rtti == premake.OFF then if not cfg.flags.SEH and cfg.exceptionhandling ~= p.OFF then
table.insert(flags, "/GR-")
end
if cfg.exceptionhandling == premake.ON or cfg.flags.SEH then
if cfg.flags.SEH then
table.insert(flags, "/EHa")
else
table.insert(flags, "/EHsc") table.insert(flags, "/EHsc")
end end
end
return flags return flags
end end