------------------------------------------------------------------
ECLIPSE
------------------------------------------------------------------

Download ECLIPSE (https://eclipse.org/downloads/)

Choose "Download packages" and select either of two:
Eclipse for Parallel Application Developers
Eclipse IDE for C/C++ Developers

Unpack and install to /opt simply by copying the whole directory:

sudo cp -r eclipse /opt

------------------------------------------------------------------
ENVIRONMENT (This step is necessary for system-wide setting)
------------------------------------------------------------------

Access environment file (create if does not exist)
sudo nano /etc/profile.d/environment.sh

Add line:
export PATH=$PATH:/opt/eclipse

Close and save file (ctrl+x, then y)

Logout and login from Linux DESKTOP! or just restart.

Check your environment with echo command (e.g. echo $PATH).

------------------------------------------------------------------
DESKTOP LAUNCHER (highly recommended)
------------------------------------------------------------------

You can create desktop launcher on most Linux desktops

As "name" type Eclipse
As "command" type eclipse (should be in your PATH already, see above)

On GNOME or Cinnamon desktops Eclipse may have an issue with blinking window during scrolling.
This is cured by replacing the "command" field in the launcher like this:

env SWT_GTK3=0 eclipse

Click on an icon button and select the icon file provided with eclipse installation:

/opt/eclipse/icon.xpm

DON'T select "launch in terminal"

Desktop launcher can be also added to the panel (very convenient)

Start Eclipse by clicking the launcher

------------------------------------------------------------------
CONFIGURE PROJECT
------------------------------------------------------------------

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 build your application (e.g. mode=deb all for LaMEM),
   set Clean to clean the application (e.g. mode=deb clean_all for LaMEM)

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

   PETSc (version X.Y.Z) applications would require setting:
      /opt/mpich3/include
      /opt/petsc/petsc-X.Y.Z-deb/include

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

	To make sure Eclipse recognizes paths correctly, rebuild the index:
	Right click on your project, select Index -> Rebuild

8. Set PETSC_DEB variable if it is not set globally, or if current project needs different PETSc version:

	In the project properties select C/C++ Build -> Environment -> Add
	As name set PETSC_DEB
	As value set actual path
	Select "Add to all configurations"

9. Build your application by clicking Hammer icon

You may also find these settings helpful:
   Window->Preferences->General->Editors->Text Editors, check box Show line numbers
   Window->Preferences->C/C++->Editor, uncheck box Highlight inactive code

------------------------------------------------------------------
RUN AND DEBUG PROJECT
------------------------------------------------------------------

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

2. 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)

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

------------------------------------------------------------------


