-
-
Notifications
You must be signed in to change notification settings - Fork 606
Working With Eclipse CDT
Eclipse CDT is provided by fedora packages, so simply: yum install eclipse-cdt
You can always install eclipse CDT following instructions from https://www.eclipse.org/cdt/.
Eclipse uses a Java virtual machine started with a fixed upper limit on its heap size, defined in /etc/eclipse.ini. This limit is often not large enough for indexing the OSv project. It's recommended to edit /etc/eclipse.ini and make sure the "-Xmx" setting is at least 1 GB.
After installing eclipse-cdt, you'll need to create OSv project to work with. Eclipse support some built-in project templates, but since we already have OSv downloaded from git, we do not want to have things messed up by eclipse.
So under File -> New -> Project, select C/C++ folder and than select "Makefile Project with Existing Code".
Click Next.
Give a project name and select the place where OSv code was downloaded.
You can now click Finish.
OSv has some particularities that eclipse do not understand as default, such as:
- It does have it's own libc/stdc++/libboost implementation
- Its' a Kernel
- It's c++11
- It has a lot of includes paths that preprocessor should be awere of.
Unfortunately there is no magic configuration file that address all of this, so some manual configuration is needed.
Project -> Properties -> C/C++ General -> Preprocessor Includes -> GNU C++ -> CDT User Setting Entries -> Add a "Preprocessor Macro"; Name: __GXX_EXPERIMENTAL_CXX0X__
value: 1
Project -> Properties -> C/C++ General -> Preprocessor Includes -> GNU C++ -> CDT User Setting Entries -> Add a “Include Directory”, in “Filesystem”, “/usr/include”
To use OSv provided libs and includes, and to work correctly with c++11, we need some more tweaks. So go to:
Project -> Properties -> C/C++ General -> Preprocessor Includes
Under Provides tab, select CDT GCC Built-in Compiler Settings and uncheck "Use global provider shared between projects". Use the following command:
${COMMAND} -E -P -v -dD "${INPUTS}" -std=c++11 -include /YOUR_PATH_TO_OSV_SOURCE/include/api/stdalign.h -nostdlib -nostdinc -nostdinc++
do not forget to replace YOUR_PATH_TO_OSV_SOURCE
This will prevent indexer to guess things in a wrong way:
Project -> Properties -> C/C++ General -> Indexer
Uncheck: "Index source files not included in the build" and "Allow heuristic resolution of includes'.
To make OSv's code formatter conform to OSv's coding style, go to Project -> Properties -> C/C++ General -> Formatter, Set "Enable project specific settings", choose the K&R formatter and then click on the "Edit..." button to edit the formatter, choose a new name (e.g., "OSV") and in the "Indentation" setting choose "spaces only" as a tab policy.