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"
|
kind = "boolean"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.api.register {
|
||||||
|
name = "usestandardpreprocessor",
|
||||||
|
scope = "config",
|
||||||
|
kind = "string",
|
||||||
|
allowed = {
|
||||||
|
"On",
|
||||||
|
"Off"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Decide when the full module should be loaded.
|
-- Decide when the full module should be loaded.
|
||||||
|
@ -106,3 +106,27 @@
|
|||||||
<ScanSourceForModuleDependencies>false</ScanSourceForModuleDependencies>
|
<ScanSourceForModuleDependencies>false</ScanSourceForModuleDependencies>
|
||||||
]]
|
]]
|
||||||
end
|
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.externalWarningLevel,
|
||||||
m.externalAngleBrackets,
|
m.externalAngleBrackets,
|
||||||
m.scanSourceForModuleDependencies,
|
m.scanSourceForModuleDependencies,
|
||||||
|
m.useStandardPreprocessor,
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg.kind == p.STATICLIB then
|
if cfg.kind == p.STATICLIB then
|
||||||
@ -2955,6 +2956,16 @@
|
|||||||
end
|
end
|
||||||
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()
|
function m.xmlDeclaration()
|
||||||
p.xmlUtf8()
|
p.xmlUtf8()
|
||||||
|
@ -134,6 +134,10 @@
|
|||||||
openmp = {
|
openmp = {
|
||||||
On = "/openmp",
|
On = "/openmp",
|
||||||
Off = "/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',
|
'undefines',
|
||||||
'unsignedchar',
|
'unsignedchar',
|
||||||
'usefullpaths',
|
'usefullpaths',
|
||||||
|
'usestandardpreprocessor',
|
||||||
'usingdirs',
|
'usingdirs',
|
||||||
'uuid',
|
'uuid',
|
||||||
'vectorextensions',
|
'vectorextensions',
|
||||||
|
Loading…
Reference in New Issue
Block a user