Implementing "allmodulespublic"

This commit is contained in:
Hannes Harnisch 2021-11-23 15:01:17 +01:00
parent 59385a2586
commit d124db636f
5 changed files with 81 additions and 5 deletions

View File

@ -57,3 +57,40 @@
</PropertyGroup>
]]
end
--
-- If AllModulesPublic flag is set, add <AllProjectBMIsArePublic> element (supported from VS2019)
--
function suite.onAllModulesPublicOn()
allmodulespublic "On"
local cfg = test.getconfig(prj, "Debug", platform)
vc2010.outputProperties(cfg)
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>.exe</TargetExt>
<AllProjectBMIsArePublic>true</AllProjectBMIsArePublic>
</PropertyGroup>
]]
end
function suite.onAllModulesPublicOff()
allmodulespublic "Off"
local cfg = test.getconfig(prj, "Debug", platform)
vc2010.outputProperties(cfg)
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>.exe</TargetExt>
<AllProjectBMIsArePublic>false</AllProjectBMIsArePublic>
</PropertyGroup>
]]
end

View File

@ -243,6 +243,7 @@
m.generateManifest,
m.extensionsToDeleteOnClean,
m.executablePath,
m.allModulesPublic,
}
end
end
@ -1506,11 +1507,15 @@
function m.conformanceMode(cfg)
if _ACTION >= "vs2017" then
if cfg.conformancemode ~= nil then
if cfg.conformancemode then
m.element("ConformanceMode", nil, "true")
else
m.element("ConformanceMode", nil, "false")
end
m.element("ConformanceMode", nil, iif(cfg.conformancemode, "true", "false"))
end
end
end
function m.allModulesPublic(cfg)
if _ACTION >= "vs2019" then
if cfg.allmodulespublic ~= nil then
m.element("AllProjectBMIsArePublic", nil, iif(cfg.allmodulespublic, "true", "false"))
end
end
end

View File

@ -190,6 +190,12 @@
"HeaderUnit"
}
}
api.register {
name = "allmodulespublic",
scope = "config",
kind = "boolean"
}
api.register {
name = "configmap",

View File

@ -0,0 +1,27 @@
allmodulespublic
```lua
allmodulespublic "value"
```
### Parameters ###
`value` one of:
* `On` - All C++ modules in the given project(s) will be public.
* `Off` - Not all C++ modules in the given project(s) will be public.
## Applies To ###
The `config` scope.
### Availability ###
Visual Studio 2019 and later.
Premake 5.0-beta2 or later.
### Examples ###
```lua
allmodulespublic "On"
```

View File

@ -60,6 +60,7 @@ module.exports = {
type: 'category',
label: 'Project Settings',
items: [
'allmodulespublic',
'androidapilevel',
'androidapplibname',
'architecture',