An update to this: I also tried to use my
project listener to programmatically add a CIncludePathEntry with the
ICSettingEntry.BUILTIN flag, following the guidelines found at the unofficial
CDT FAQ
http://cdt-devel-faq.wikidot.com/
I am able to add the path, but its BUILTIN
flag is ignored.
This discussion
http://www.nabble.com/Project-model:-More-questions-and-some-feedback-td9840195.html
seems to hint that there is no way to
modify the builtin settings programmatically! This would also explain why the flags
set by the externalSettingsProvider are ignored when the values are actually
stored in the project.
So, is the scanner discovery the only
viable option to dynamically modify include paths/etc?
Thanks again,
/Mario
From: cdt-dev-bounces@xxxxxxxxxxx
[mailto:cdt-dev-bounces@xxxxxxxxxxx] On
Behalf Of Mario Pierro
Sent: den 26 augusti 2009 16:08
To: CDT
General developers list.
Subject: RE: [cdt-dev]
externalSettingsProvider and built-in settings
Hi Andrew,
Thanks for your suggestion.
Unfortunately the information provided by
the externalSettingsProvider is always dynamic so it can’t be stored in
the project or in the toolchain…
I also tried to hack
scannerDiscoveryProfile for the same purpose – which seems to be tailored
for gcc-like compilers. That almost works but I am getting weird behavior in
projects using source folders, so I’d rather go for the
externalSettingsProvider way which seems more robust and concise.
The only thing I am missing is the
built-in flags to be stored…
/Mario
From:
cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Andrew Gvozdev
Sent: den 26 augusti 2009 15:16
To: CDT
General developers list.
Subject: Re: [cdt-dev]
externalSettingsProvider and built-in settings
Hi Mario,
As an alternative, you
could use org.eclipse.cdt.managedbuilder.core.buildDefinitions extension
point which lets you define the paths and set builtin flag in listOptionValue.
On Wed, Aug 26, 2009 at 9:00 AM, Mario Pierro <Mario.Pierro@xxxxxxx> wrote:
Hello,
I am trying to use the externalSettingsProvider extension point to add
include/library paths and predefined symbols programmatically to my
custom project type.
Following the instructions at
http://dev.eclipse.org/mhonarc/lists/cdt-dev/msg15279.html
and
http://dev.eclipse.org/newslists/news.eclipse.tools.cdt/msg17432.html
I managed to successfully add an external settings provider which is
added to my projects via an ICProjectListener class.
However, flags in the ICSettingEntry instances contributed by the
external settings provider seem to be ignored.
For instance, I am doing the following
public CExternalSetting[] getSettings(IProject project,
ICConfigurationDescription cfg) {
// We provide the same settings for all
configurations
// Create include path entries for all the
contributed paths
List<ICSettingEntry> includeSettings = new
ArrayList<ICSettingEntry>();
List<String> includePaths =
convertToForwardSlashes(getIncludePaths());
for (String path : includePaths)
includeSettings.add(new
CIncludePathEntry(path,
ICSettingEntry.BUILTIN));
.
.
.
where the getIncludePaths() will return my custom includes. I also
create CLibraryPathEntry and CMacroEntry objects in a very similar way.
I then create the CExternalSetting containers and send them out to CDT.
.
.
.
return new CExternalSetting[] {
// Include paths, for C/C++/ASM
new CExternalSetting(new
String[] {
"org.eclipse.cdt.core.gcc",
"org.eclipse.cdt.core.g++" },
new String[] { "org.eclipse.cdt.core.asmSource"
},
null, includeSettings.toArray(new
ICSettingEntry[0])),
// Library
new CExternalSetting(
null,
new String[] {
"org.eclipse.cdt.managedbuilder.core.compiledObjectFile" },
null, librarySettings.toArray(new
ICSettingEntry[0])),
// Symbols
new CExternalSetting(new
String[] {
"org.eclipse.cdt.core.gcc",
"org.eclipse.cdt.core.g++" }, null, null,
symbolSettings.toArray(new ICSettingEntry[0])),
};
This succeeds in contributing the paths and symbols to the project, but
they are not shown as built-in e.g. in the Include paths tab. Also, the
compiler will be invoked with -D options which attempt to redefine its
predefined symbols...
Is an external settings provider able to contribute built in
symbols/includes/etc.? I have not been able to find any further
documentation on this, nor any examples.
Thank you very much for your help!
/Mario
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev