ide: generate a single makefile, no more compiler specific makefile. added compiler...
authorRejean Loyer <rejean.loyer@gmail.com>
Tue, 17 Apr 2012 16:39:13 +0000 (12:39 -0400)
committerRejean Loyer <rejean.loyer@gmail.com>
Tue, 17 Apr 2012 18:00:31 +0000 (14:00 -0400)
ide/src/IDESettings.ec
ide/src/dialogs/GlobalSettingsDialog.ec
ide/src/project/Project.ec
ide/src/project/ProjectView.ec

index b12158c..2ce71ff 100644 (file)
@@ -274,6 +274,8 @@ private:
          defaultCompiler = MakeDefaultCompiler(defaultCompilerName, true);
          data.compilerConfigs.Add(defaultCompiler);
       }
+      if(!data.compilerConfigsDir || !data.compilerConfigsDir[0])
+         data.property::compilerConfigsDir = "configs";
 
       // We incref the compilers below, so reset refCount to 0
       defaultCompiler._refCount = 0;
@@ -353,11 +355,11 @@ public:
       isset { return projectDefaultIntermediateObjDir && projectDefaultIntermediateObjDir[0]; }
    }
 
-   property char * portableLocation
+   property char * compilerConfigsDir
    {
-      set { delete portableLocation; if(value && value[0]) portableLocation = CopyString(value); }
-      get { return portableLocation ? portableLocation : ""; }
-      isset { return portableLocation && portableLocation[0]; }
+      set { delete compilerConfigsDir; if(value && value[0]) compilerConfigsDir = CopyString(value); }
+      get { return compilerConfigsDir ? compilerConfigsDir : ""; }
+      isset { return compilerConfigsDir && compilerConfigsDir[0]; }
    }
 
    property char * defaultCompiler
@@ -373,7 +375,7 @@ private:
    char * ideProjectFileDialogLocation;
    char * projectDefaultTargetDir;
    char * projectDefaultIntermediateObjDir;
-   char * portableLocation;
+   char * compilerConfigsDir;
    char * defaultCompiler;
 
    CompilerConfig GetCompilerConfig(String compilerName)
@@ -407,7 +409,7 @@ private:
    
       delete projectDefaultTargetDir;
       delete projectDefaultIntermediateObjDir;
-      delete portableLocation;
+      delete compilerConfigsDir;
       delete defaultCompiler;
 
       delete ideFileDialogLocation;
@@ -483,8 +485,8 @@ private:
       if(projectDefaultIntermediateObjDir && projectDefaultIntermediateObjDir[0])
          ChangeCh(projectDefaultIntermediateObjDir, from, to);
 
-      if(portableLocation && portableLocation[0])
-         ChangeCh(portableLocation, from, to);
+      if(compilerConfigsDir && compilerConfigsDir[0])
+         ChangeCh(compilerConfigsDir, from, to);
    }
 
    void ManagePortablePaths(char * location, bool makeAbsolute)
@@ -539,6 +541,9 @@ private:
          projectDefaultTargetDir = UpdatePortablePath(projectDefaultTargetDir, location, makeAbsolute);
       if(projectDefaultIntermediateObjDir && projectDefaultIntermediateObjDir[0])
          projectDefaultIntermediateObjDir = UpdatePortablePath(projectDefaultIntermediateObjDir, location, makeAbsolute);
+
+      if(compilerConfigsDir && compilerConfigsDir[0])
+         compilerConfigsDir = UpdatePortablePath(compilerConfigsDir, location, makeAbsolute);
    }
 
    char * UpdatePortablePath(char * path, char * location, bool makeAbsolute)
index bfea45a..376bb78 100644 (file)
@@ -87,6 +87,8 @@ class GlobalSettingsDialog : Window
             
             if(compilersTab.modifiedDocument)
             {
+               if(strcmp(compilersTab.compilerConfigsDir.path, ideSettings.compilerConfigsDir))
+                  ideSettings.compilerConfigsDir = compilersTab.compilerConfigsDir.path;
                ideSettings.compilerConfigs.Free();
                for(compiler : compilersTab.compilerConfigs)
                   ideSettings.compilerConfigs.Add(compiler.Copy());
@@ -184,6 +186,7 @@ class GlobalSettingsDialog : Window
       
       for(compiler : ideSettings.compilerConfigs)
          compilersTab.AddCompiler(compiler.Copy(), compiler == activateCompiler);
+      compilersTab.compilerConfigsDir.path = ideSettings.compilerConfigsDir;
 
       // ProjectOptionsTab
       projectOptionsTab.defaultTargetDir.path = ideSettings.projectDefaultTargetDir;
@@ -258,9 +261,16 @@ class CompilersTab : GlobalSettingsSubTab
    background = formColor;
    text = $"Compilers";
 
+   Label compilerConfigsDirLabel { this, position = { 8, 12 }, labeledWindow = compilerConfigsDir, tabCycle = false, inactive = true };
+   PathBox compilerConfigsDir
+   {
+      this, anchor = { left = 210, top = 8, right = 8 };
+      text = $"Compiler Configurations Directory:", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
+   };
+
    SelectorBar compilerSelector
    {
-      this, text = $"Compiler Configurations:", anchor = { left = 148, top = 8, right = 99 }; size = { 0, 26 };
+      this, text = $"Compiler Configurations:", anchor = { left = 148, top = 38, right = 99 }; size = { 0, 26 };
       opacity = 0;
       direction = horizontal, scrollable = true;
 
@@ -298,7 +308,7 @@ class CompilersTab : GlobalSettingsSubTab
       }
    };
 
