ide/Project: Resolved Host/Target platform confusion; Made forcing bit depth (on...
authorJerome St-Louis <jerome@ecere.com>
Fri, 24 Aug 2012 21:18:07 +0000 (17:18 -0400)
committerJerome St-Louis <jerome@ecere.com>
Fri, 24 Aug 2012 21:18:07 +0000 (17:18 -0400)
ecere/ecereCOM.epj
ide/locale/ide.pot
ide/src/IDESettings.ec
ide/src/dialogs/GlobalSettingsDialog.ec
ide/src/project/Project.ec
ide/src/project/ProjectConfig.ec

index 348e458..71be3f9 100644 (file)
       "TargetDirectory" : "obj/$(MODULE).$(CONFIG).$(PLATFORM)",
       "ObjectsDirectory" : "obj/$(MODULE).$(CONFIG).$(PLATFORM)"
    },
+   "Platforms" : [
+      {
+         "Name" : "linux",
+         "Options" : {
+            "Libraries" : [
+               "m"
+            ]
+         }
+      }
+   ],
    "Configurations" : [
       {
          "Name" : "Debug",
    "Resources" : [
 
    ]
-}
\ No newline at end of file
+}
index ffa0e9c..6d27322 100644 (file)
@@ -582,11 +582,11 @@ msgstr "Debugging compressed applications is not supported\n"
 msgid "Debugging stopped\n"
 msgstr "Debugging stopped\n"
 
-#: ./src/dialogs/GlobalSettingsDialog.ec:1110
+#: ./src/dialogs/GlobalSettingsDialog.ec:1129
 msgid "Default Compiler"
 msgstr "Default Compiler"
 
-#: ./src/dialogs/GlobalSettingsDialog.ec:1075
+#: ./src/dialogs/GlobalSettingsDialog.ec:1094
 msgid "Default Intermediate Objects Directory"
 msgstr "Default Intermediate Objects Directory"
 
@@ -594,7 +594,7 @@ msgstr "Default Intermediate Objects Directory"
 msgid "Default Name Space"
 msgstr "Default Name Space"
 
-#: ./src/dialogs/GlobalSettingsDialog.ec:1062
+#: ./src/dialogs/GlobalSettingsDialog.ec:1081
 msgid "Default Target Directory"
 msgstr "Default Target Directory"
 
@@ -616,7 +616,7 @@ msgstr "Delete %s"
 msgid "Delete Folder"
 msgstr "Delete Folder"
 
-#: ./src/project/Project.ec:1790
+#: ./src/project/Project.ec:1798
 msgid "Deleting target and object files..."
 msgstr "Deleting target and object files..."
 
@@ -707,7 +707,7 @@ msgstr "Environment Variables"
 msgid "Error creating directory"
 msgstr "Error creating directory"
 
-#: ./src/project/Project.ec:1738
+#: ./src/project/Project.ec:1743
 msgid "Error executing make (%s) command\n"
 msgstr "Error executing make (%s) command\n"
 
@@ -1370,7 +1370,7 @@ msgctxt "Menu"
 msgid "Project"
 msgstr "Project"
 
-#: ./src/dialogs/GlobalSettingsDialog.ec:1056
+#: ./src/dialogs/GlobalSettingsDialog.ec:1075
 #: ./src/dialogs/ProjectTabSettings.ec:8
 msgid "Project"
 msgstr "Project"
@@ -1779,6 +1779,10 @@ msgstr "Stop"
 msgid "Strict Name Spaces"
 msgstr "Strict Name Spaces"
 
+#: ./src/dialogs/GlobalSettingsDialog.ec:996
+msgid "Supports forcing bit depth"
+msgstr "Supports forcing bit depth"
+
 #: ./src/debugger/Debugger.ec:2262
 msgid "Symbol \"%s\" not found"
 msgstr "Symbol \"%s\" not found"
@@ -1816,7 +1820,7 @@ msgstr "Target Platform"
 msgid "Target Type"
 msgstr "Target Type"
 
-#: ./src/project/Project.ec:1794
+#: ./src/project/Project.ec:1802
 msgid "Target and object files deleted\n"
 msgstr "Target and object files deleted\n"
 
@@ -2038,7 +2042,7 @@ msgid "With contributions from..."
 msgstr "With contributions from..."
 
 #: ./src/dialogs/FindInFilesDialog.ec:441
