Slicer3::New Eclipse Instructions
Contents
Revised Howto Setup Eclipse to build/edit the Slicer3 Development Environment:
Installing Eclipse:
I currently use Eclipse "Ganymede" (3.4) and "Galileo" (3.5) versions, but this also works with Eclipse Version 3.3 and higher. The easiest way to get started is to select an eclipse distribution which already includes CDT (the C++ tools) integrated. This is available from http://www.eclipse.org/downloads. Download Eclipse and unpack the downloaded archive to the destination you want. You start Eclipse with ./eclipse from the base directory of your eclipse installation.
Configure Eclipse:
As computers become more powerful, it is less necessary to adjust the runtime parameters of Eclipse, but some tweaking hints are listed on the original Eclipse page here.
Modules for Eclipse you need:
As mentioned above, it is easiest to start with an integrated Eclipse containing CDT already. However these prebuilt configurations were available only in 32-bit versions the time of this writing. So some users who need full 64-bit versions may need to configure Eclipse by hand. If this is the case, the CDT tools can be integrated by hand into Eclipse. If you want to use Eclipse to connect to Slicer's SVN repository and compare versions, update source, etc. (highly recommended), then you'll need to add the Subclipse package to Eclipse. Please see the original Eclipse Wiki page here for instructions adding these packages into Eclipse. The URLs for these two Eclipse plug-ins are:
- CDT – C++ Environment: http://www.eclipse.org/cdt
- Subclipse: http://subclipse.tigris.org/install.html
Creating Project and getting the Source-Code for it:
- Build Slicer using getbuildtest.tcl or your favorite build system.
For this discussion, lets assume "/usr/local/slicers/trunk" contains the Slicer3* directories. So we could go into /usr/local/slicers/trunk/Slicer3-build and type "make".
- Create a new C++ project in Eclipse. Yes, it is a Makefile project. Uncheck "Use default location". Select the Browse function and navigator to the Slicer3 source directory for the Eclipse project location. In our example case, we would select "/usr/local/slicers/trunk/Slicer3". In my version of Eclipse (Galileo), it now has more options for the Project. I selected "Makefile Project" and specified "Empty Project".
- Click "Finish" to create the project. We will edit the project info later to get it really working. The C++ indexer may take a few minutes the first time it is consuming the whole Slicer tree during this step. After this, it is pretty fast.
- You should see the project in the Explorer tab on the left now. Select then right click the project we just created. Mine was called "Slicer-trunk" and edit the project properties (the entry at the very bottom of the pop-up menu). The project properties dialog should pop up.
- Select the "C/C++ Build" branch of the tree diagram on the left of the dialog. In "Builder Settings", uncheck "Use default build command" .
- Enter the make command we want to use. Notice that we specified four jobs (to build faster) and specified the location to use as the current directory for the build:
make -j 4 -C /usr/local/slicers/trunk/Slicer3-build
- In the same pop-up window, enter the build directory again in the "Build location" dialog (same pathname as you just entered above in step 6). Now you can click OK to accept these entries. Eclipse should start building the project right away. You can see the C++ compilations go by in the "Console" tab at the bottom.
We are using Eclipse to fire off the makefile built by cmake. This means we can still go outside Eclipse and type "make" by hand anytime. Eclipse just knows how to fire off the make when necessary.
Anyone interested in using Eclipse, try these steps to get started. In a later email, or on the wiki, I'll talk about how to configure for debugging through the Eclipse interface.
Compile the projects:
After successfully configuring all projects eclipse should start automatically building the application. If this is not the case, right click on project and select “Build Project” and see how the project is compiling.