
Installation of Eclipse on OSX for development and sequential debugging

=====================
Eclipse Installation:
=====================

0. Download and unpack into Applications folder: 
	Eclipse IDE for C/C++ Developers

1. Go to eclipse folder and create file eclipse.command, put the string inside:
      /Applications/eclipse/eclipse &

2. Change permissions, execute in console chmod 755 eclipse.command

3. Drag eclipse.command to desktop

4. Right click desktop icon -> Get Info -> Name & Extension, change to Eclipse (optional)

5. Change desktop icon to original Eclipse logo with Command+c, Command+v (optional)

Also helpful: 
   Eclipse->Preferences->General->Editors->Text Editors, check box Show line numbers
                       ->C/C++->Editor, uncheck box Highlight inactive code

=========================================
Configuring and building Eclipse project:
=========================================

0. Start Eclipse

1. Right click in Project Explorer -> New -> Project -> C/C++ -> Makefile Project with Existing Code

2. Click Next and set Project Name and location of project ROOT! directory (not just src), click Finish

3. Right click on your project in the Explorer, select Properties -> C/C++ Build

4. Builder Settings tab -> Build directory -> File System, select full path path to project source directory

5. Behaviour tab -> Build (incremental build) set command to buld yor application (e.g. all for LaMEM), 
   set Clean to clean the application (e.g. clean_all for LaMEM)

6. Unfold C/C++ Build -> Settings -> Binary Parser (select Mach-O 64 Parser)

7. Add full paths to header files used in your project.

   Petsc applications would require setting:
      /opt/mpich2/include
      /opt/petsc/petsc-3.4.2-int32-debug/include, 

    Each path can be added as follows:
    In the project properties select Path and Symbols -> Includes -> Add
    Place directory path here, also check boxes:
       Add to all configurations 
       Add to all languages

8. Build your application by clicking Hammer icon

======================================
Running and debugging Eclipse project:
======================================

0. Run -> Run configurations -> double click C/C++ application -> Main tab -> Browse,
   select full path to application executable (e.g. in the /bin directory) 

1. Swich to Arguments tab -> Program aruments, 
      insert all command line options that you want to use with your application
   Arguments tab -> Working directory -> File System, 
      select full path to working directory (e.g. /tests, to avoid copying input files) 

2. Switch to debugging perspective: Window -> Open Perspective -> Debug, then click the bug icon 

======================================
TRICKS
======================================

0. Prevent incorrect interpretation of C++ stuff from C files:

Project -> Properties -> C/C++ General -> Language Mappings -> Add

Content type   C Header File
Language       GNU C++

Content type   C Source File
Language       GNU C++

Rebuild the index (Project -> Index -> Rebuild) and restart Eclipse


1. If global environment is difficult to modify, the following helps to modify environment from Eclipse:

Project -> Properties -> C/C++ Build -> Environment Add

Name:   PETSC_DEB
Value:  PATH_TO_PETSC_DEBUG_INSTALLATION

Name:   PATH
Value:  type in console echo $PATH and paste results here

