ide/debugger; crossplatform.mk: (#1016) Ensure we can build out of the box as 32...
authorJerome St-Louis <jerome@ecere.com>
Thu, 6 Mar 2014 13:28:54 +0000 (08:28 -0500)
committerJerome St-Louis <jerome@ecere.com>
Thu, 6 Mar 2014 13:28:54 +0000 (08:28 -0500)
- Detecting 32 bit system Windows systems and auto-setting -m32 (Currently checking for ProgramFiles(x86) env var)
- Built output will be in e.g. release.win32, not release.win32.x32 as ARCH is set after ARCH_SUFFIX
- GDB executable used on Windows has been updated to match executables supplied with the installer:
   'i686-w64-mingw32-gdb' for the 32 bit version, 'gdb' for the 64 bit version

crossplatform.mk
ide/src/debugger/Debugger.ec

index 28d725b..1de7312 100644 (file)
@@ -135,6 +135,20 @@ ifdef ARCH
 
 endif
 
+# On Windows/32 bit systems, pass -m32 as TDM-GCC packaged with the installer produces 64 bit executables by default
+# Disable this if your compiler does not accept -m32
+ifndef ARCH
+ ifeq "$(HOST_PLATFORM)" "win32"
+  ifeq "$(TARGET_PLATFORM)" "win32"
+   ifndef ProgramFiles(x86)
+    ARCH := x32
+    TARGET_ARCH := i386
+    ARCH_FLAGS := -m32
+   endif
+  endif
+ endif
+endif
+
 # DEBUG SUFFIX
 ifdef DEBUG
 DEBUG_SUFFIX := .debug
index 4aca57e..d8ee334 100644 (file)
@@ -2414,10 +2414,17 @@ class Debugger
 
       if(result)
       {
-         strcpy(command,
-            (compiler.targetPlatform == win32 && bitDepth == 64) ? "x86_64-w64-mingw32-gdb" :
-            (compiler.targetPlatform == win32 && bitDepth == 32) ? "i686-w64-mingw32-gdb" :
-            "gdb");
+         if(compiler.targetPlatform == win32)
+         {
+            strcpy(command,
+#if !((defined(__WORDSIZE) && __WORDSIZE == 8) || defined(__x86_64__))
+               1 ||
+#endif
+               bitDepth == 32 ? "i686-w64-mingw32-gdb" : "gdb");  // x86_64-w64-mingw32-gdb
+         }
+         else
+            // We really should have a box to select GDB in the compiler/toolchain options
+            strcpy(command, "gdb");
          if(!CheckCommandAvailable(command))
          {
             ide.outputView.debugBox.Logf($"Debugger Fatal Error: Command %s for GDB is not available.\n", command);