slight change to the diff the first one was a bit messy.
--- compilerMINGW.cpp.orig 2011-08-05 20:58:41 +0000
+++ compilerMINGW.cpp 2011-08-06 06:23:08 +0000
@@ -25,7 +25,7 @@
#include <configmanager.h>
#ifdef __WXMSW__
- #include <wx/msw/registry.h>
+#include <wx/msw/registry.h>
#endif
CompilerMINGW::CompilerMINGW(const wxString& name, const wxString& ID)
@@ -55,13 +55,27 @@
{
if (platform::windows)
{
- m_Programs.C = _T("mingw32-gcc.exe");
- m_Programs.CPP = _T("mingw32-g++.exe");
- m_Programs.LD = _T("mingw32-g++.exe");
- m_Programs.DBG = _T("gdb.exe");
- m_Programs.LIB = _T("ar.exe");
- m_Programs.WINDRES = _T("windres.exe");
- m_Programs.MAKE = _T("mingw32-make.exe");
+ // need an idea to also reset the standard mingw compiler ?
+ if (wxIsPlatform64Bit())
+ {
+ m_Programs.C = _T("x86_64-w64-mingw32-gcc.exe");
+ m_Programs.CPP = _T("x86_64-w64-mingw32-g++.exe");
+ m_Programs.LD = _T("x86_64-w64-mingw32-g++.exe");
+ m_Programs.DBG = _T("gdb.exe");
+ m_Programs.LIB = _T("ar.exe");
+ m_Programs.WINDRES = _T("windres.exe");
+ m_Programs.MAKE = _T("winmake.exe");
+ }
+ else
+ {
+ m_Programs.C = _T("i686-w64-mingw32-gcc.exe");
+ m_Programs.CPP = _T("i686-w64-mingw32-g++.exe");
+ m_Programs.LD = _T("i686-w64-mingw32-g++.exe");
+ m_Programs.DBG = _T("gdb.exe");
+ m_Programs.LIB = _T("ar.exe");
+ m_Programs.WINDRES = _T("windres.exe");
+ m_Programs.MAKE = _T("winmake.exe");
+ }
}
else
{
@@ -96,12 +110,12 @@
m_Options.ClearOptions();
m_Options.AddOption(_("Produce debugging symbols"),
- _T("-g"),
- _("Debugging"),
- _T(""),
- true,
- _T("-O -O1 -O2 -O3 -Os"),
- _("You have optimizations enabled. This is Not A Good Thing(tm) when producing debugging symbols..."));
+ _T("-g"),
+ _("Debugging"),
+ _T(""),
+ true,
+ _T("-O -O1 -O2 -O3 -Os"),
+ _("You have optimizations enabled. This is Not A Good Thing(tm) when producing debugging symbols..."));
wxString gprof_link = _T("-pg");
if (platform::windows)
gprof_link = _T("-pg -lgmon");
@@ -144,6 +158,7 @@
m_Options.AddOption(_("Optimize generated code (for size)"), _T("-Os"), category);
m_Options.AddOption(_("Expensive optimizations"), _T("-fexpensive-optimizations"), category);
m_Options.AddOption(_("Don't keep the frame pointer in a register for functions that don't need one"), _T("-fomit-frame-pointer"), category);
+
// machine dependent options - cpu arch
category = _("CPU architecture tuning (choose none, or only one of these)");
m_Options.AddOption(_("i386"), _T("-march=i386"), category);
@@ -175,6 +190,7 @@
m_Commands[(int)ctGenDependenciesCmd].push_back(CompilerTool(_T("$compiler -MM $options -MF $dep_object -MT $object $includes $file")));
m_Commands[(int)ctCompileResourceCmd].push_back(CompilerTool(_T("$rescomp -i $file -J rc -o $resource_output -O coff $res_includes")));
m_Commands[(int)ctLinkConsoleExeCmd].push_back(CompilerTool(_T("$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs")));
+
if (platform::windows)
{
m_Commands[(int)ctLinkNativeCmd].push_back(CompilerTool(_T("$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs --subsystem,native")));
@@ -249,15 +265,25 @@
}
}
}
-
wxString sep = wxFileName::GetPathSeparator();
+
if (platform::windows)
{
// look first if MinGW was installed with Code::Blocks (new in beta6)
m_MasterPath = ConfigManager::GetExecutableFolder();
if (!wxFileExists(m_MasterPath + sep + _T("bin") + sep + m_Programs.C))
+ {
// if that didn't do it, look under C::B\MinGW, too (new in 08.02)
m_MasterPath += sep + _T("MinGW");
+ }
+
+ if (!wxFileExists(m_MasterPath + sep + _T("bin") + sep + m_Programs.C))
+ {
+ // if that didn't do it, look under C::B\MinGW32 or C::B\MinGW64, too (new in 08.02)
+ m_MasterPath += wxIsPlatform64Bit() ? sep + _T("MinGW64") : sep + _T("MinGW32");
+ }
+
+ // standard mingw no 64 bit compiler and the mingw64 compiler has no ini.
if (!wxFileExists(m_MasterPath + sep + _T("bin") + sep + m_Programs.C))
{
// no... search for MinGW installation dir
@@ -300,16 +326,15 @@
#endif
}
}
- else
- m_Programs.MAKE = _T("make.exe"); // we distribute "make" not "mingw32-make"
+ else m_Programs.MAKE = _T("make.exe"); // we distribute "make" not "mingw32-make"
}
- else
- m_MasterPath = _T("/usr");
+ else m_MasterPath = _T("/usr");
AutoDetectResult ret = wxFileExists(m_MasterPath + sep + _T("bin") + sep + m_Programs.C) ? adrDetected : adrGuessed;
// don't add lib/include dirs. GCC knows where its files are located
SetVersionString();
+
return ret;
}
@@ -317,7 +342,7 @@
{
/* NOTE (Biplab#9#): There is a critical bug which blocks C::B from starting up.
So we'll disable version string checking till we fix the bug. */
- #if !wxCHECK_VERSION(2, 9, 0)
+#if !wxCHECK_VERSION(2, 9, 0)
// Manager::Get()->GetLogManager()->DebugLog(_T("Compiler detection for compiler ID: '") + GetID() + _T("' (parent ID= '") + GetParentID() + _T("')"));
wxArrayString output, errors;
@@ -394,5 +419,5 @@
}
}
}
- #endif
+#endif
}
wxIsPlatform64Bit() should actually work but my C++ fu is a bit impaired so i likely made some mistake. im normally used to working in old C mode.
still need to find a solution to reset the standard MinGW compiler's executables with the new autodetect code. atm it will only work for the mingw64 compiler. it should be as easy as checking for a certain #define only present in mingw64 but i forgot its name so i need to find it again.