Merge pull request #1788 from LoneBoco/feature-modulescansources

Add a new "ScanForModuleDependencies" flag.
This commit is contained in:
Samuel Surtees 2022-02-22 22:22:43 +10:00 committed by GitHub
commit 7deba66805
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 74 additions and 0 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

@ -78,3 +78,31 @@
<OpenMPSupport>false</OpenMPSupport>
]]
end
--
-- Check ClCompile for ScanForModuleDependencies
--
function suite.SupportScanForModuleDependenciesOn()
scanformoduledependencies "yes"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<ScanSourceForModuleDependencies>true</ScanSourceForModuleDependencies>
]]
end
function suite.SupportScanForModuleDependenciesOff()
scanformoduledependencies "no"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<ScanSourceForModuleDependencies>false</ScanSourceForModuleDependencies>
]]
end

View File

@ -398,6 +398,7 @@
m.compileAsWinRT,
m.externalWarningLevel,
m.externalAngleBrackets,
m.scanSourceForModuleDependencies,
}
if cfg.kind == p.STATICLIB then
@ -2888,6 +2889,19 @@
end
function m.scanSourceForModuleDependencies(cfg)
if _ACTION >= "vs2019" then
if cfg.scanformoduledependencies ~= nil then
if cfg.scanformoduledependencies then
m.element("ScanSourceForModuleDependencies", nil, "true")
else
m.element("ScanSourceForModuleDependencies", nil, "false")
end
end
end
end
function m.xmlDeclaration()
p.xmlUtf8()
end

View File

@ -0,0 +1,25 @@
Enables the `Scan Sources for Module Dependencies` option for Visual Studio projects.
```lua
scanformoduledependencies "value"
```
### 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

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