mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 09:16:02 +02:00
Make Qt toolchain selection more resilient.
On my Windows box I have lots of GCC toolchains. Make sure it selects the one from the Qt install. And fix a few NPEs and things around that. Change-Id: Ifeeca9271b5055ac773b3b77e372a67e07305130
This commit is contained in:
parent
2198597a98
commit
736d7b5955
4 changed files with 13 additions and 9 deletions
|
@ -81,14 +81,16 @@ public abstract class CoreBuildLaunchConfigDelegate extends LaunchConfigurationT
|
|||
// Pick the first one that matches
|
||||
Map<String, String> properties = new HashMap<>();
|
||||
properties.putAll(target.getAttributes());
|
||||
Collection<IToolChain> tcs = toolChainManager.getToolChainsMatching(properties);
|
||||
if (!tcs.isEmpty()) {
|
||||
IToolChain toolChain = tcs.iterator().next();
|
||||
return configManager.getBuildConfiguration(project, toolChain, mode, monitor);
|
||||
for (IToolChain toolChain : toolChainManager.getToolChainsMatching(properties)) {
|
||||
ICBuildConfiguration buildConfig = configManager.getBuildConfiguration(project, toolChain, mode, monitor);
|
||||
if (buildConfig != null) {
|
||||
return buildConfig;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected IBinary getBinary(ICBuildConfiguration buildConfig) throws CoreException {
|
||||
IBinary[] binaries = buildConfig.getBuildOutput();
|
||||
IBinary exeFile = null;
|
||||
|
|
|
@ -10,7 +10,6 @@ package org.eclipse.cdt.internal.qt.core.build;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.build.ICBuildConfiguration;
|
||||
import org.eclipse.cdt.core.build.ICBuildConfigurationManager;
|
||||
import org.eclipse.cdt.core.build.ICBuildConfigurationProvider;
|
||||
|
@ -24,9 +23,7 @@ import org.eclipse.core.resources.IBuildConfiguration;
|
|||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
|
||||
public class QtBuildConfigurationProvider implements ICBuildConfigurationProvider {
|
||||
|
||||
|
@ -105,8 +102,7 @@ public class QtBuildConfigurationProvider implements ICBuildConfigurationProvide
|
|||
configManager.addBuildConfiguration(config, qtConfig);
|
||||
return qtConfig;
|
||||
} else {
|
||||
throw new CoreException(
|
||||
new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, Messages.QtBuildConfigurationProvider_NoQtInstall));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,12 +56,14 @@ public class QtMinGWToolChainProvider implements IToolChainProvider {
|
|||
IEnvironmentVariable.ENVVAR_PREPEND, File.pathSeparator) };
|
||||
GCCToolChain toolChain = new GCCToolChain(this, path.resolve(gcc),
|
||||
Platform.ARCH_X86, env);
|
||||
toolChain.setProperty(IToolChain.ATTR_OS, Platform.OS_WIN32);
|
||||
toolChain.setProperty(IToolChain.ATTR_PACKAGE, "qt"); //$NON-NLS-1$
|
||||
manager.addToolChain(toolChain);
|
||||
|
||||
if (Platform.getOSArch().equals(Platform.ARCH_X86_64)) {
|
||||
toolChain = new GCCToolChain(this, path.resolve(gcc), Platform.ARCH_X86_64,
|
||||
env);
|
||||
toolChain.setProperty(IToolChain.ATTR_OS, Platform.OS_WIN32);
|
||||
toolChain.setProperty(IToolChain.ATTR_PACKAGE, "qt"); //$NON-NLS-1$
|
||||
manager.addToolChain(toolChain);
|
||||
}
|
||||
|
|
|
@ -65,6 +65,10 @@ public class QtBuildTab extends CommonBuildTab {
|
|||
public void initializeFrom(ILaunchConfiguration configuration) {
|
||||
try {
|
||||
ICBuildConfiguration buildConfig = getBuildConfiguration();
|
||||
if (buildConfig == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// qmake command
|
||||
IToolChainManager tcManager = Activator.getService(IToolChainManager.class);
|
||||
IQtInstallManager qtManager = Activator.getService(IQtInstallManager.class);
|
||||
|
|
Loading…
Add table
Reference in a new issue