epj2make, ide: makefile generation, global settings dialog: add CXXFLAGS to compiler...
authorRejean Loyer <redj@ecere.com>
Mon, 25 Jul 2016 03:48:19 +0000 (23:48 -0400)
committerJerome St-Louis <jerome@ecere.com>
Thu, 28 Jul 2016 22:23:36 +0000 (18:23 -0400)
ide/src/IDESettings.ec
ide/src/dialogs/GlobalSettingsDialog.ec
ide/src/project/Project.ec
ide/src/project/ProjectNode.ec

index d5afbaf..af82e81 100644 (file)
@@ -1393,6 +1393,20 @@ public:
       get { return compilerFlags; }
       isset { return compilerFlags.count != 0; }
    }
+   property Array<String> cxxFlags
+   {
+      set
+      {
+         cxxFlags.Free();
+         if(value)
+         {
+            delete cxxFlags;
+            cxxFlags = value;
+         }
+      }
+      get { return cxxFlags; }
+      isset { return cxxFlags.count != 0; }
+   }
    property Array<String> linkerFlags
    {
       set
@@ -1431,6 +1445,7 @@ private:
    Array<String> excludeLibs { };
    Array<String> eCcompilerFlags { };
    Array<String> compilerFlags { };
+   Array<String> cxxFlags { };
    Array<String> linkerFlags { };
    char * name;
    char * makeCommand;
@@ -1481,6 +1496,7 @@ private:
       if(prepDirectives) { prepDirectives.Free(); }
       if(excludeLibs) { excludeLibs.Free(); }
       if(compilerFlags) { compilerFlags.Free(); }
+      if(cxxFlags) { cxxFlags.Free(); }
       if(eCcompilerFlags) { eCcompilerFlags.Free(); }
       if(linkerFlags) { linkerFlags.Free(); }
    }
@@ -1514,6 +1530,7 @@ private:
          !(result = environmentVars.OnCompare(b.environmentVars)) &&
          !(result = prepDirectives.OnCompare(b.prepDirectives)) &&
          !(result = excludeLibs.OnCompare(b.excludeLibs)) &&
+         !(result = cxxFlags.OnCompare(b.cxxFlags)) &&
          !(result = eCcompilerFlags.OnCompare(b.eCcompilerFlags)) &&
          !(result = compilerFlags.OnCompare(b.compilerFlags)) &&
          !(result = linkerFlags.OnCompare(b.linkerFlags)))
@@ -1560,6 +1577,7 @@ public:
       for(s : prepDirectives) copy.prepDirectives.Add(CopyString(s));
       for(s : excludeLibs) copy.excludeLibs.Add(CopyString(s));
       for(s : compilerFlags) copy.compilerFlags.Add(CopyString(s));
+      for(s : cxxFlags) copy.cxxFlags.Add(CopyString(s));
       for(s : eCcompilerFlags) copy.eCcompilerFlags.Add(CopyString(s));
       for(s : linkerFlags) copy.linkerFlags.Add(CopyString(s));
 
index ff8f1b8..921fddc 100644 (file)
@@ -998,7 +998,7 @@ class CompilerOptionsTab : CompilersSubTab
 
    Button distccEnabled
    {
-      this, text = $"Use distcc", hotKey = altD, position = { 158, 68 };
+      this, text = $"Use distcc", position = { 158, 68 };
       isCheckbox = true;
 
       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
@@ -1006,7 +1006,7 @@ class CompilerOptionsTab : CompilersSubTab
          CompilerConfig compiler = loadedCompiler;
          if(compiler)
          {
-            distccHosts.disabled = !button.checked;
+            distccHostsLabel.disabled = distccHosts.disabled = !button.checked;
             compiler.distccEnabled = button.checked;
             modifiedDocument = true;
             compilersTab.modifiedDocument = true;
@@ -1015,11 +1015,11 @@ class CompilerOptionsTab : CompilersSubTab
       }
    };
 
-   Label distccHostsLabel { this, position = { 8, 96 }, labeledWindow = distccHosts };
+   Label distccHostsLabel { this, position = { 240, 68 }, labeledWindow = distccHosts };
    EditBox distccHosts
    {
       this, text = $"distcc hosts", hotKey = altH;
-      position = { 88, 92 }, size = { 300, 22 };
+      position = { 320, 64 }, size = { 160, 22 };
 
       bool NotifyModified(EditBox editBox)
       {
@@ -1034,11 +1034,11 @@ class CompilerOptionsTab : CompilersSubTab
       }
    };
 
-   Label lblPrepDefs { this, position = { 8, 126 }, labeledWindow = prepDefs };
+   Label lblPrepDefs { this, position = { 8, 96 }, labeledWindow = prepDefs };
    StringListBox prepDefs
    {
       this, text = $"Preprocessor directives", hotKey = altP;
-      position = { 168, 124 }, size = { 280, 22 }, anchor = { left = 168, top = 124, right = 8 };
+      position = { 168, 94 }, size = { 280, 22 }, anchor = { left = 168, top = 94, right = 8 };
 
       bool NotifyModified(EditBox editBox)
       {
@@ -1053,11 +1053,11 @@ class CompilerOptionsTab : CompilersSubTab
       }
    };
 
