Hacking:Eclipse

From GIMP Developer Wiki
Revision as of 17:54, 4 May 2014 by Scl (Talk | contribs)

Jump to: navigation, search

This page will teach you how to set Eclipse IDE to work on the latest source of GIMP from git.

About Eclipse

Why use Eclipse to work on Babl, GEGL and GIMP?

Some of the features that are interesting for C/C++ developers are:

  • cross-referencing: Ctrl click an identifier and it will take you to its definition,
  • call hierarchy,
  • comprehensive search capabilities,
  • built in Git support,
  • Autotools integration,
  • graphical debugger,
  • explore remote systems from within Eclipse,
  • focus on the current task,
  • Bugzilla integration,
  • static code analysis.

and more. Eclipse runs on every platform that can run Java and has a graphical interface.

It is actively developed and maintained from a living community, see the Eclipse community forums.

Why not to use Eclipse to work on Babl, GEGL and GIMP?

Because it's not Emacs :-P

Eclipse is sometimes a bit slow.

Preparations

The following steps describe the process for Eclipse 4.3 'Kepler' on Linux. It is assumed that your workspace for all projects is /home/user/workspace and GIMP will be installed in /home/user/prefix/gimp.

The continuous example uses Babl, because it is small and easy for a start. Where necessary the tutorial describes the differences for GEGL and GIMP.

Prepare the build environment

clone the Babl Git repository into your workspace:

  1. cd /home/user/workspace
  2. git clone git://git.gnome.org/Babl

To the same for GEGL and GIMP.

Get Eclipse

The easiest way is simply to download Eclipse IDE for C/C++ Developers). If you already have a working Eclipse installation and want to upgrade it, then download the following plug-ins:

  • CDT (for C/C++ development),

and optionally

  • Web Developer Tools (to edit HTML, XML and XSL),
  • EGit (for Git integration),
  • Subversive (for Subversion integration),
  • Mylyn Task List (for Bugzilla integration and task focused working),
  • Remote Systems Explorer (to manage files, search, execute commands and debug on remote systems).

Configure Eclipse to work on Babl, GEGL and GIMP

Create projects

  1. Open the C/C++ perspective.
  2. Create the project: File/New/Makefile Project with Existing Code:
    • Leave the field 'Project Name' empty. It will be filled in the next step.
    • Click 'Browse' behind 'Existing Code Location' and select /home/user/workspace/babl.
    • Languages: C (for GEGL also C++).
    • Toolchain for Indexer settings: GNU Autotools Toolchain
  3. Tell Eclipse that it is an Autotools project, so you can build in Eclipse:
    • Right click on the project
    • From the context menu select New/Convert to a C/C++ Autotools project
    • Candidates for conversion: babl; Convert to C or C++: C
    • For Babl you're done, press 'Finish'. Otherwise hit 'Next' button two times.
    • Referenced C/C++ projects: For GEGL: babl, For GIMP: babl and gegl

Share projects with Git

  1. Open the 'Git Repository Exploring' perspective.
  2. Open the 'Git Repositories' view.
  3. Add an existing local Git repositoriy to this view by clicking the button with this tooltip:
    • Directory: Browse, select /home/user/workspace/babl.
    • Make sure that Babl is checked in the search results list.
  4. Open the C/C++ perspective.
  5. Right click on the Babl project, select 'Team/Share Project...':
    • Repository type: Git
    • select repository: the Babl Git repository

It is important to have created the Git repository before connecting to it from Eclipse. Eclipse refuses trying to create the repository in Babl's workspace folder, so we have to keep this order.

Configure build environment

Integrate Autotools

Working with Eclipse

Code

Build

Install

Miscellanous

Problems and solutions

See the Problems and Solutions page.