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.enableJumboBuild,
m.sanitizers,
m.toolsVersion,
m.wholeProgramOptimization,
Expand Down Expand Up @@ -2550,6 +2551,12 @@
end
end

function m.enableJumboBuild(cfg)
if _ACTION > "vs2017" and cfg.enableUnityBuild then
Sharlock93 marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -72,6 +72,7 @@
| [editandcontinue](editandcontinue.md) | |
| [editorintegration](editorintegration.md) | Enable or disable IDE integration |
| [enablewarnings](enablewarnings.md) | |
| [enableunitybuilds](unitybuilds.md) | |
KyrietS marked this conversation as resolved.
Show resolved Hide resolved
| [endian](endian.md) | |
| [entrypoint](entrypoint.md) | Specify the program entry point function |
| [exceptionhandling](exceptionhandling.md) | Enable or disable exception handling |
Expand Down
29 changes: 29 additions & 0 deletions website/docs/unitybuilds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Enables Unity Builds in Visual Studio, also known as Jumbo Builds

```lua
enableUnityBuilds "value"
```

If no toolset is specified for a configuration, the system or IDE default will be used.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"toolset"? Seems to be a copy paste...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah 100%, I wanted to keep the same structure and easiest was to copy paste something, been so busy lately that this ended up being a rushed job.


### 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 2019+.

### Examples ###

Enable Unity Builds.

```lua
enableUnityBuild "On"
```