Converted to an API call.

This commit is contained in:
John Norman 2022-01-07 03:12:07 -08:00
parent d5347f623a
commit d0f4474b6f
7 changed files with 42 additions and 6 deletions

View File

@ -169,6 +169,12 @@
debugger('VisualStudio' .. value)
end)
p.api.register {
name = "scanformoduledependencies",
scope = "config",
kind = "boolean"
}
--
-- Decide when the full module should be loaded.

View File

@ -84,7 +84,7 @@
--
function suite.SupportScanForModuleDependenciesOn()
flags { "ScanForModuleDependencies" }
scanformoduledependencies "yes"
prepare()
test.capture [[
<ClCompile>
@ -96,12 +96,13 @@
end
function suite.SupportScanForModuleDependenciesOff()
flags { "ScanForModuleDependencies" }
scanformoduledependencies "no"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<ScanSourceForModuleDependencies>false</ScanSourceForModuleDependencies>
]]
end

View File

@ -2876,8 +2876,12 @@
function m.scanSourceForModuleDependencies(cfg)
if _ACTION >= "vs2019" then
if cfg.flags.ScanForModuleDependencies then
m.element("ScanSourceForModuleDependencies", nil, "true")
if cfg.scanformoduledependencies ~= nil then
if cfg.scanformoduledependencies then
m.element("ScanSourceForModuleDependencies", nil, "true")
else
m.element("ScanSourceForModuleDependencies", nil, "false")
end
end
end
end

View File

@ -520,7 +520,6 @@
"OptimizeSpeed", -- DEPRECATED
"RelativeLinks",
"ReleaseRuntime", -- DEPRECATED
"ScanForModuleDependencies",
"ShadowedVariables",
"StaticRuntime", -- DEPRECATED
"Symbols", -- DEPRECATED

View File

@ -31,7 +31,6 @@ flags { "flag_list" }
| NoRuntimeChecks | Disable Visual Studio's [default stack frame and uninitialized variable checks][2] on debug builds. |
| OmitDefaultLibrary | Omit the specification of a runtime library in object files. |
| RelativeLinks | Forces the linker to use relative paths to libraries instead of absolute paths. |
| ScanForModuleDependencies | Enables the Visual Studio `Scan Sources for Module Dependencies` feature for C++20 modules. | Valid for vs2019 and newer. |
| ShadowedVariables | Warn when a variable, type declaration, or function is shadowed. |
| StaticRuntime | Perform a static link against the standard runtime libraries. | Deprecated - use staticruntime "On" instead. |
| UndefinedIdentifiers | Warn if an undefined identifier is evaluated in an #if directive. |

View File

@ -0,0 +1,26 @@
Enables the `Scan Sources for Module Dependencies` option for Visual Studio projects.
```lua
scanformoduledependencies "value"
```
If no value is set for a configuration, Visual Studio will default the option to `No`.
### Parameters ###
`value` one of:
* `on`, `yes`, `true` - Sets the option to `Yes`.
* `off`, `no`, `false` - Sets the option to `No`.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0-beta2 or later. Only available for Visual Studio 2019 16.9.x and later.
## Examples ##
```lua
scanformoduledependencies "true"
```

View File

@ -232,6 +232,7 @@ module.exports = {
'rules',
'runpathdirs',
'runtime',
'scanformoduledependencies',
'shaderassembler',
'shaderassembleroutput',
'shaderdefines',