Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Programatically how to convert project from one toolchain to another(Programatically changing toolchain)
Programatically how to convert project from one toolchain to another [message #1220364] Wed, 11 December 2013 10:24 Go to next message
Babu M is currently offline Babu MFriend
Messages: 20
Registered: February 2012
Junior Member
I am trying to understand on how to convert a project from one toolchain to another.

From UI, I can simply go to Project > Properties > Toolchain Editor > 'Display compatible toolchains only' combo and can convert. How can I do this programmatically?.

I didn't find much help documentation on this. Please suggest any helpful documentation.

Currently I am facing the following issues:
I have implemented 2 custom toolchains by defining the 'org.eclipse.cdt.managedbuilder.core.buildDefinitions' extension.

1) Toolchain-1
2) Toolchain-2

How can I make Toolchain-2 compatible with Toolchain-1 OR vis-a-versa?

Ideally, when I create a project using Toolchain-1, I should see Toolchain-2 also in the Toolchain Editor > 'Display compatible toolchains only' combo.

Please point me on what i am missing here to configure.

I have create a mingw project and verified the compatible option and the following list of toolchains appeared. Please help.
- Cygwin GCC
- Linux GCC
- Solaris GCC
so on..

-Babu
Re: Programatically how to convert project from one toolchain to another [message #1220712 is a reply to message #1220364] Fri, 13 December 2013 09:05 Go to previous message
Babu M is currently offline Babu MFriend
Messages: 20
Registered: February 2012
Junior Member
got it.. this should do a conversion.

try {
ManagedCProjectNature.addManagedNature(project,
new SubProgressMonitor(monitor, 1));

CCorePlugin.getDefault().mapCProjectOwner(project, projectId, true);

IManagedProject newManagedProject = null;
IManagedBuildInfo info = null;

try {
info = ManagedBuildManager.createBuildInfo(project);
IProjectType projectType = ManagedBuildManager
.getExtensionProjectType(projectId);
newManagedProject = ManagedBuildManager.createManagedProject(
project, projectType);

if (newManagedProject != null) {
IConfiguration[] selectedConfigs = projectType
.getConfigurations();
for (int i = 0; i < selectedConfigs.length; i++) {
IConfiguration config = selectedConfigs[i];
int id = ManagedBuildManager.getRandomNumber();
IConfiguration newConfig = newManagedProject
.createConfiguration(config, config.getId()
+ "." + id);
newConfig.setArtifactName(project.getName());
}
IConfiguration[] newConfigs = newManagedProject
.getConfigurations();
for (int i = 0; i < newConfigs.length; i++) {
if (newConfigs[i].isSupported()) {
defaultCfg = newConfigs[i];
break;
}
}

if (defaultCfg == null && newConfigs.length > 0)
defaultCfg = newConfigs[0];

if (defaultCfg != null) {
ManagedBuildManager.setDefaultConfiguration(project,
defaultCfg);
ManagedBuildManager.setSelectedConfiguration(project,
defaultCfg);
}
ManagedBuildManager.setNewProjectVersion(project);
}
} catch (BuildException e) {
e.printStackTrace();
}
if (info != null) {
info.setValid(true);
ManagedBuildManager.saveBuildInfo(project, true);
}
Previous Topic:How does CDT detect the include path in makefile project?
Next Topic:Error management issue with Eclipse Parallel
Goto Forum:
  


Current Time: Fri Sep 20 13:16:08 GMT 2024

Powered by FUDForum. Page generated in 0.03328 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top