-
-
Notifications
You must be signed in to change notification settings - Fork 618
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
Conversation
Documentation and unit test are missing. Wonder if it should be integrated to https://github.com/dcourtois/premake-compilationunit (listed in https://premake.github.io/community/modules/#tool-modules) which does Single compilation unit support. |
If you could point me to where I should be adding those it would be great.
The difference here being that Visual Studio itself does that kind of "Unity/Single Compilation Unit" automatically. For example if you enable it in a project it will generate a file called "unity_<random_suffix>.cpp" that basically does what that module is doing. I haven't added more flags (honestly because I didn't need them myself) but a more complete set of flags exist for Unity/Jumbo builds that specify how many files should be packed up in one Unity file etc. That module is more useful in a context where native support for Unity builds doesn't exist. |
I would say
I meant: use special flag for msvc which can do it natively, but keep the module as is for other actions. |
I mean you could do that but this feature really should be part of visual studio as this is a native feature on visual studio itself so in essence premake is missing it. |
Can you add the documentation so the CI can pass that step? |
website/docs/unitybuilds.md
Outdated
enableUnityBuilds "value" | ||
``` | ||
|
||
If no toolset is specified for a configuration, the system or IDE default will be used. |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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.
Co-authored-by: Joris Dauphin <Jarod42@users.noreply.github.com>
Missing one more step in the documentation (and maybe this is something we should better document in the contributing doc), but you need to add it to the |
yeah sorry about that, been super busy with work and it could be that its written somewhere but I didn't see it. |
website/sidebars.js
Outdated
@@ -275,6 +275,7 @@ module.exports = { | |||
'toolsversion', | |||
'transition', | |||
'undefines', | |||
'unitybuilds', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enableunitybuild
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one of these days...
When I try to use this option I get this error. Am I missing something here? |
What version of premake are you using? |
Premake 5.0.0-beta2 Currently I managed it by creating my own hook. |
Try one of the CI builds. They should have it. |
What does this PR do?
Adds Support for Unity builds in visual studio 2019+. Adds one new flag "enableUnityBuild" with options On and Off.
How does this PR change Premake's behavior?
Adds Unity Build/Jumbo Build support.
Anything else we should know?
Unity builds really speed up compile time, being able to set them per config and project is a nice feature and something I personally needed.
Did you check all the boxes?
Honestly I did this in a hurry and was a neat feature that I wanted myself, if there is anything in particular I should be adding then feedback is welcome.