Difference between revisions of "Using Eclipse"

From Inkscape Wiki
Jump to navigation Jump to search
(Debugging text, still no images)
(a)
Line 23: Line 23:
In Eclipse, we want the SVN perspective to be open.  Click '''Window > Open Perspective > Other'''.  Choose '''SVN Repository Exploring''' and click ok.
In Eclipse, we want the SVN perspective to be open.  Click '''Window > Open Perspective > Other'''.  Choose '''SVN Repository Exploring''' and click ok.


-> screenshot-01.png
 
[[Image:Eclipse-01.png]]




In the '''SVN Repository''' tab, right click and choose '''New > Repository Location...'''.
In the '''SVN Repository''' tab, right click and choose '''New > Repository Location...'''.


-> screenshot-02.png
 
[[Image:Eclipse-02.png]]
 


In the '''Location Url:''' box, paste the link https://svn.sourceforge.net/svnroot/inkscape/inkscape/trunk and click finish.  This location will now show in the '''SVN Repository''' tab.  You can expand the tree to see what is on the server.
In the '''Location Url:''' box, paste the link https://svn.sourceforge.net/svnroot/inkscape/inkscape/trunk and click finish.  This location will now show in the '''SVN Repository''' tab.  You can expand the tree to see what is on the server.
Line 36: Line 39:
In the New Project window that appears, choose '''Standard Make C++ Project''' and click '''Next'''.
In the New Project window that appears, choose '''Standard Make C++ Project''' and click '''Next'''.


-> screenshot-03.png
 
[[Image:Eclipse-03.png]]
 


Give your project a name such as InkscapeSVN.  Uncheck the '''Use default location''' box so you can provide a better project location outside of your workspace, such as C:\InkscapeSVN.  Click '''Finish'''.  The source code will now be checked out - this may take a while.  You will also now have a project in the '''C/C++ Perspective''' with whatever name you provided earlier.
Give your project a name such as InkscapeSVN.  Uncheck the '''Use default location''' box so you can provide a better project location outside of your workspace, such as C:\InkscapeSVN.  Click '''Finish'''.  The source code will now be checked out - this may take a while.  You will also now have a project in the '''C/C++ Perspective''' with whatever name you provided earlier.


=== TortoiseSVN ===
=== TortoiseSVN ===
Line 47: Line 53:


At this point, you will be able to use TortoiseSVN or Subclipse within Eclipse to control the source.
At this point, you will be able to use TortoiseSVN or Subclipse within Eclipse to control the source.


== Building ==
== Building ==
Line 54: Line 61:
To set up Eclipse to do this, make sure you are in the '''C/C++ Perspective''' and that your project is open.  Right click on the project name and click '''Properties'''.  Click on '''Builders'''.  Uncheck any builders that are there since we will be using the custom btool.  Click '''New...''' and select '''Program'''.
To set up Eclipse to do this, make sure you are in the '''C/C++ Perspective''' and that your project is open.  Right click on the project name and click '''Properties'''.  Click on '''Builders'''.  Uncheck any builders that are there since we will be using the custom btool.  Click '''New...''' and select '''Program'''.


-> screenshot-04.png
 
[[Image:Eclipse-04.png]]
 


In the '''Main''' tab, browse the workspace for the location of the btool.exe file.  Browse the workspace again to set the working directory to the main project directory.
In the '''Main''' tab, browse the workspace for the location of the btool.exe file.  Browse the workspace again to set the working directory to the main project directory.


-> screenshot-05.png
 
[[Image:Eclipse-05.png]]
 


Now go to the '''Environment Tab''' and add a new variable called path.  Add the same thing that appears in your mingenv.bat file here.
Now go to the '''Environment Tab''' and add a new variable called path.  Add the same thing that appears in your mingenv.bat file here.


-> screenshot-06.png


-> screenshot-07.png
[[Image:Eclipse-06.png]]
 
 
[[Image:Eclipse-07.png]]
 


Click on '''C/C++ Project Paths''' and then the tab '''Path Containers'''.  Click '''Add...''', choose '''Discovered scanner configuration container''', '''Next''', '''Discovered Paths''', and '''Finish'''.
Click on '''C/C++ Project Paths''' and then the tab '''Path Containers'''.  Click '''Add...''', choose '''Discovered scanner configuration container''', '''Next''', '''Discovered Paths''', and '''Finish'''.
Line 70: Line 84:
Now go to '''C/C++ Include Paths and Symbols'''.  Click '''Add Contributed''' and choose the '''Discovered scanner configuration container''', then '''Discovered Paths'''.  Then click '''Add External Include Path''' and add the path to your GTK folder (probably something like c:\gtk210).
Now go to '''C/C++ Include Paths and Symbols'''.  Click '''Add Contributed''' and choose the '''Discovered scanner configuration container''', then '''Discovered Paths'''.  Then click '''Add External Include Path''' and add the path to your GTK folder (probably something like c:\gtk210).


-> screenshot-08.png
 
[[Image:Eclipse-08.png]]
 


You should now be able to use the '''Project > Build All''' command, capturing the output onto Eclipse's console.
You should now be able to use the '''Project > Build All''' command, capturing the output onto Eclipse's console.


== Debugging ==
== Debugging ==
Line 93: Line 110:
These screenshots show you the values you have to change in each tab.  Nothing else needs to change.
These screenshots show you the values you have to change in each tab.  Nothing else needs to change.


