Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2016-05-17 16:16:22 +0000
committerGerrit Code Review @ Eclipse.org2016-05-17 20:18:50 +0000
commit758110471e5884e84ac0bd97236da64f9f19fd04 (patch)
tree0aa38342941abfa2a9994579d6e098374ce2ed21 /build/org.eclipse.cdt.build.gcc.core
parent854f036c61520839a28e156973d4dad17bc81900 (diff)
downloadorg.eclipse.cdt-758110471e5884e84ac0bd97236da64f9f19fd04.tar.gz
org.eclipse.cdt-758110471e5884e84ac0bd97236da64f9f19fd04.tar.xz
org.eclipse.cdt-758110471e5884e84ac0bd97236da64f9f19fd04.zip
Add MSYS2 32-bit support to MinGW GCC toolchain.
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/internal/Msys2ToolChainProvider.java53
1 files changed, 46 insertions, 7 deletions
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 ae5b1b74010..aa22cd01409 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
@@ -31,19 +31,58 @@ public class Msys2ToolChainProvider implements IToolChainProvider {
WindowsRegistry registry = WindowsRegistry.getRegistry();
String uninstallKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"; //$NON-NLS-1$
String subkey;
+ boolean on64bit = Platform.getOSArch().equals(Platform.ARCH_X86_64);
+ String key32bit = null;
for (int i = 0; (subkey = registry.getCurrentUserKeyName(uninstallKey, i)) != null; i++) {
String compKey = uninstallKey + '\\' + subkey;
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 msysPath = Paths.get(installLocation);
- Path gccPath = msysPath.resolve("mingw64\\bin\\gcc.exe"); //$NON-NLS-1$
- if (Files.exists(gccPath)) {
- 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$
+ if (on64bit) {
+ if ("MSYS2 64bit".equals(displayName)) { //$NON-NLS-1$
+ if (addToolChain64(manager, registry, compKey)) {
+ key32bit = null;
+ break;
+ }
+ } else if ("MSYS2 32bit".equals(displayName)) { //$NON-NLS-1$
+ key32bit = compKey;
+ }
+ } else {
+ if ("MSYS2 32bit".equals(displayName)) { //$NON-NLS-1$
+ if (addToolChain32(manager, registry, compKey)) {
+ break;
+ }
}
}
}
+
+ if (on64bit && key32bit != null) {
+ addToolChain64(manager, registry, key32bit);
+ }
+ }
+ }
+
+ private boolean addToolChain64(IToolChainManager manager, WindowsRegistry registry, String key) {
+ String installLocation = registry.getCurrentUserValue(key, "InstallLocation"); //$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, "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$
+ return true;
+ } else {
+ return addToolChain32(manager, registry, key);
+ }
+ }
+
+ private boolean addToolChain32(IToolChainManager manager, WindowsRegistry registry, String key) {
+ String installLocation = registry.getCurrentUserValue(key, "InstallLocation"); //$NON-NLS-1$
+ Path msysPath = Paths.get(installLocation);
+ Path gccPath = msysPath.resolve("mingw32\\bin\\gcc.exe"); //$NON-NLS-1$
+ if (Files.exists(gccPath)) {
+ manager.addToolChain(new GCCToolChain(this, "i686-w64-mingw32", "msys2.i686", new Path[] { //$NON-NLS-1$ //$NON-NLS-2$
+ gccPath.getParent(), msysPath.resolve("bin"), msysPath.resolve("usr\\bin") })); //$NON-NLS-1$ //$NON-NLS-2$
+ return true;
+ } else {
+ return false;
}
}

Back to the top