Patch #956 2006-03-26 00:27

aartipl

Turned on DMD and GDC support under Linux
Download
956-Turned_on_DMD_a.patch (6.5 KB)
Category
Plugin::FeatureAdd
Status
Accepted
Close date
2006-11-26 23:39
Assigned to
afb
Index: src/plugins/compilergcc/compilerDMD.h
===================================================================
--- src/plugins/compilergcc/compilerDMD.h    (wersja 2259)
+++ src/plugins/compilergcc/compilerDMD.h    (kopia robocza)
@@ -1,6 +1,3 @@
-#ifdef __WXMSW__
-// this compiler is valid only in windows
-
 #ifndef COMPILERDMD_H
 #define COMPILERDMD_H
 
@@ -19,6 +16,4 @@
     private:
 };
 
-#endif // COMPILERDMC_H
-
-#endif // __WXMSW__
+#endif // COMPILERDMD_H
Index: src/plugins/compilergcc/compilerDMD.cpp
===================================================================
--- src/plugins/compilergcc/compilerDMD.cpp    (wersja 2259)
+++ src/plugins/compilergcc/compilerDMD.cpp    (kopia robocza)
@@ -1,6 +1,3 @@
-#ifdef __WXMSW__
-// this compiler is valid only in windows
-
 #include <sdk.h>
 #include "compilerDMD.h"
 #include <wx/log.h>
@@ -30,10 +27,12 @@
 
 void CompilerDMD::Reset()
 {
+    #ifdef __WXMSW__
     m_Programs.C = _T("dmd.exe");
     m_Programs.CPP = _T("dmd.exe");
     m_Programs.LD = _T("dmd.exe");
     m_Programs.LIB = _T("lib.exe");
+    m_Programs.DBG = _T("gdb.exe");
     m_Programs.WINDRES = _T("dmd.exe");
     m_Programs.MAKE = _T("make.exe");
 
@@ -53,6 +52,45 @@
     m_Switches.linkerNeedsLibPrefix = false;
     m_Switches.linkerNeedsLibExtension = true;
 
+    // FIXME (hd#1#): should be work on: we need $res_options
+    m_Commands[(int)ctCompileResourceCmd] = _T("$rescomp $resource_output $res_includes $file");
+    m_Commands[(int)ctLinkExeCmd] = _T("$linker $exe_output $link_options $link_objects $libs");
+    m_Commands[(int)ctLinkConsoleExeCmd] = _T("$linker $exe_output $link_options $link_objects $libs");
+    
+    #else
+    m_Programs.C = _T("dmd");
+    m_Programs.CPP = _T("dmd");
+    m_Programs.LD = _T("gcc");
+    m_Programs.LIB = _T("ar");
+    m_Programs.DBG = _T("gdb");
+    m_Programs.WINDRES = _T("");
+    m_Programs.MAKE = _T("make");
+
+    m_Switches.includeDirs = _T("-I");
+    m_Switches.libDirs = _T("-L");
+    m_Switches.linkLibs = _T("-l");
+    m_Switches.libPrefix = _T("lib");
+    m_Switches.libExtension = _T("a");
+    m_Switches.defines = _T("");
+    m_Switches.genericSwitch = _T("-");
+    m_Switches.objectExtension = _T("o");
+    m_Switches.needDependencies = false;
+    m_Switches.forceCompilerUseQuotes = false;
+    m_Switches.forceLinkerUseQuotes = false;
+    m_Switches.logging = clogSimple;
+    m_Switches.buildMethod = cbmDirect;
+    m_Switches.linkerNeedsLibPrefix = false;
+    m_Switches.linkerNeedsLibExtension = false;
+
+     m_Commands[(int)ctCompileResourceCmd] = _T("");
+    m_Commands[(int)ctLinkExeCmd] = _T("$linker -o $exe_output $link_options $link_objects $libs");
+    m_Commands[(int)ctLinkConsoleExeCmd] = _T("$linker -o $exe_output $link_options $link_objects $libs");
+    #endif
+
+    m_Commands[(int)ctCompileObjectCmd] = _T("$compiler $options $includes -c $file -of$object");
+    m_Commands[(int)ctLinkDynamicCmd] = _T("$linker $exe_output $link_options $link_objects $libs $link_resobjects");
+    m_Commands[(int)ctLinkStaticCmd] = _T("$lib_linker $static_output $link_options $link_objects");    
+
     m_Options.ClearOptions();
 
     //. m_Options.AddOption(_("Alignment of struct members"), "-a[1|2|4|8]", _("Architecture"));
@@ -73,19 +111,13 @@
     m_Options.AddOption(_("verbose"), _T("-v"), _("Others"));
     m_Options.AddOption(_("enable warnings"), _T("-w"), _("Others"));
 
-    // FIXME (hd#1#): should be work on: we need $res_options
-    m_Commands[(int)ctCompileObjectCmd] = _T("$compiler $options $includes -c $file -of$object");
-    m_Commands[(int)ctCompileResourceCmd] = _T("$rescomp $resource_output $res_includes $file");
-    m_Commands[(int)ctLinkExeCmd] = _T("$linker $exe_output $link_options $link_objects $libs");
-    m_Commands[(int)ctLinkConsoleExeCmd] = _T("$linker $exe_output $link_options $link_objects $libs");
-    m_Commands[(int)ctLinkDynamicCmd] = _T("$linker $exe_output $link_options $link_objects $libs $link_resobjects");
-    m_Commands[(int)ctLinkStaticCmd] = _T("$lib_linker $static_output $link_options $link_objects");
-
     LoadDefaultRegExArray();
 
     m_CompilerOptions.Clear();
     m_LinkerOptions.Clear();
     m_LinkLibs.Clear();
+    m_LinkLibs.Add(_("-lpthread"));
+    m_LinkLibs.Add(_("-lm"));
     m_CmdsBefore.Clear();
     m_CmdsAfter.Clear();
 }
@@ -101,20 +133,30 @@
 
 AutoDetectResult CompilerDMD::AutoDetectInstallationDir()
 {
+    wxString sep = wxFileName::GetPathSeparator();
+
+    // NOTE (hd#1#): dmc uses sc.ini for compiler's master directories
+    // NOTE (mandrav#1#): which doesn't seem to exist if you don't have the CD version ;)
+
     // just a guess; the default installation dir
+    #ifdef __WXMSW__
     m_MasterPath = _T("C:\\dmd");
-    wxString sep = wxFileName::GetPathSeparator();
+    wxString incPath=m_MasterPath + sep + _T("src") + sep + _T("phobos");
+    wxString libPath=m_MasterPath + sep + _T("lib");
+    wxString libName=_T("phobos.lib");
+
download for full patch...
afb 2006-11-26 16:53

This patch doesn't work for me, C::B still tries to use "ld" for linking programs (for instance), and will fail on the "-lphobos" option to it ?

It also needs a slight revision to only add DMD for Win32 and Linux,

and not every platform. GDC support, however, will be added to all.

afb 2006-11-26 23:39

Added it as rev3278, so that we can start looking at this "LD" issue.

As far as I can tell it *should* be using the DMD compiler .LD (=gcc) ?