-> screenshot-09.png


-> screenshot-10.png
[[Image:Eclipse-09.png]]
 
 
[[Image:Eclipse-10.png]]
 


Now you can launch this new configuration and debug away!
Now you can launch this new configuration and debug away!


(Don't worry about funny warnings about files or folders not existing - it doesn't seem to affect the use of the debugger.  However, if you know how to fix it, please replace this comment with instructions.)
(Don't worry about funny warnings about files or folders not existing - it doesn't seem to affect the use of the debugger.  However, if you know how to fix it, please replace this comment with instructions.)

Revision as of 21:40, 31 May 2007

Eclipse is a popular development tool used primarily with Java; however, with the CDT plugin, C/C++ development can also be done. This page will help you set up Eclipse for coding, building, and debugging Inkscape.

Eclipse on Windows

Running Eclipse provides a relatively easy and familiar way to work with Inkscape code on Windows. This section will explain how to make it happen.

Note: Some of these instructions may be applicable to development on Mac or Linux. Feel free to refactor them if you are adding information for those platforms.

Initial Setup

First, if you don't have Eclipse, get it. Check out the online help if needed.

Next, you need to set up the necessary add-ons. Most important is the CDT plug-in which facilitates C/C++ development. You may also wish to add Subclipse for SVN access within Eclipse. Alternatively, many Windows users prefer to use TortoiseSVN, which works with Windows Explorer.

Finally, follow the instructions on the Win32Port page under the heading Inkscape under Windows.

Creating a Project

Subclipse

The next step is to get the source code ready for use in Eclipse. Check here for general instructions for working with SVN; in this section, the aim is to show how to check out the code using Subclipse.

In Eclipse, we want the SVN perspective to be open. Click Window > Open Perspective > Other. Choose SVN Repository Exploring and click ok.


Eclipse-01.png


In the SVN Repository tab, right click and choose New > Repository Location....


Eclipse-02.png


In the Location Url: box, paste the link https://svn.sourceforge.net/svnroot/inkscape/inkscape/trunk and click finish. This location will now show in the SVN Repository tab. You can expand the tree to see what is on the server.

Now right click the location name (which is really just the link given above), and click Checkout.... Choose Check out as a project configured using the New Project Wizard and the revision you want (probably Head), and click Finish.

In the New Project window that appears, choose Standard Make C++ Project and click Next.


Eclipse-03.png


Give your project a name such as InkscapeSVN. Uncheck the Use default location box so you can provide a better project location outside of your workspace, such as C:\InkscapeSVN. Click Finish. The source code will now be checked out - this may take a while. You will also now have a project in the C/C++ Perspective with whatever name you provided earlier.


TortoiseSVN

To use TortoiseSVN instead of Subclipse to check out your project, open a Windows Explorer instance. Right click anywhere outside of an existing SVN tree and choose SVN Checkout.... Specify the link given above and the destination directory.

To get a project in Eclipse, go to the C/C++ Perspective. Right click in the C/C++ Projects tab, and choose New > Project... and in the window choose Standard Make C++ Project. Give the project a name, and uncheck the Use default location box. You must give the location that you checked the code out into here.

At this point, you will be able to use TortoiseSVN or Subclipse within Eclipse to control the source.


Building

Be sure you have the btool built and ready to go, as outlined on the Win32Port page. You can build Inkscape from the command line or initiate it from within Eclipse, which will capture the output for you.

To set up Eclipse to do this, make sure you are in the C/C++ Perspective and that your project is open. Right click on the project name and click Properties. Click on Builders. Uncheck any builders that are there since we will be using the custom btool. Click New... and select Program.


Eclipse-04.png


In the Main tab, browse the workspace for the location of the btool.exe file. Browse the workspace again to set the working directory to the main project directory.


Eclipse-05.png


Now go to the Environment Tab and add a new variable called path. Add the same thing that appears in your mingenv.bat file here.


Eclipse-06.png


Eclipse-07.png


Click on C/C++ Project Paths and then the tab Path Containers. Click Add..., choose Discovered scanner configuration container, Next, Discovered Paths, and Finish.

Now go to C/C++ Include Paths and Symbols. Click Add Contributed and choose the Discovered scanner configuration container, then Discovered Paths. Then click Add External Include Path and add the path to your GTK folder (probably something like c:\gtk210).


Eclipse-08.png


You should now be able to use the Project > Build All command, capturing the output onto Eclipse's console.


Debugging

You need to make a couple of changes to the build.xml file and do a clean rebuild. First, add -g to the flags section:

 <flags>
     -Wall -O3
     -mms-bitfields
     -g
 </flags>

Then avoid stripping symbol information from the exe by changing this line

     strip="true" symfile="${build}/inkscape.dbg"

with this one

     strip="false" symfile="${build}/inkscape.dbg"

Now you need to create a debugging instance in Eclipse. Click Run > Debug.... Click on C/C++ Local Application and then click the new button. Give the launch configuration a logical name such as Inkscape Debug.

These screenshots show you the values you have to change in each tab. Nothing else needs to change.


Eclipse-09.png


Eclipse-10.png


Now you can launch this new configuration and debug away!

(Don't worry about funny warnings about files or folders not existing - it doesn't seem to affect the use of the debugger. However, if you know how to fix it, please replace this comment with instructions.)