Monday, June 7, 2010

SeeMake

I've changed RibTools to use CMake.

CMake is a tool that will convert fairly readable text files that are buildable on various platforms.
Basically, it builds Makefiles and Visual Studio projects files and solutions from a single source.
As an example, see how RibRender's build is described in its own CMakeLists.txt

It was not easy, as there are several things to learn in the process, and one has to look around the web to put together all the pieces of info that are needed.

I also tried Premake, which seems simpler than CMake, however it's also a smaller software and it's too limiting.
One thing I couldn't stand of Premake was that it forces Visual Studio source folders to mirror their physical structure.
I usually have src and include directories, but I like to see all the files listed in an single project folder in VS (because I like to have something.cpp right above something.h).

After a bit more than a day, I finally got the build system to use CMake completely.

The project now comes already in a Source directory.
The build process will make a build and Distrib directories where the Source directory is.
So, the repository looks like this:
  • /
    • Source/
After the build process one ends up with:
  • /
    • build/
    • Distrib/
    • Source/
This is called out-of-source build, as the contents of Source are untouched and one doesn't have to worry about binaries polluting that directory.
Technically, the root of the repository is polluted, but practically one still has a single distinct source directory that stays unchanged by the build process (no .obj, .exe or per-user VS files).

Next step.. moving to Git.. I'm doing that right now and it's no fun in Windows, maybe I'll opt for Mercurial, though it's not as cool as Git ;)




wooo