[core] Use 'compileAs' API

This commit is contained in:
Tom van Dijck 2017-05-01 13:28:08 -07:00
parent b9fcad8102
commit 85b3e28de1
3 changed files with 42 additions and 10 deletions

View File

@ -183,6 +183,17 @@
kind = "boolean"
}
api.register {
name = "compileas",
scope = "config",
kind = "string",
allowed = {
"Default",
"C",
"C++",
}
}
api.register {
name = "configmap",
scope = "project",

View File

@ -1216,9 +1216,9 @@
function m.compileAs(cfg)
if p.languages.isc(cfg.language) then
if p.languages.isc(cfg.compileas) then
m.element("CompileAs", nil, "CompileAsC")
elseif p.languages.iscpp(cfg.language) then
elseif p.languages.iscpp(cfg.compileas) then
m.element("CompileAs", nil, "CompileAsCpp")
end
end

View File

@ -38,7 +38,6 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
]]
end
@ -224,7 +223,6 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
]]
end
@ -237,7 +235,6 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
]]
end
@ -462,7 +459,6 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
]]
end
@ -476,7 +472,6 @@
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>None</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
]]
end
@ -490,7 +485,6 @@
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
]]
end
@ -927,7 +921,6 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
]]
end
@ -1030,7 +1023,6 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
]]
end
@ -1039,6 +1031,35 @@
language 'C++'
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
</ClCompile>
]]
end
--
-- Check handling of the compileAs api
--
function suite.onCompileAsC()
compileas 'C'
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
]]
end
function suite.onCompileAsCpp()
compileas 'C++'
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>