Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for unity builds #2011

Merged
merged 13 commits into from
Apr 14, 2023
9 changes: 9 additions & 0 deletions modules/vstudio/_preload.lua
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,15 @@
}
}

p.api.register {
name = "enableunitybuild",
scope = { "config" },
kind = "string",
allowed = {
"On",
"Off"
}
}

--
-- Decide when the full module should be loaded.
Expand Down
7 changes: 7 additions & 0 deletions modules/vstudio/vs2010_vcxproj.lua
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
m.clrSupport,
m.characterSet,
m.platformToolset,
m.enableUnityBuild,
m.sanitizers,
m.toolsVersion,
m.wholeProgramOptimization,
Expand Down Expand Up @@ -2550,6 +2551,12 @@
end
end

function m.enableUnityBuild(cfg)
if _ACTION >= "vs2017" and cfg.enableunitybuild then
m.element("EnableUnitySupport", nil, iif(cfg.enableunitybuild == "On", "true", "false"))
end
end

function m.sanitizers(cfg)
if _ACTION >= "vs2019" and cfg.sanitize then
if table.contains(cfg.sanitize, "Address") then
Expand Down
1 change: 1 addition & 0 deletions website/docs/Project-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
| [docname](docname.md) | |
| [editandcontinue](editandcontinue.md) | |
| [editorintegration](editorintegration.md) | Enable or disable IDE integration |
| [enableunitybuild](enableunitybuild.md) | |
| [enablewarnings](enablewarnings.md) | |
| [endian](endian.md) | |
| [entrypoint](entrypoint.md) | Specify the program entry point function |
Expand Down
27 changes: 27 additions & 0 deletions website/docs/enableunitybuild.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Enables Unity Builds in Visual Studio, also known as Jumbo Builds

```lua
enableunitybuild "value"
```

### Parameters ###

`value` is one of:
* `On` - Enables Unity Builds.
* `Off` - Disables Unity Builds.

### Applies To ###

Project configurations.

### Availability ###

Premake 5.0 and later. Versions are currently only implemented for Visual Studio 2017+.

### Examples ###

Enable Unity Builds.

```lua
enableunitybuild "On"
```
1 change: 1 addition & 0 deletions website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ module.exports = {
'embed',
'embedandsign',
'enabledefaultcompileitems',
'enableunitybuild',
'enablewarnings',
'endian',
'entrypoint',
Expand Down