Skip to main content
summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorDoug Schaefer2018-11-29 10:53:30 -0500
committerDoug Schaefer2018-11-29 11:41:13 -0500
commit62143e2bd7ac7a213a69cd350abb0fdab3616529 (patch)
treecff17bc3d04d1263f14d7404ae8684f0f796c728 /build
parent2f678054ff004cddbffebd0598eb4ff5bb297d3a (diff)
downloadorg.eclipse.cdt-62143e2bd7ac7a213a69cd350abb0fdab3616529.tar.gz
org.eclipse.cdt-62143e2bd7ac7a213a69cd350abb0fdab3616529.tar.xz
org.eclipse.cdt-62143e2bd7ac7a213a69cd350abb0fdab3616529.zip
Bug 541709 Figure out toolchain for Makefile projects.
The config is not valid without this. Using the same algorithm CMake projects do to find the default toolchain. Change-Id: I871da3019b7d440fbd6c1b2a4935d424f084a603
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileBuildConfigurationProvider.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileBuildConfigurationProvider.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileBuildConfigurationProvider.java
index 81c7bae29e..9a318d5c8c 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileBuildConfigurationProvider.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileBuildConfigurationProvider.java
@@ -10,15 +10,20 @@
*******************************************************************************/
package org.eclipse.cdt.make.core;
+import java.util.HashMap;
+import java.util.Map;
+
import org.eclipse.cdt.core.build.ICBuildConfiguration;
import org.eclipse.cdt.core.build.ICBuildConfigurationManager;
import org.eclipse.cdt.core.build.ICBuildConfigurationProvider;
import org.eclipse.cdt.core.build.IToolChain;
+import org.eclipse.cdt.core.build.IToolChainManager;
import org.eclipse.cdt.core.build.StandardBuildConfiguration;
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.Platform;
/**
* @since 7.4
@@ -34,6 +39,34 @@ public class MakefileBuildConfigurationProvider implements ICBuildConfigurationP
@Override
public ICBuildConfiguration getCBuildConfiguration(IBuildConfiguration config, String name) throws CoreException {
+ if (config.getName().equals(IBuildConfiguration.DEFAULT_CONFIG_NAME)) {
+ IToolChain toolChain = null;
+
+ // try the toolchain for the local target
+ Map<String, String> properties = new HashMap<>();
+ properties.put(IToolChain.ATTR_OS, Platform.getOS());
+ properties.put(IToolChain.ATTR_ARCH, Platform.getOSArch());
+ IToolChainManager toolChainManager = MakeCorePlugin.getService(IToolChainManager.class);
+ for (IToolChain tc : toolChainManager.getToolChainsMatching(properties)) {
+ toolChain = tc;
+ break;
+ }
+
+ // local didn't work, try and find one that does
+ if (toolChain == null) {
+ for (IToolChain tc : toolChainManager.getToolChainsMatching(new HashMap<>())) {
+ toolChain = tc;
+ break;
+ }
+ }
+
+ if (toolChain != null) {
+ return new StandardBuildConfiguration(config, name, toolChain, "run"); //$NON-NLS-1$
+ } else {
+ // No valid combinations
+ return null;
+ }
+ }
return new StandardBuildConfiguration(config, name);
}

Back to the top