Eclipse and CEGUI
Written for CEGUI 0.8
Works with versions 0.8.x (stable)
Works with latest CEGUI stable!
Since 0.8, CEGUI uses cmake as a build system. This gives us a lot of freedom and flexibility.
I will try to describe how to setup a nice hacking environment for CEGUI 0.8 (unreleased yet, in mercurial repository only) using Eclipse. This will work under Windows, Linux and possibly even MacOSX. I will focus on Windows because it's most difficult there as you have to set up some workarounds.
Even though cmake has a generator for Eclipse project files, I don't recommend them. The result is a project that builds everything correctly but is useless for development, you can't browse it as easily, headers are completely missing, etc...
Windows only section (skip if you are using anything else)
What I recommend is using JOM (nmake clone able to use more cores) or pure nmake (in case you have a single core machine and are lazy). I will focus on JOM. Download JOM binaries from the official nokia site - ftp://ftp.qt.nokia.com/jom/ jom.zip should be the latest and greatest. Extract and put all files in the archive somewhere. For simplicity, I will assume jom.exe is located at C:/bin/jom/jom.exe.
Add C:/bin/jom to your PATH (you can also do this in your eclipseMSVC.bat script that we will get to later but for simplicity, I do it globally). When you click Start, then right click Computer and select properties, there is "Advanced system settings" on the left bar. Then you push the Environment variables button. All the env variables should pop up. Edit PATH and prepend "C:/bin/jom;" without quotes there. Now you should be able to start cmd.exe, type jom.exe, press ENTER and something should happen.
Clone CEGUI Mercurial repository (or download the SDK in case it has already been released). Now we will have to run cmake and get Makefiles generated. Download and install the newest cmake and start cmake / cmake-gui.
Windows only section (skip if you are using anything else)
On Windows, cmake has no idea where MSVC is unless you run vcvars32.bat first. You can do that by going to Start, selecting Microsoft Visual Studio 20XX and starting "Visual Studio command prompt". A black command prompt should popup. Type cmake-gui and press ENTER.
Do the cmake thing (I won't go into details here), select NMakefiles JOM (recommended) or NMakefiles (not recommended at all :-D) on Windows and Makefiles on UNIX. After you configure and generate, everything should be setup correctly in your build directory (I will assume it is "cegui/build/").
Download the Eclipse distribution and place it somewhere (I will assume "eclipse/"). Start it and setup your workspace somewhere.
Windows only section (skip if you are using anything else)
Again, on Windows, Eclipse and JOM won't have any idea where cl.exe and the rest are. You have to run vcvars32.bat and then run eclipse.exe inside the resulting environment. I recommend creating a BAT file to ease the job and just start that.
Create C:\eclipse\eclipseMSVC.bat file and put this inside (correct the paths if necessary).
@cd C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\
@call vcvars32.bat > nul 2>&1
@cd C:\eclipse\
@start eclipse.exe > nul 2>&1
@exit
Ideally, double clicking will start Eclipse without leaving the fugly black command prompt window open.
Now that Eclipse is started, right click the project explorer and select Import. Choose C/C++ and Existing code as a Makefile project. Go through the wizard. Right click on the project and choose Properties. Select builders, edit the CDT builder. Select the build directory to be "cegui/build".
Windows only section (skip if you are using anything else)
On Windows you should change the build application to "jom.exe" and select the number of jobs manually (don't select automatically use the right number of jobs as jom.exe doesn't take just "-j" as the param).
Please report any successes and problems with this guide, I haven't completely tested it and most of it is from the top of my head. I am likely to have forgotten steps :-)