#3729 closed enhancement (fixed)
Migrate to premake5
Reported by: | Itms | Owned by: | Itms |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 23 |
Component: | Build & Packages | Keywords: | |
Cc: | Yves, leper | Patch: |
Description (last modified by )
We're currently using a modified version of premake4 to create our workspaces.
Premake5 is currently being developed and should reach a stable state soon, so we should try to start a soft migration by experimentally using their alphas along with our current version, and drop the latter when they release premake5.
Doing so will allow us:
- to generate project files for VS 2015, which we cannot use right now.
- to stop using a modified premake (see #1518), because premake5 allows us to create custom modules, which is a much more maintainable solution.
NB: They moved from BitBucket to GitHub so most of the links in the other ticket are broken, and I think one pull request vanished.
What has to be done:
- Change a bunch of things (really a no-brainer, took me 10 minutes) as explained here: https://github.com/premake/premake-core/wiki/Migrating-From-4.x
- Rewrite our customizations as a module (it's the big awesome change in premake5) as explained here: https://github.com/premake/premake-core/wiki/Extending-Premake
- If some of our fixes are not yet included and are still needed (read: if regressions appear), rewrite the fixes and make a pull request while they're in alpha and active
- If time permits: take a look at the new features and see if we can use them to improve our scripts (https://github.com/premake/premake-core/wiki/What's-New-in-5.0); also see if our TODO/FIXME are still relevant
I tried to give it a go but I am not fluent in Lua and don't know much about all of this building stuff. The module system seems powerful and well documented, so maybe it will be really easy for people working on it before (CCing Yves and leper) to write those modules.
Attachments (2)
Change History (22)
by , 8 years ago
follow-up: 7 comment:1 by , 8 years ago
I took a stab at this and have a working version with the latest unmodified release of premake5 alpha7. I only tested this on windows10 with VS2013, other platforms will soon follow. I'm uploading this in case someone else wants to play with it.
Other than applying the patch, you need to download premake5 and put the binary into the build/premake
folder.
Of the customizations we had for premake4:
- we apparently didn't use
nasm
support - precompiled headers work smarter in premake5
- support for cxxtest was missing, so I wrote a premake5 module for it, that's also included in the patch
comment:2 by , 8 years ago
Any chance to get that as a plain diff?
For this ticket as a whole maybe #1104 could also be considered.
comment:3 by , 8 years ago
I tried uploading the whole patch but it's 8MB and there's a 2MB limit on uploads :) Here's a diff with --no-diff-deleted
that's smaller.
by , 8 years ago
follow-up: 6 comment:4 by , 8 years ago
As for #1104, I don't understand the benefits of using CMake vs premake at this point. The original ticket points out that CMake supports XCode, but that's not a problem for premake either.
comment:5 by , 8 years ago
It would be nice to eventually be able to use a system premake, useful on Linux which can already provide a premake5 package.
comment:6 by , 8 years ago
Replying to zsol:
As for #1104, I don't understand the benefits of using CMake vs premake at this point. The original ticket points out that CMake supports XCode, but that's not a problem for premake either.
I haven't used Premake5 yet, but based on 4.x, I would say CMake is more stable, has a larger community of testers and users, supports more platforms "out of the box", and has more built-in options. Premake's advantage is using Lua instead of the yucky scripts that CMake uses, but you end up having to write more logic to make up for what Premake lacks. Actually, I think newer IDEs come along more frequently than functional changes to our build system (our Premake version doesn't support clang, Xcode 4+, VS 2015 - to name a few).
As a practical example, I'm building primarily *nix-oriented libraries with CMake in Visual Studio 2013, there's even an option that lets me set the platform toolset to v120_xp, but I could just as easily build them for 2015, 2012, 2010, 2008, or something older (or newer). That's just scratching the surface of the options available. The library devs don't have to write all those cases into their build system, they just have to support MSVC.
At this point, I wouldn't want to switch, because there are so many nuances of our build system and it would be painful to convert them to CMake and test that everything still works on every platform. It sure would be nice to not have to majorly overhaul our build scripts every time we want to support a new IDE...
follow-up: 8 comment:7 by , 8 years ago
Hi zsol, I took a look at what you did, I have two questions:
- How come we didn't use
nasm
support? That surprises me a lot, are you sure of that? - It would be nice to reimplement
NoDebugHeap
as a module, did you look into it?
Apart from that (and the way you presented the changes which is awful :p) I think this looks good and I will look into it when you answer the questions above!
Thanks for working on that.
comment:8 by , 8 years ago
Replying to Itms:
- How come we didn't use
nasm
support? That surprises me a lot, are you sure of that?
We stopped using it around 7 years ago. It had been used with Premake 3, so I added some custom code to support it with Premake 4 too when I upgraded. Then shortly after the upgrade, someone removed the remaining uses of nasm.
comment:10 by , 8 years ago
comment:11 by , 7 years ago
Milestone: | Backlog → Work In Progress |
---|---|
Owner: | set to |
I have everything ready to be committed at https://github.com/na-Itms/0ad/tree/premake5!
It includes the work performed by zsol, some updates, it includes a correct way of removing the debug heap, it fixes #404 (only on premake5) and all build scripts have been updated to support experimental testing of premake5 through the --premake5
command-line option.
You can use the github branch for eased reviewing and I will upload a SVN patch to our new Phabricator system.
comment:16 by , 6 years ago
Description: | modified (diff) |
---|---|
Milestone: | Work In Progress → Alpha 23 |
comment:17 by , 6 years ago
May I make a request for the .gitignore
file in the 0ad github mirror to be updated so that the files premake5
generates inside the build/premake/premake5
folder are ignored? (There are already lines for premake4
in the file.)
comment:18 by , 6 years ago
Done, thank you for the reminder! The new commit will be pushed to GitLab as well during tomorrow's automatic update of the mirrors.
7zipped patch works on windows with vs2013 and premake5.0.0-alpha7