-#: ./src/dialogs/GlobalSettingsDialog.ec:1104
+#: ./src/dialogs/GlobalSettingsDialog.ec:1123
 #: ./src/dialogs/WorkspaceSettings.ec:6
 msgid "Workspace"
 msgstr "Workspace"
index 2bbc100..f01da3a 100644 (file)
@@ -689,6 +689,7 @@ class CompilerConfig
    class_no_expansion;
 
    numJobs = 1;
+   supportsBitDepth = true;
 public:
    property char * name
    {
@@ -760,6 +761,13 @@ public:
    }
    bool ccacheEnabled;
    bool distccEnabled;
+   property bool supportsBitDepth
+   {
+      set { supportsBitDepth = value; }
+      get { return supportsBitDepth; }
+      isset { return !supportsBitDepth; }
+   }
+
    property char * distccHosts
    {
       set { delete distccHosts; if(value && value[0]) distccHosts = CopyString(value); }
@@ -870,6 +878,7 @@ private:
    char * cxxCommand;
    char * execPrefixCommand;
    char * distccHosts;
+   bool supportsBitDepth;
    /*union
    {
       struct { Array<String> includes, libraries, executables; };
@@ -916,6 +925,7 @@ private:
          execPrefixCommand,
          ccacheEnabled,
          distccEnabled,
+         supportsBitDepth,
          distccHosts
       };
       for(s : includeDirs) copy.includeDirs.Add(CopyString(s));
index 38e15b8..dcd88e1 100644 (file)
@@ -991,6 +991,24 @@ class CompilerOptionsTab : CompilersSubTab
       }
    }
 
+   Button supportsBitDepth
+   {
+      this, text = $"Supports forcing bit depth", hotKey = altD, position = { 8, 208 };
+      isCheckbox = true;
+
+      bool NotifyClicked(Button button, int x, int y, Modifiers mods)
+      {
+         CompilerConfig compiler = loadedCompiler;
+         if(compiler)
+         {
+            compiler.supportsBitDepth = button.checked;
+            modifiedDocument = true;
+            compilersTab.modifiedDocument = true;
+         }
+         return true;
+      }
+   };
+
    CompilerOptionsTab()
    {
       Platform p;
@@ -1016,6 +1034,7 @@ class CompilerOptionsTab : CompilersSubTab
          distccEnabled.checked = compiler.distccEnabled;
          distccHosts.disabled = !compiler.distccEnabled;
          distccHosts.contents = compiler.distccHosts;
+         supportsBitDepth.checked = compiler.supportsBitDepth;
          prepDefs.strings = compiler.prepDirectives;
          excludedLibraries.strings = compiler.excludeLibs;
          
index be6c392..a4234e3 100644 (file)
@@ -1656,6 +1656,8 @@ private:
       char configName[MAX_LOCATION];
       DirExpression objDirExp = GetObjDir(compiler, config);
       PathBackup pathBackup { };
+      bool crossCompiling = (compiler.targetPlatform != GetRuntimePlatform());
+      char * targetPlatform = crossCompiling ? (char *)compiler.targetPlatform : "";
 
       int numJobs = compiler.numJobs;
       char command[MAX_LOCATION];
@@ -1690,7 +1692,8 @@ private:
             ChangeWorkingDir(topNode.path);
             // Create object dir if it does not exist already
             if(!FileExists(objDirExp.dir).isDirectory)
-               Execute("%s CF_DIR=%s COMPILER=%s objdir -C \"%s\" -f \"%s\"", compiler.makeCommand, cfDir, compilerName, topNode.path, makeFilePath);
+               Execute("%s CF_DIR=%s%s%s COMPILER=%s objdir -C \"%s\" -f \"%s\"", compiler.makeCommand, cfDir,
+                  crossCompiling ? " PLATFORM=" : "", targetPlatform, compilerName, topNode.path, makeFilePath);
             ChangeWorkingDir(pushD);
 
             PathCatSlash(makeTarget+1, objDirExp.dir);
@@ -1725,7 +1728,9 @@ private:
       {
          char cfDir[MAX_LOCATION];
          GetIDECompilerConfigsDir(cfDir, true, true);
-         sprintf(command, "%s CF_DIR=\"%s\" COMPILER=%s -j%d %s%s%s -C \"%s\" -f \"%s\"", compiler.makeCommand, cfDir, compilerName, numJobs,
+         sprintf(command, "%s CF_DIR=\"%s\"%s%s COMPILER=%s -j%d %s%s%s -C \"%s\" -f \"%s\"", compiler.makeCommand, cfDir,
+               crossCompiling ? " PLATFORM=" : "", targetPlatform,
+               compilerName, numJobs,
                compiler.ccacheEnabled ? "CCACHE=y " : "",
                compiler.distccEnabled ? "DISTCC=y " : "",
                makeTarget, topNode.path, makeFilePath);
@@ -1752,6 +1757,8 @@ private:
       char * compilerName;
       DualPipe f;
       PathBackup pathBackup { };
+      bool crossCompiling = (compiler.targetPlatform != GetRuntimePlatform());
+      char * targetPlatform = crossCompiling ? (char *)compiler.targetPlatform : "";
 
       compilerName = CopyString(compiler.name);
       CamelCase(compilerName);
@@ -1784,7 +1791,8 @@ private:
       {
          char cfDir[MAX_LOCATION];
          GetIDECompilerConfigsDir(cfDir, true, true);
-         sprintf(command, "%s CF_DIR=%s COMPILER=%s %sclean -C \"%s\" -f \"%s\"", compiler.makeCommand, cfDir, compilerName, realclean ? "real" : "", topNode.path, makeFilePath);
+         sprintf(command, "%s CF_DIR=%s%s%s COMPILER=%s %sclean -C \"%s\" -f \"%s\"", compiler.makeCommand, cfDir,
+            crossCompiling ? " PLATFORM=" : "", targetPlatform, compilerName, realclean ? "real" : "", topNode.path, makeFilePath);
          if((f = DualPipeOpen(PipeOpenMode { output = 1, error = 1, input = 2 }, command)))
          {
             ide.outputView.buildBox.Tell($"Deleting target and object files...");
@@ -1929,7 +1937,7 @@ private:
       char * name;
       char * compilerName;
       bool gccCompiler = compiler.ccCommand && (strstr(compiler.ccCommand, "gcc") != null || strstr(compiler.ccCommand, "g++") != null);
-      Platform platform = GetRuntimePlatform();
+      Platform platform = compiler.targetPlatform;
 
       compilerName = CopyString(compiler.name);
       CamelCase(compilerName);
@@ -1956,18 +1964,20 @@ private:
          File f = FileOpen(path, write);
          if(f)
          {
-            bool crossCompiling = compiler.targetPlatform != platform;
+            /*
+            if(compiler.targetPlatform != GetRuntimePlatform())
+               f.Printf("\nPLATFORM = %s\n", (char *)compiler.targetPlatform);
+            */
 
             f.Printf("# TOOLCHAIN\n\n");
 
-            //f.Printf("SHELL := %s\n", "ar"/*compiler.arCommand*/); // is this really needed?
+            //f.Printf("SHELL := %s\n", "sh"/*compiler.shellCommand*/); // is this really needed?
             f.Printf("CPP := %s\n", compiler.cppCommand);
             f.Printf("CC := $(CCACHE_COMPILE) $(DISTCC_COMPILE) %s\n", compiler.ccCommand);
             f.Printf("CXX := $(CCACHE_COMPILE) $(DISTCC_COMPILE) %s\n", compiler.cxxCommand);
             f.Printf("ECP := %s\n", compiler.ecpCommand);
             f.Printf("ECC := %s\n", compiler.eccCommand);
-            f.Printf("ECS := %s%s%s\n", compiler.ecsCommand,
-                  crossCompiling ? " -t " : "", crossCompiling ? (char*)compiler.targetPlatform : "");
+            f.Printf("ECS := %s -t $(PLATFORM)\n", compiler.ecsCommand);
             f.Printf("EAR := %s\n", compiler.earCommand);
 
             f.Printf("AS := as\n");
@@ -1981,20 +1991,15 @@ private:
             f.Printf("UPXFLAGS = -9\n\n"); // TOFEAT: Compression Level Option? Other UPX Options?
 
             f.Printf("# HARD CODED PLATFORM-SPECIFIC OPTIONS\n");
-            f.Printf("ifdef %s\n", PlatformToMakefileVariable(tux));
+            f.Printf("ifeq \"PLATFORM\" \"linux\"\n"); //, PlatformToMakefileVariable(tux));
             f.Printf("OFLAGS += -Wl,--no-undefined\n");
             f.Printf("endif\n\n");
 
             // JF's
-            f.Printf("ifdef %s\n", PlatformToMakefileVariable(apple));
+            f.Printf("ifeq \"PLATFORM\" \"apple\"\n"); //%s\n", PlatformToMakefileVariable(apple));
             f.Printf("OFLAGS += -framework cocoa -framework OpenGL\n");
             f.Printf("endif\n");
 
-            if(crossCompiling)
-            {
-               f.Printf("\nPLATFORM = %s\n", (char *)compiler.targetPlatform);
-            }
-
             if(gccCompiler)
             {
                f.Printf("\nCFLAGS += -fmessage-length=0\n");
@@ -2027,6 +2032,8 @@ private:
                   f.Puts(l);
                }
             }
