Using Eclipse 4.5 (Mars) on Windows 7
Introduction
After completing these installation instructions, you will have an IDE for GRASS that will allow you to perform that following development tasks:
Workbench
- Switch between C/C++, Python, Debug and SVN perspectives
Browsing
- Navigate the GRASS source code trunk
- Edit source code
- Select a symbol and go to to its declaration
Building
- Build the entire GRASS system
- Build an individual GRASS module
Running
- Run GRASS modules and Python scripts
Debugging
- Set breakpoints
- Single step through source code
- View variables and memory values
Versioning
- Commit source code to the SVN repository
- Update source code from the SVN repository
Install TortoiseSVN
Download and install from the TortoiseSVN Website.
During installation, include the "entire command line tools" so that "svn up" can be run from a MSYS shell or a Windows Command Prompt.
The following path should have been added to PATH:
C:\Program Files\TortoiseSVN\bin
From Command Prompt, enter the following command:
>where svn
To run 'svn up' from a Command Prompt, enter the following commands:
>cd C:\OSGeo4W\src\grass7_trunk
>svn up
To run 'svn up' from a MSYS shell, enter the following commands:
$ export PATH=$PATH:/c/"Program Files"/TortoiseSVN/bin
$ cd /c/OSGeo4W/src/grass7_trunk
$ svn up
Install OSGeo4W Runtime and Development Framework
Download and install the 32bit version from the OSGeo4W Website.
Checkout GRASS Source Code from the SVN Trunk
Checkout the GRASS development trunk using the SVN command from the GRASS Download Website.
Install Doxygen
Download and install from the | Doxygen Website.
Download and install from the | Graphviz Website.
Download and install from the | MikTeX Website.
Install Eclipse Mars
Download and install the 32bit version of Java SE Runtime Environment (JRE) from the Java Download Website
Download and install the 32bit version of Eclipse IDE for C/C++ Developers from the Eclipse Mars Download Website
Install PyDev Plug-In
Start Eclipse
Help -> Install New Software...
Set "Work with:" to "http://pydev.org/updates/"
Install SVN Plug-In
Start Eclipse
Help -> Install New Software...
Set "Work with:" to "Mars - http://download.eclipse.org/releases/mars"
Expand "Collaboration"
Scroll down and put a check mark in the "Subversive SVN Team Provider option.
Select "Next".
Select "Next" again.
Accept the license agreement.
Select "Finish".
Restart Eclipse.
When "Subversive Connector Discovery" prompts you for a selection, check "SVN Kit 1.8.10"
Select "Finish"
Select "Next".
Select "Next" again.
Accept the license agreement.
Select "Finish".
Select "OK" to the "security Warning"
Restart Eclipse.
Make SVN visible:
Window → Perspective → Customize Perspective...
Select the “Action Set Availability” tab.
Check the “SVN” option under “Available action sets”.
Select “OK”.
Window → Perspective → Customize Perspective...
Select the “Shortcuts” tab.
Check the “SVN” option under “Shortcut Categories”.
Select the “Menu Visibility” tab.
Check the “SVN” option under “Menu Structure”.
Select the “Tool Bar Visibility” tab.
Check the “SVN” option under “Tool Bar Structure”.
Select “OK”.
You should now see “SVN” on the main tool bar and the SVN tool bar available under the main toolbar.
Configure Eclipse Settings
Enable C/C++ Perspective
Window -> Perspective -> Open Perspective
Select 'Other...'
Select 'C/C++'
'OK'
Enable Python Perspective
Window -> Perspective -> Open Perspective
Select 'Other...'
Select 'PyDev'
'OK'
Enable Debug Perspective
Window -> Perspective -> Open Perspective
Select 'Other...'
Select 'Debug'
'OK'
Enable SVN Perspective
Window -> Perspective -> Open Perspective
Select 'Other...'
Select 'SVN Repository Exploring'
'OK'
Insert Spaces for Tabs
Window -> Preferences -> General -> Editors -> Text Editors
Set "Displayed tab width" to 4.
Check "Insert spaces for tabs"
"Apply"
"OK"
Window -> Preferences -> C/C++ -> Code Style -> Formatter
Select the 'New' button to create a new profile.
Enter 'GRASS' in the 'Profile name' field.
Select 'OK'.
Select the Indentation tab.
Under 'General settings', set Tab policy to: 'Spaces only'.
Click OK ad nauseum to apply the changes.
Uncheck Build Automatically
On task bar:
Click on "Project" > "Build Automatically" to uncheck this feature
Change Color of Python Comments
Window -> Preferences
Expand 'PyDev'.
Select 'Editor'.
In the 'Appearance color options' window:
Scroll down to 'Comments' and select.
Click on the 'Color' button to bring up options.
Select the green color that is located in the 3rd column from the left and 4th row from the top.
'OK'
'Apply'
'OK'
Create C/C++ Project
Create a C++, Makefile, Empty project
"File" -> "New" -> "Project..."
Expand "C/C++" option
Select "C++ Project"
"Next"
Uncheck "Use default location"
Browse to source code directory in SVN repository.
Example: C:\OSGeo4W\src\grass7_trunk
"OK"
Enter name in "Project name".
Example: "grass7_trunk".
Expand "Makefile project" under "Project type".
Select "Empty Project" under "Project type" and "MinGW GCC" under "Toolchains".
"Next"
Click on "Advanced settings..."
Click on the "C/C++ Build".
Click on the "Behavior" tab.
Leave "Build (Incremental Build)" Checked.
Enter "default" in the text box next to "Build (Incremental Build)" replacing any text that is already there (e.g., "all").
Click on "Apply"
Click on "OK"
Click on "Finish"
The "C/C++ Indexer" operation will take some time. Its progress can be monitored in the lower right-hand corner of the screen. Click on the rectangles in the corner to display progress details.