How to integrate PreMake/CMake in a C++ build work

2019-04-08 16:12发布

问题:

I am looking at PreMake/CMake for the moment. However, I fail to see how this could be used in an entire cross-platform build workflow. Indeed, it generates makefiles (or solutions). Then, how do you actually build those solutions on each targeted platforms? Do you have to maintain one build script per target (like .sh or .bat file)? This would defeat the purpose of using a tool like premake/CMake in the first place.

A link to a tutorial showing all the process from coding to final built product using premake would be great.

Thanks for any help.

回答1:

Our main development is also done in C++. We use CMake + ANT. VisualStudio on Windows, XCode for Mac and iOS. Some build tools are written in Python.

It works rather smoothly. We have unit and low-level component tests run straight from the build (utilizing CMake's CTest mechanism which we tinkered with slightly - CMake is Open Source). Higher level component and system tests are run via a custom-made framework written in C# (we had a great debate whether to use something off-the-shelf or write our own, in the end we decided that any off-the-shelf framework we get would have to be modified so much that it was worth it to write our own from scratch; I'm still wondering if it was the right decision).

We tie things together with ANT - mostly using <exec> calls at the lowest level, but also utilizing well-established extensions (such as ftp and svn). Our CI runs on Jenkins that ties up into the lower build layers via ANT.