+            f.Printf("\nFORCE_64_BIT = %s", compiler.supportsBitDepth ? "-m64" : "");
+            f.Printf("\nFORCE_32_BIT = %s", compiler.supportsBitDepth ? "-m32" : "");
 
             delete f;
          }
@@ -2063,7 +2070,6 @@ private:
          bool test;
          int ifCount;
          Platform platform;
-         Platform runtimePlatform = GetRuntimePlatform();
          char targetDir[MAX_LOCATION];
          char objDirExpNoSpaces[MAX_LOCATION];
          char objDirNoSpaces[MAX_LOCATION];
@@ -2160,7 +2166,7 @@ private:
                   if(ifCount)
                      f.Printf("else\n");
                   ifCount++;
-                  f.Printf("ifdef %s\n", PlatformToMakefileVariable(platform));
+                  f.Printf("ifeq \"PLATFORM\" \"%s\"\n", (char *)platform); //%s\n", PlatformToMakefileVariable(platform));
 
                   f.Printf("TARGET_TYPE = ");
                   f.Printf(TargetTypeToMakefileVariable(targetType));
@@ -2337,9 +2343,10 @@ private:
                   if(ifCount)
                      f.Printf("else\n");
                   ifCount++;
-                  f.Printf("ifdef ");
-                  f.Printf(PlatformToMakefileVariable(platform));
-                  f.Printf("\n\n");
+                  f.Printf("ifeq \"$(PLATFORM)\" \"");
+                  // f.Printf(PlatformToMakefileVariable(platform));
+                  f.Printf((char *)platform);
+                  f.Printf("\"\n\n");
 
                   if((projectPlatformOptions && projectPlatformOptions.options.preprocessorDefinitions && projectPlatformOptions.options.preprocessorDefinitions.count) ||
                      (configPlatformOptions && configPlatformOptions.options.preprocessorDefinitions && configPlatformOptions.options.preprocessorDefinitions.count) ||
@@ -2423,7 +2430,7 @@ private:
             f.Printf(" $(OPTIMIZE)");
             forceBitDepth = (options && options.buildBitDepth) || numCObjects;
             if(forceBitDepth)
-               f.Printf((!options || !options.buildBitDepth || options.buildBitDepth == bits32) ? " -m32" : " -m64");
+               f.Printf(" %s",(!options || !options.buildBitDepth || options.buildBitDepth == bits32) ? "$(FORCE_32_BIT)" : "$(FORCE_64_BIT)");
             f.Printf(" $(FPIC)");
          }
          switch(GetWarnings(config))
