Jump to content

  • Log In with Google      Sign In   
  • Create Account

CMake vs Premake


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 3DModelerMan   Members   -  Reputation: 1071

Like
1Likes
Like

Posted 06 December 2011 - 04:57 PM

I'm trying to decide what build system to use. I want to be able to just create one CMake or Premake project file and generate the project files/solutions for Microsoft Visual C++ 2010/2008, and Code::Blocks. I might also need to generate XCode projects, and possibly kDevelop. Which one is easier to use? And also, do either support custom build steps like batch files?

Sponsor:

#2 Bregma   Crossbones+   -  Reputation: 5503

Like
0Likes
Like

Posted 06 December 2011 - 05:31 PM

Well, I've never heard of Premake, but CMake is widely used (for example, by the entire KDE project). Some people swear by it (and others at it, you know the drill).

I know CMake is extensible. Adding platform-specific things like batch files might just defeat the purpose of a cross-platform build, but I'm pretty sure you can add "if windows do this..." type constructs to the CMakeFile.txt so yeah, that's possible.
Stephen M. Webb
Professional Free Software Developer

#3 Shael   Members   -  Reputation: 277

Like
0Likes
Like

Posted 06 December 2011 - 11:07 PM

I haven't used CMake so can't really comment on it.

As for Premake I have found it quite easy to use and setting up scripts is quite easy using their documentation. If you have any Lua experience then the scripting will be even easier for you as it's based on that. I haven't needed to run custom build steps as I'm only using it to build fairly simple solutions/projects. There is however the "if win { do something }" constructs from which you could then extend Premake to launch a batch script.

#4 Hodgman   Moderators   -  Reputation: 32000

Like
0Likes
Like

Posted 06 December 2011 - 11:16 PM

I've not used Premake, but I like the sounds of it -- it uses Lua for it's project scripts, whereas CMake uses it's own internal scripting language (which is simple to learn, but still, it's not Lua!).

I really love CMake, but it did have a bit of a learning curve in getting the projects scripts set up the way I wanted them. I actually found it easiest to get started by copying another project's build files Posted Image
After getting past the initial learning curve, I find it pretty easy to use and quite powerful -- I've got CMake set up to produce a VS2008 solution containing multiple libraries and EXEs in three configurations (debug, development, retail, each with different compiler options/defines). Some of the EXEs are unit-tests, which have post-build steps that run the EXE (printing unit test failures to MSVC's build output window) as part of a regular build.
The cmake script files show up in MSVC's file tree, so It's pretty easy to add new files to the project, and whenever the project files are changed, your solution will be re-generated next time you hit the build button.
Also, I've got some simple CMake macros set up to organise files in the MSVC file tree -- e.g. I can easily say: any files in "./include/foo/bar" or "./source/foo/bar" inside the "Foo" project should be grouped under a folder named "Bar".

#5 wqking   Members   -  Reputation: 756

Like
0Likes
Like

Posted 08 December 2011 - 11:48 PM

I'm a happy user of CMake.
And it has a lot of happy user I think. :-)

However, it's unhappy to start with CMake.
The syntax is really horrible.
But after you get used with it, you will be happy with it.

Now whenever I add new unit test file, I don't tell CMake about that, and it will find it automatically, it really saves my time.

http://www.cpgf.org/
cpgf library -- free C++ open source library for reflection, serialization, script binding, callbacks, and meta data for OpenGL Box2D, SFML and Irrlicht.
v1.5.5 was released. Now supports tween and timeline for ease animation.


#6 Zlodo   Members   -  Reputation: 246

Like
0Likes
Like

Posted 09 December 2011 - 03:51 AM

cmake's scripting language is no lua and can be rather cumbersome at times, but despite of this cmake is actually easy to use. For instance, I found it much easier to do complicated stuff with cmake (such as generating correct dependencies for a code generation tool built as part of a project and used later during the build) than with scons despite that the later uses python as its scripting language. I never used premake though, so I don't know how it compares with cmake, but since the later is widely used it is probably supported better all around. For instance you have good chances to find a cmake module somewhere for every major library.

As for custom build steps not only does it support them but you can usually do it all using cmake's own language instead of having to rely on platform specific scripts such as .bat or .sh scripts. cmake also have some nice goodies such as the ability to generate platform specific installation packages from generic installation rules located throughout the cmake files. It can generate nsis installers on windows, debian / rpm / self-extracting tarballs on linux, etc.

You can of course also have platform specific code in your build files, that's also supported. Overall cmake is a very complete multiplatform build system, at least for C++.

As for kdevelop, if you use kdevelop4 you can directly import the top level cmakelists.txt file as a project.

#7 3DModelerMan   Members   -  Reputation: 1071

Like
0Likes
Like

Posted 09 December 2011 - 08:15 AM

I ended up just downloading both and trying them out to see which one I liked best. I ended up going with premake because I'm familiar with Lua.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS