Developing CbmRoot with Eclipse

Install Eclipse

Please follow the instructions at .

Install CMake related Eclipse plugins

For a seamless integration of the CMake build system into the Eclipse IDE it is necessary to install an additional plugin from the Eclipse Marketplace. This procedure is described in simple steps below.

  1. Open Eclipse
  2. Click on Help to open the help menu. In the menu choose Eclipse Marketplace...
  3. In the new window type cmake in the search input box and click on Go or hit return.
  4. In the list shown choose the plugin cmake4eclipse and click on the Install button.
  5. Follow the instructions given during the plugin installation.
  6. If you want syntax highlighting for CMake files (*.cmake, CMakeLists.txt) install the plugin CMake Editor.

In the same way you can install any other plugin you like.

Setup CbmRoot in Eclipse

Follow the steps described below to setup CbmRoot in Eclipse such that all steps of the build process work from within Eclipse.
An important issue her is that you don't try to import an Eclipse project that was generated by cmake.
The instructions assume at this point that you have already installed FairSoft and FairRoot. If one of the packages is missing please follow the links to the installation instructions.

  1. Check out the CbmRoot source code. For instructions how to get the CbmRoot source code click here.
  2. Open the new C/C++ project wizard (File|New|C Project or File|New|C++ Project).
  3. Make sure the project location points to root directory of your previously checked out files.
  4. For the project type, select Executable. You may also select Shared Library or Static Library, it does not matter, that information is later read from your CMakeLists.txt. Do not select Makefile project here!
  5. Finish project creation.
  6. Set the project up. After each change click on Apply. Otherwise the changes maybe lost.
    1. Choose your project in Project Explorer on the left side of Eclipse.
    2. Open the project properties for your new project (Project| Properties).
    3. Open topic C/C++ Build.
      1. Check Generate Makefiles automatically.
      2. Choose External Builder as Builder type.
      3. If you want to compile in parallel uncheck Use default build command and change make to make -j<nr_of_parallel_processes>.
    4. Open topic C/C++ Build -> CMake.
      1. Choose Tab Symbols and Add the following symbols.
        1. CMAKE_CXX_COMPILER : clang++ or g++ (depending on the compiler used to build FairSoft and FairRoot)
        2. CMAKE_C_COMPILER : clang or gcc (depending on the compiler used to build FairSoft and FairRoot)
    5. Open topic C/C++ Build -> CMake -> Host OS overrides.
      1. If the cmake executable is installed in an unusual path uncheck Use cmake executable found on system path and add the correct cmake executable (including path) in the text field.
    6. Open topic C/C++ Build -> Tool Chain Editor.
      1. Set CMake Make Builder as current builder.
    7. Open topic C/C++ Build -> Environment.
      1. Add the needed environment variables FAIRROOTPATH and SIMPATH which point to the installation directories of FairRoot and FairSoft.
      2. If you have executables installed at unusual places Add also an environment variable PATH listing all needed directories.
        (V.F.: For me on MAC 0S 10.10, it was successful to copy the content of the PATH variable from a fresh shell. Particularly important seems to be to have /usr/local/bin included.)
  7. Build the project This will first invoke cmake to generate the build scripts and the will invoke make.

VF: I had in addition to manually add the include paths of external software:
Project -> Properties -> C/C++ General -> Paths and Symbols
Under "Includes" for language GNU C++ I added e.g. ${FAIRROOTPATH}/include and ${SIMPATH}/root/include. Otherwise, the code analyzer did not find the respective header files.