Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2016-05-12 17:50:23 +0000
committerGerrit Code Review @ Eclipse.org2016-05-12 19:32:51 +0000
commit0d7ee343e017f753a6bb8e2d3165d6b8fb2e9e9e (patch)
tree7752ffc3ff385d0f3b8a19ae1c34d0fbaec2b16a /build/org.eclipse.cdt.build.gcc.core
parente091657eafa69252ce0777b83d6ef7560dacfd3b (diff)
downloadorg.eclipse.cdt-0d7ee343e017f753a6bb8e2d3165d6b8fb2e9e9e.tar.gz
org.eclipse.cdt-0d7ee343e017f753a6bb8e2d3165d6b8fb2e9e9e.tar.xz
org.eclipse.cdt-0d7ee343e017f753a6bb8e2d3165d6b8fb2e9e9e.zip
Add MSYS2 support for managed build. A few Qt cleanups on Windows.
Diffstat (limited to 'build/org.eclipse.cdt.build.gcc.core')
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java33
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/GCCPathToolChainProvider.java4
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Msys2ToolChainProvider.java6
3 files changed, 30 insertions, 13 deletions
diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
index 460f9508ea1..710a8c952e0 100644
--- a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
+++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
@@ -41,8 +41,9 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.PlatformObject;
/**
- * The GCC toolchain. This is the base class for all GCC toolchains. It represents GCC as found on
- * the user's PATH. It can be overriden to change environment variable settings.
+ * The GCC toolchain. This is the base class for all GCC toolchains. It
+ * represents GCC as found on the user's PATH. It can be overriden to change
+ * environment variable settings.
*/
public class GCCToolChain extends PlatformObject implements IToolChain {
@@ -50,7 +51,7 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
private final String id;
private final String version;
private final String name;
- private final Path path;
+ private final Path[] path;
private final String prefix;
private final IEnvironmentVariable pathVar;
private final IEnvironmentVariable[] envVars;
@@ -61,11 +62,11 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
this(provider, id, version, null, null);
}
- public GCCToolChain(IToolChainProvider provider, String id, String version, Path path) {
+ public GCCToolChain(IToolChainProvider provider, String id, String version, Path[] path) {
this(provider, id, version, path, null);
}
- public GCCToolChain(IToolChainProvider provider, String id, String version, Path path, String prefix) {
+ public GCCToolChain(IToolChainProvider provider, String id, String version, Path[] path, String prefix) {
this.provider = provider;
this.id = id;
this.version = version;
@@ -74,7 +75,14 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
this.prefix = prefix;
if (path != null) {
- pathVar = new EnvironmentVariable("PATH", path.toString(), IEnvironmentVariable.ENVVAR_PREPEND, //$NON-NLS-1$
+ StringBuilder pathString = new StringBuilder();
+ for (int i = 0; i < path.length; ++i) {
+ pathString.append(path[i].toString());
+ if (i < path.length - 1) {
+ pathString.append(File.pathSeparator);
+ }
+ }
+ pathVar = new EnvironmentVariable("PATH", pathString.toString(), IEnvironmentVariable.ENVVAR_PREPEND, //$NON-NLS-1$
File.pathSeparator);
envVars = new IEnvironmentVariable[] { pathVar };
} else {
@@ -92,12 +100,12 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
public String getId() {
return id;
}
-
+
@Override
public String getVersion() {
return version;
}
-
+
@Override
public String getName() {
return name;
@@ -114,7 +122,7 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
}
return null;
}
-
+
@Override
public String getBinaryParserId() {
// Assume local builds
@@ -282,7 +290,12 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
}
if (path != null) {
- return path.resolve(command);
+ for (Path p : path) {
+ Path c = p.resolve(command);
+ if (Files.isExecutable(c)) {
+ return c;
+ }
+ }
}
// Look for it in the path environment var
diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/GCCPathToolChainProvider.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/GCCPathToolChainProvider.java
index f9967defeb3..28905b02c97 100644
--- a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/GCCPathToolChainProvider.java
+++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/GCCPathToolChainProvider.java
@@ -11,6 +11,7 @@ import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.nio.file.Path;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
@@ -73,7 +74,8 @@ public class GCCPathToolChainProvider implements IToolChainProvider {
String name = target + " - " + version; //$NON-NLS-1$
if (!names.contains(name)) {
names.add(name);
- manager.addToolChain(new GCCToolChain(this, target, version, dir.toPath(), prefix));
+ manager.addToolChain(new GCCToolChain(this, target, version,
+ new Path[] { dir.toPath() }, prefix));
}
}
} catch (IOException e) {
diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Msys2ToolChainProvider.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Msys2ToolChainProvider.java
index 64dec9b9496..ae5b1b74010 100644
--- a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Msys2ToolChainProvider.java
+++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Msys2ToolChainProvider.java
@@ -36,9 +36,11 @@ public class Msys2ToolChainProvider implements IToolChainProvider {
String displayName = registry.getCurrentUserValue(compKey, "DisplayName"); //$NON-NLS-1$
if ("MSYS2 64bit".equals(displayName)) { //$NON-NLS-1$
String installLocation = registry.getCurrentUserValue(compKey, "InstallLocation"); //$NON-NLS-1$
- Path gccPath = Paths.get(installLocation + "\\mingw64\\bin\\gcc.exe"); //$NON-NLS-1$
+ Path msysPath = Paths.get(installLocation);
+ Path gccPath = msysPath.resolve("mingw64\\bin\\gcc.exe"); //$NON-NLS-1$
if (Files.exists(gccPath)) {
- manager.addToolChain(new GCCToolChain(this, "msys2.x86_64", "", gccPath.getParent())); //$NON-NLS-1$ //$NON-NLS-2$
+ manager.addToolChain(new GCCToolChain(this, "x86_64-w64-mingw32", "msys2.x86_64", new Path[] { //$NON-NLS-1$ //$NON-NLS-2$
+ gccPath.getParent(), msysPath.resolve("bin"), msysPath.resolve("usr\\bin") })); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}

Back to the top