Eclipse CDT - Which extension point to provide per-file build settings? - eclipse-cdt

In eclipse, my plugin is trying to programmatically set the build settings (defines, include paths) for each C/C++ source file separately. I have found the CExternalSettingsProvider extension point, but the getSettings method only receives the build configuration and an IProject. Is there an extension point with a method that receives the actual file being built, so that individual settings can be provided for it?

Related

Build failed with no stated reason on Segger Embedded Studio after adding custom source files

I'm modifying a simple example project (blinky) from the nRF SDK. I added a header file and a .c file in a new folder inside the project directory then added that path ./lib to the common preprocessor user include directories. I then included the header to main.c.
I can compile the new library on its own but when I build the whole project, I get Build failed error with no stated reason to follow up.
Here is an image of that:
Does anyone here know how to beat this?
I haven't used Segger Studio specifically, but it seems to be the CrossWorks IDE underneath.
In CrossWorks, you have to do the following:
Download & install all relevant libs from inside the IDE, under Tools -> Packages -> Install packages. Grab your specific target MCU as well as any specific boards or libraries you'll be using. In case some needed lib is missing here, you will get very weird errors.
In the project, click on the project name itself in "project explorer". Then in the properties window, check settings (this is a bit different in different versions of CrossWorks, might have to right click and pick properties in older versions). Under "user include directories" you should have something like this:
$(DeviceIncludePath)
$(TargetsDir)/NameOfMCU/Include
$(PackagesDir)/CMSIS_4/CMSIS/Include
$(ProjectDir)/NameOfDirectory
Where "NameOfMCU" is the name of the MCU family used, CMSIS should be there in case you are using any ARM, "NameOfDirectory" is the name of your custom directory (you can add several).
Also, get the debug build working first, before switching to release build.

Building VST3 example does not build vst3 file

I am trying to building an out of the box example project for the steinberg Vst3 sdk.
I am trying to build the adelay example.
When I build it, it outputs ADelay.bsc, ADelay.exp, ADelay.lib, and adelay.pdb. But it does not output either a dll or a vst3, which would be expected for this kind of plugin. I read in another thread that you should change the Target in project properties to .dll, but that did not work for me at all.
Are you using VS?
If so, right click on ADelay->Properties->Configuration Properties->VC++ Directories->Include Directories->Edit, then you set your path to ...\VST3 SDK\public.sdk\source;
Then go back to Configuration Properties->Linker->General->Output File->inherit from parent or project defaults.
Then run it. You should find a .vst3 file inside your debug folder.

Setting Include files and Libraries in Eclipse c++. Still gives error

I have set include directories and library files in Eclipse c++, still I get below error.
In my program I have the include directive
#include <xercesc/parsers/XercesDOMParser.hpp>
Error shown - 'fatal error: xercesc/parsers/XercesDOMParser.hpp: No such file or directory'
Attached images of how I set include paths and libraries. Am I doing it correctly? Or Am I missing something?
You have modified the indexer settings, rather than the build settings. Try changing the settings in C/C++ Build -> Settings instead.
Indexer Settings (in C/C++ General)
These control how CDT highlights code and code completion and various other features of CDT work. The indexer settings inherit the build settings. If you note in your first screenshot there is a "CDT Managed Build Setting Entries" just below where you have added your paths, that is where the setting from the build are populated.
You would normally only need to modify these settings if you have some configuration on your system that CDT cannot automatically detect.
Build Settings (in C/C++ Build)
These control the arguments that are passed to the compiler. In addition, these settings are inherited by the indexer (see above) to handle indexer features.
So for example, if you set build settings for an extra include path like this:
It is automatically set for you in the indexer settings, see:
and here:

Eclipse CDT Kepler Importing Makefile project

I would love to import a Makefile project from Eclipse, and have all the different includes path that the compiler uses to create correctly my Eclipse project.
Unfortunately, those path, specified on the command line by a "-I" don't show up in Project Explorer and I have to add them by hand.
I am currently importing the project using the standard "Import project from Makefile" built in Eclipse.
If I'm not wrong there was an autodiscovery option in older versions of Eclipse, but it's not there anymore.
How do you do for having all your include paths set up without too much hassle?
The trick is NOT to use
File->New->Makefile Project with Existing Code
but to use
File->New->C++ Project
and then to select
Makefile project->Empty project.
After you set up such a dummy project, you simply copy your existing source to that project directory, hit F5 (i.e. Refresh) and change the build command to use your Makefile.
I was able to get this to work using Luna. I imported using File->New->C++->Makefile Project with Existing Code.
Prior to launching eclipse, you have to be sure to source any files that set required environment variables.
I did have some build options which were not the standard all and clean, so I had to add those configurations individually.
source files to setup your environment.
Launch Eclipse
Import C++ Makefile project
Setup Build options.
Click the hammer.

Project files in KDevelop

I am trying to use KDevelop to write a cmake based simple application. KDevelop created two myProject.kdev4 project files: one in the project folder and one in .kdev4 hidden subfolder. Both are non-empty. Which ones should I check in? How can I make kdevelop use just one project file (and preferably not use hidden folders)?
The .kdev4 file is used for kdevelop specific information (It mainly only tells KDevelop to use the CMake project manager). The folder includes user specific configuration (If you are familiar with Visual Studio, it is like the .user files).
Usually only the CMakeLists.txt files are needed as they should have all the relevant generic data. You can throw in the .kdev4 file so that you don't need to 'import' the project through the CMakeLists.txt on another machine. But the .kdev4 folder should stay in your local machine, as you don't want to mix user's configurations.