Merge pull request #1952 from flakey5/flakey5/add-usestandardpreprocessor
vstudio: add usestandardpreprocessor option
This commit is contained in:
commit
7d241a6d98
@ -175,6 +175,16 @@
|
||||
kind = "boolean"
|
||||
}
|
||||
|
||||
p.api.register {
|
||||
name = "usestandardpreprocessor",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"On",
|
||||
"Off"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
-- Decide when the full module should be loaded.
|
||||
|
@ -106,3 +106,27 @@
|
||||
<ScanSourceForModuleDependencies>false</ScanSourceForModuleDependencies>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.UseStandardPreprocessorOn()
|
||||
usestandardpreprocessor 'On'
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<UseStandardPreprocessor>true</UseStandardPreprocessor>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.UseStandardPreprocessorOff()
|
||||
usestandardpreprocessor 'Off'
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<UseStandardPreprocessor>false</UseStandardPreprocessor>
|
||||
]]
|
||||
end
|
||||
|
@ -400,6 +400,7 @@
|
||||
m.externalWarningLevel,
|
||||
m.externalAngleBrackets,
|
||||
m.scanSourceForModuleDependencies,
|
||||
m.useStandardPreprocessor,
|
||||
}
|
||||
|
||||
if cfg.kind == p.STATICLIB then
|
||||
@ -2955,6 +2956,16 @@
|
||||
end
|
||||
end
|
||||
|
||||
function m.useStandardPreprocessor(cfg)
|
||||
if _ACTION >= "vs2019" and cfg.usestandardpreprocessor ~= nil then
|
||||
if cfg.usestandardpreprocessor == 'On' then
|
||||
m.element("UseStandardPreprocessor", nil, "true")
|
||||
else
|
||||
m.element("UseStandardPreprocessor", nil, "false")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.xmlDeclaration()
|
||||
p.xmlUtf8()
|
||||
|
@ -134,6 +134,10 @@
|
||||
openmp = {
|
||||
On = "/openmp",
|
||||
Off = "/openmp-"
|
||||
},
|
||||
usestandardpreprocessor = {
|
||||
On = "/Zc:preprocessor",
|
||||
Off = "/Zc:preprocessor-"
|
||||
}
|
||||
|
||||
}
|
||||
|
26
website/docs/usestandardpreprocessor.md
Normal file
26
website/docs/usestandardpreprocessor.md
Normal file
@ -0,0 +1,26 @@
|
||||
Enables a token-based preprocessor conforming to C99, C++11, and later standards.
|
||||
|
||||
```lua
|
||||
usestandardpreprocessor 'value'
|
||||
```
|
||||
|
||||
### Parameters ###
|
||||
|
||||
`value` is one of:
|
||||
|
||||
| Action | Description |
|
||||
|-------------|---------------------------------------|
|
||||
| Off | Do not use the conforming processor. |
|
||||
| On | Enable the conforming processor. |
|
||||
|
||||
### Applies To ###
|
||||
|
||||
Visual Studio 2019 or later.
|
||||
|
||||
### Availability ###
|
||||
|
||||
Premake 5.0 or later.
|
||||
|
||||
### See Also ###
|
||||
|
||||
* [Microsoft's documentation](https://docs.microsoft.com/en-us/cpp/build/reference/zc-preprocessor)
|
@ -277,6 +277,7 @@ module.exports = {
|
||||
'undefines',
|
||||
'unsignedchar',
|
||||
'usefullpaths',
|
||||
'usestandardpreprocessor',
|
||||
'usingdirs',
|
||||
'uuid',
|
||||
'vectorextensions',
|
||||
|
Loading…
Reference in New Issue
Block a user