index a63b139..ea60d52 100644 (file)
@@ -32,8 +32,7 @@ class DirExpression : struct
       }
    }
 
-   void Evaluate(char * expression, Project project,
-      CompilerConfig compiler, ProjectConfig config)
+   void Evaluate(char * expression, Project project, CompilerConfig compiler, ProjectConfig config)
    {
       int len;
       char * expr = expression;
@@ -56,7 +55,6 @@ class DirExpression : struct
          char * configName = config && config.name && config.name[0] ? config.name : "Common";
          char * projectName = project.name ? project.name : "";
          char * moduleName = project.moduleName ? project.moduleName : "";
-         char * compilingPlatformName = GetRuntimePlatform();
          char * compilerName = (compiler && compiler.name) ? compiler.name : defaultCompilerName;
          char * targetPlatformName = compiler && compiler.targetPlatform ? compiler.targetPlatform : "";
          char buffer[MAX_LOCATION];
@@ -94,13 +92,6 @@ class DirExpression : struct
                            strcat(buffer, targetPlatformName);
                            CamelCase(&buffer[d]);
                            d += strlen(targetPlatformName);
-                           /*if(strcmpi(targetPlatformName, compilingPlatformName))
-                           {
-                              strcat(buffer, "~");
-                              d++;
-                              strcat(buffer, compilingPlatformName);
-                              d += strlen(compilingPlatformName);
-                           }*/
                            c = i;
                         }
                         else if(!strnicmp(&expr[c + 2], "Compiler", n))