-   Label leCcompilerFlags { this, position = { 8, 156 }, labeledWindow = eCcompilerFlags };
+   Label leCcompilerFlags { this, position = { 8, 126 }, labeledWindow = eCcompilerFlags };
    StringListBox eCcompilerFlags
    {
       this, text = $"Additional eC compiler flags", hotKey = altG;
-      position = { 168, 154 }, size = { 280, 22 }, anchor = { left = 168, top = 154, right = 8 };
+      position = { 168, 124 }, size = { 280, 22 }, anchor = { left = 168, top = 124, right = 8 };
 
       bool NotifyModified(EditBox editBox)
       {
@@ -1072,11 +1072,11 @@ class CompilerOptionsTab : CompilersSubTab
       }
    };
 
-   Label lblCompilerFlags { this, position = { 8, 186 }, labeledWindow = compilerFlags };
+   Label lblCompilerFlags { this, position = { 8, 156 }, labeledWindow = compilerFlags };
    StringListBox compilerFlags
    {
-      this, text = $"Additional compiler flags", hotKey = altR;
-      position = { 168, 184 }, size = { 280, 22 }, anchor = { left = 168, top = 184, right = 8 };
+      this, text = $"Additional compiler flags", hotKey = altR;
+      position = { 168, 154 }, size = { 280, 22 }, anchor = { left = 168, top = 154, right = 8 };
 
       bool NotifyModified(EditBox editBox)
       {
@@ -1091,6 +1091,25 @@ class CompilerOptionsTab : CompilersSubTab
       }
    };
 
+   Label lblcxxFlags { this, position = { 8, 186 }, labeledWindow = cxxFlags };
+   StringListBox cxxFlags
+   {
+      this, text = $"Additional C++ compiler flags", hotKey = altD;
+      position = { 168, 184 }, size = { 280, 22 }, anchor = { left = 168, top = 184, right = 8 };
+
+      bool NotifyModified(EditBox editBox)
+      {
+         if(loadedCompiler)
+         {
+            CompilerConfig compiler = loadedCompiler;
+            compiler.cxxFlags = ((StringListBox)editBox).strings;
+            modifiedDocument = true;
+            compilersTab.modifiedDocument = true;
+         }
+         return true;
+      }
+   };
+
    Label lblLinkerFlags { this, position = { 8, 216 }, labeledWindow = linkerFlags };
    StringListBox linkerFlags
    {
@@ -1208,12 +1227,13 @@ class CompilerOptionsTab : CompilersSubTab
          numJobsBox.Refresh();
          ccacheEnabled.checked = compiler.ccacheEnabled;
          distccEnabled.checked = compiler.distccEnabled;
-         distccHosts.disabled = !compiler.distccEnabled;
+         distccHostsLabel.disabled = distccHosts.disabled = !compiler.distccEnabled;
          distccHosts.contents = compiler.distccHosts;
          prepDefs.strings = compiler.prepDirectives;
          excludedLibraries.strings = compiler.excludeLibs;
          eCcompilerFlags.strings = compiler.eCcompilerFlags;
          compilerFlags.strings = compiler.compilerFlags;
+         cxxFlags.strings = compiler.cxxFlags;
          linkerFlags.strings = compiler.linkerFlags;
          objectFileExt.contents = compiler.objectFileExt;
          outputFileExt.contents = compiler.outputFileExt;
index c7b4151..95c1107 100644 (file)
@@ -2651,6 +2651,12 @@ private:
                OutputFlags(f, any, compiler.compilerFlags, inPlace);
                f.Puts("\n");
             }
+            if(compiler.cxxFlags && compiler.cxxFlags.count)
+            {
+               f.Puts("\nCXXFLAGS +=");
+               OutputFlags(f, any, compiler.cxxFlags, inPlace);
+               f.Puts("\n");
+            }
             if(compiler.linkerFlags && compiler.linkerFlags.count)
             {
                f.Puts("\nLDFLAGS +=");
index a8f5b37..d6c478d 100644 (file)
@@ -2090,15 +2090,14 @@ private:
                      moduleName, collision ? "." : "", collision ? extension : "",
                      modulePath, moduleName, extension);
             if(!strcmpi(extension, "cc") || !strcmpi(extension, "cpp") || !strcmpi(extension, "cxx"))
-               f.Printf("\t$(CXX)");
+               f.Printf("\t$(CXX) $(CXXFLAGS)");
             else if(!strcmpi(extension, "rc"))
                f.Printf("\t$(WINDRES) $(WINDRES_FLAGS) $< \"$(call escspace,$(call quote_path,$@))\"\n");
             else
-               f.Printf("\t$(CC)");
+               f.Printf("\t$(CC) $(CFLAGS)");
 
             if(strcmpi(extension, "rc") != 0)
             {
-               f.Puts(" $(CFLAGS)");
                GenMakePrintNodeFlagsVariable(this, nodeCFlagsMapping, "PRJ_CFLAGS", f);
 
                if(!strcmpi(extension, "ec"))