-   TabControl tabControl { this, background = formColor, anchor = { left = 8, top = 38, right = 8, bottom = 8 } };
+   TabControl tabControl { this, background = formColor, anchor = { left = 8, top = 68, right = 8, bottom = 8 } };
    
    CompilerDirectoriesTab dirsTab { this, tabControl = tabControl };
    CompilerToolchainTab toolchainTab { this, tabControl = tabControl };
@@ -310,7 +320,7 @@ class CompilersTab : GlobalSettingsSubTab
 
    Label labelCompilers
    {
-      this, anchor = { left = 8, top = 14 }, labeledWindow = compilerSelector;
+      this, anchor = { left = 8, top = 44 }, labeledWindow = compilerSelector;
 
       void OnRedraw(Surface surface)
       {
@@ -354,7 +364,7 @@ class CompilersTab : GlobalSettingsSubTab
    {
       parent = this, bevelOver = true, inactive = true;
       size = { 22, 22 };
-      anchor = { top = 10, right = 77 };
+      anchor = { top = 40, right = 77 };
       hotKey = altC, bitmap = BitmapResource { fileName = ":actions/docNew.png", alphaBlend = true };
 
       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
@@ -372,7 +382,7 @@ class CompilersTab : GlobalSettingsSubTab
    {
       parent = this, bevelOver = true, inactive = true;
       size = { 22, 22 };
-      anchor = { top = 10, right = 54 };
+      anchor = { top = 40, right = 54 };
       hotKey = altC, bitmap = BitmapResource { fileName = ":actions/attach.png", alphaBlend = true };
 
       bool NotifyClicked(Button b, int x, int y, Modifiers mods)
@@ -401,7 +411,7 @@ class CompilersTab : GlobalSettingsSubTab
    {
       parent = this, bevelOver = true, inactive = true;
       size = { 22, 22 };
-      anchor = { top = 10, right = 31 };
+      anchor = { top = 40, right = 31 };
       hotKey = altU, bitmap = BitmapResource { fileName = ":actions/editCopy.png", alphaBlend = true };
 
       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
@@ -420,7 +430,7 @@ class CompilersTab : GlobalSettingsSubTab
    {
       parent = this, bevelOver = true, inactive = true;
       size = { 22, 22 };
-      anchor = { top = 10, right = 8 };
+      anchor = { top = 40, right = 8 };
       hotKey = altD, bitmap = BitmapResource { fileName = ":actions/delete2.png", alphaBlend = true };
 
       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
@@ -521,6 +531,12 @@ class CompilersTab : GlobalSettingsSubTab
          LoadCompiler((CompilerConfig)clickedButton.id);
       return true;
    }
+
+   bool NotifyModifiedDocument(PathBox pathBox)
+   {
+      modifiedDocument = true;
+      return true;
+   }
 }
 
 Array<String> displayDirectoryNames
index 500e251..1c4d618 100644 (file)
@@ -30,12 +30,6 @@ private:
 extern int __ecereVMethodID_class_OnCompare;
 extern int __ecereVMethodID_class_OnFree;
 
-#ifdef __WIN32__
-define cfDir = "C:/temp/";
-#else
-define cfDir = "/home/redj/.ecereIDE/";
-#endif
-
 IDESettings ideSettings;
 
 IDESettingsContainer settingsContainer
@@ -1044,14 +1038,19 @@ private:
       }
    }
 
-   void CatMakeFileName(char * string, CompilerConfig compiler, ProjectConfig config)
+   void GetCompilerConfigsDir(char * cfDir)
+   {
+      strcpy(cfDir, topNode.path);
+      PathCatSlash(cfDir, ideSettings.compilerConfigsDir);
+      if(cfDir && cfDir[0] && cfDir[strlen(cfDir)-1] != '/')
+         strcat(cfDir, "/");
+   }
+
+   void CatMakeFileName(char * string, ProjectConfig config)
    {
       char projectName[MAX_LOCATION];
       strcpy(projectName, name);
-      if(strcmpi(compiler.name, defaultCompilerName))
-         sprintf(string, "%s-%s-%s.Makefile", projectName, compiler.name, config.name);
-      else
-         sprintf(string, "%s%s%s.Makefile", projectName, config ? "-" : "", config ? config.name : "");
+      sprintf(string, "%s%s%s.Makefile", projectName, config ? "-" : "", config ? config.name : "");
    }
 
 #ifndef MAKEFILE_GENERATOR
@@ -1488,7 +1487,7 @@ private:
       CatTargetFileName(targetFileName, compiler, config);
 
       strcpy(makeFilePath, topNode.path);
-      CatMakeFileName(makeFile, compiler, config);
+      CatMakeFileName(makeFile, config);
       PathCatSlash(makeFilePath, makeFile);
       
       // TODO: TEST ON UNIX IF \" around makeTarget is ok
@@ -1502,6 +1501,8 @@ private:
          {
             int len;
             char pushD[MAX_LOCATION];
+            char cfDir[MAX_LOCATION];
+            GetCompilerConfigsDir(cfDir);
             GetWorkingDir(pushD, sizeof(pushD));
             ChangeWorkingDir(topNode.path);
             // Create object dir if it does not exist already
@@ -1539,6 +1540,8 @@ private:
       }
       else
       {
+         char cfDir[MAX_LOCATION];
+         GetCompilerConfigsDir(cfDir);
          sprintf(command, "%s E_IDE_CF_DIR=%s COMPILER=%s -j%d %s%s%s -C \"%s\" -f \"%s\"", compiler.makeCommand, cfDir, compilerName, numJobs,
                compiler.ccacheEnabled ? "CCACHE=y " : "",
                compiler.distccEnabled ? "DISTCC=y " : "",
@@ -1573,7 +1576,7 @@ private:
       SetPath(false, compiler, config);
 
       strcpy(makeFilePath, topNode.path);
-      CatMakeFileName(makeFile, compiler, config);
+      CatMakeFileName(makeFile, config);
       PathCatSlash(makeFilePath, makeFile);
       
       if(compiler.type.isVC)
@@ -1596,6 +1599,8 @@ private:
       }
       else
       {
+         char cfDir[MAX_LOCATION];
+         GetCompilerConfigsDir(cfDir);
          sprintf(command, "%s E_IDE_CF_DIR=%s COMPILER=%s %sclean -C \"%s\" -f \"%s\"", compiler.makeCommand, cfDir, compilerName, realclean ? "real" : "", topNode.path, makeFilePath);
          if((f = DualPipeOpen(PipeOpenMode { output = 1, error = 1, input = 2 }, command)))
          {
@@ -1694,11 +1699,13 @@ private:
       bool result = false;
       char path[MAX_LOCATION];
 
-      GetWorkingDir(path, sizeof(path));
-      PathCatSlash(path, cfDir);
+      GetCompilerConfigsDir(path);
+      if(!FileExists(path).isDirectory)
+         MakeDir(path);
       PathCatSlash(path, "debug.cf");
 
-      if(!FileExists(path))
+      if(FileExists(path))
+         DeleteFile(path);
       {
          File f = FileOpen(path, write);
          if(f)
@@ -1734,11 +1741,13 @@ private:
       bool result = false;
       char path[MAX_LOCATION];
 
-      GetWorkingDir(path, sizeof(path));
-      PathCatSlash(path, cfDir);
+      GetCompilerConfigsDir(path);
+      if(!FileExists(path).isDirectory)
+         MakeDir(path);
       PathCatSlash(path, "crossplatform.cf");
 
-      if(!FileExists(path))
+      if(FileExists(path))
+         DeleteFile(path);
       {
          File include = FileOpen(":crossplatform.cf", read);
          if(include)
@@ -1775,11 +1784,13 @@ private:
       CamelCase(compilerName);
       name = PrintString(platform, "-", compilerName, ".cf");
 
-      GetWorkingDir(path, sizeof(path));
-      PathCatSlash(path, cfDir);
+      GetCompilerConfigsDir(path);
+      if(!FileExists(path).isDirectory)
+         MakeDir(path);
       PathCatSlash(path, name);
 
-      if(!FileExists(path))
+      if(FileExists(path))
+         DeleteFile(path);
       {
          File f = FileOpen(path, write);
          if(f)
@@ -1859,7 +1870,7 @@ private:
       if(!altMakefilePath)
       {
          strcpy(filePath, topNode.path);
-         CatMakeFileName(makeFile, compiler, config);
+         CatMakeFileName(makeFile, config);
          PathCatSlash(filePath, makeFile);
       }
 
index 3f6ad5f..5f75a85 100644 (file)
@@ -555,7 +555,7 @@ class ProjectView : Window
          DisplayCompiler(compiler, false);
 
       strcpy(makefilePath, project.topNode.path);
-      project.CatMakeFileName(makefileName, compiler, config);
+      project.CatMakeFileName(makefileName, config);
       PathCatSlash(makefilePath, makefileName);
 
       exists = FileExists(makefilePath);