Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Issues with integrating a GCC based toolcahin

Hi All,

I've spent a few days trying to get our GCC based C language toolchain
working with the new CDT 4.0 project model.  I've had some success -- in
particular creating the derived toolchain subclassing the default GNU C
toolchain as well as adding some extra options has gone without a hitch.
However I've had some problems with the project creation workflow and
specifying the include paths for the compiler and our SDK.  The case is
very simple: tools are dynamically launched dependent on a version
environment variable, and the shared libraries have the version in their
path (i.e. /project/sdk/${version}/include /project/sdk/${version}/lib).


I was wondering whether the issues I came up against were known
deficiencies or whether I had missed something; any ideas would be
greatly appreciated!

1) Scanner info provider: 
It doesn't seem to be possible to override the GCC command to call
'our_gcc' without defining a new ScannerConfigurationDiscoveryProfile
extension.  Furthermore the managedbuild.scannerconfig classes are
internal and not exported.  It seems that to use the existing
functionality you have to copy cdt classes to your own plugin, or modify
managedbuilder.core's MANIFEST.MF to increase visibility of the package?
This has been asked before
(http://dev.eclipse.org/mhonarc/lists/cdt-dev/msg10458.html).
More minor: the Extensibility Document doesn't detail the
scannerConfigDiscoveryProviderId within InputType (only the one in the
toolchain).

2) Template Engine:
I wanted to give users a choice of toolchain / version of SDK (fetched
programmatically) to use at project creation time.  This template engine
initially looked ideal (especially with the ability to use/enhance its
processes), but doesn't appear to be flexible enough to allow this:
i) You can't programmatically populate template pop-up menus (this has
been asked before so I filed a bug 219456).
ii) It doesn't seem possible to chain templates.  i.e. irrespective of
the template chosen I would like to prompt the user to customise their
toolchain.
More minor: Why is there an "Empty Project" template for the
buildArtefactType.exe Project Type?  None of the other Project types
have this, and it appears to be a NOP.

4) Extending newWizardPages
Not being able to use the templateEngine, I extended newWizardPages.  My
page and its operation get correctly called.  
The extensibility document gives a system overview image (7.14.2.1)
shows a CProjectPlatformPage class which no longer seems to exist (and
the comment in MBSCustomPageManager.getPageProperty(...) states: "There
are certain well known pieces of data published by the stock wizard
pages provided by the Managed Build System. See
org.eclipse.cdt.maangedbuilder.ui.wizards.CProjectPlatformPage. @see
org.eclipse.cdt.maangedbuilder.ui.wizards.CProjectPlatformPage")

>From the Operation Runnable it isn't entirely obvious how to get the
Project which has just been created:
	public void run() {
		MBSCustomPageData pageData =
MBSCustomPageManager.getPageData(SDKWizardPage.ID);
		IProject proj =
((CProjectWizard)pageData.getWizardPage().getWizard()).getLastProject();
		setEnvironmentVariables(proj);
	}
And then I set environment variables as is done by the EnvironmentTab:
	public void setEnvironmentVariables(IProject proj) {
		IContributedEnvironment ce =
CCorePlugin.getDefault().getBuildEnvironmentManager().getContributedEnvi
ronment();
		ICProjectDescription cprojDesc =
CoreModel.getDefault().getProjectDescription(proj);
		ICConfigurationDescription[] descr =
cprojDesc.getConfigurations();

		for (ICConfigurationDescription desc : descr) {
			if (desc.getId().contains("fpexe")) {
				ce.setAppendEnvironment(true, desc);
				for (String[] versions :
SDKWizardPage.toolChainVersions) {
					String version =
(String)MBSCustomPageManager.getPageProperty(FirepathSDKWizardPage.ID,
versions[0]);
					ce.addVariable(versions[1],
version, IEnvironmentVariable.ENVVAR_APPEND, ":", desc);
				}
			}
		}
		try {
	
CoreModel.getDefault().setProjectDescription(proj, cprojDesc);
		} catch (CoreException e) {
			System.out.println("Unable to persist project
environment variables: " + e.getMessage());
		}
	}

Unfortunately my page is shown after the "Select Configurations" page.
Also if the user pressed "Advanced Settings" causing the creation of the
the temporary project, my operation runnable is called without my page
having been shown! If the user exits the advanced dialog and presses
Next / Finish, the runnable isn't run again even if they alter settings
on my page...  If there isn't a way to change the ordering of pages, is
there a way to force the 'Select Configurations' page to appear last (so
in practise this won't be an issue) or am I doing something wrong?

5) Include paths:
Having done 4: the project has has been created before the operation
runner is executed, and the scanner collector has run.  The include
paths therefore have the discovered paths of the default toolchain
rather than the one the user specified.  
In fact whenever the environment variables for the compiler version is
changed, and the project rebuilt, the new compiler include paths are
added to the set of already existing include paths, rather than
replacing them.  How do I make it use the most recently discovered
paths?

Any ideas on any of the above would be greatly appreciated!

Thanks in advance,

James



Back to the top