default:
-static void DummyFunction()
+static __attribute__((unused)) void DummyFunction()
{
int a;
a.OnFree();
void OnLoad(GlobalSettingsData data)
{
- IDESettings settings = (IDESettings)data;
#ifndef MAKEFILE_GENERATOR
+ IDESettings settings = (IDESettings)data;
globalSettingsDialog.ideSettings = settings;
ide.UpdateRecentMenus();
ide.UpdateCompilerConfigs(true);
fileNameLen += len;
path = new char[len+1];
f.Read(path, sizeof(char), len+1);
-
+
/*
fileName = new char[fileNameLen+2];
strcpy(fileName, path);
f.Read(&type, sizeof(type), 1);
f.Read(&count, sizeof(count), 1);
-
+
if(type == file)
{
nodeType = file;
if(path && path[0])
f.Printf("%s Path = %s\n", indentation, path);
}
-
+
/*if(buildExclusions.first && type != project)
{
for(item = buildExclusions.first; item; item = item.next)
f.Printf("\n");
}
*/
-
+
if(type == project && (files.count /*|| preprocessorDefs.first*/))
{
f.Printf("\n");
#define SEPS "/"
#define SEP '/'
-static Array<String> notLinkerOptions
+static Array<const String> notLinkerOptions
{ [
"-static-libgcc",
"-shared",
define stringInFileIncludedFrom = "In file included from ";
define stringFrom = " from ";
-// This function cannot accept same pointer for source and output
-// todo: rename ReplaceSpaces to EscapeSpaceAndSpecialChars or something
-void ReplaceSpaces(char * output, char * source)
-{
- int c, dc;
- char ch, pch = 0;
-
- for(c = 0, dc = 0; (ch = source[c]); c++, dc++)
- {
- if(ch == ' ') output[dc++] = '\\';
- if(ch == '\"') output[dc++] = '\\';
- if(ch == '&') output[dc++] = '\\';
- if(pch != '$')
- {
- if(ch == '(' || ch == ')') output[dc++] = '\\';
- pch = ch;
- }
- else if(ch == ')')
- pch = 0;
- output[dc] = ch;
- }
- output[dc] = '\0';
-}
-
// chars refused for project name: windowsFileNameCharsNotAllowed + " &,."
//define gnuMakeCharsNeedEscaping = "$%";
// NOTES: - this function should get only unescaped unix style paths
// - paths with literal $(somestring) in them are not supported
// my_$(messed_up)_path would likely become my__path
-void EscapeForMake(char * output, char * input, bool hideSpace, bool allowVars, bool allowDblQuote)
+void EscapeForMake(char * output, const char * input, bool hideSpace, bool allowVars, bool allowDblQuote)
{
- char ch, *i = input, *o = output;
+ char ch, *o = output;
+ const char *i = input;
bool inVar = false;
#ifdef _DEBUG
int len = strlen(input);
delete buf;
}
-void EscapeForMakeToDynString(DynamicString output, char * input, bool hideSpace, bool allowVars, bool allowDblQuote)
+void EscapeForMakeToDynString(DynamicString output, const char * input, bool hideSpace, bool allowVars, bool allowDblQuote)
{
char * buf = new char[strlen(input)*2+1];
EscapeForMake(buf, input, hideSpace, allowVars, allowDblQuote);
delete buf;
}
-int OutputFileList(File f, char * name, Array<String> list, Map<String, int> varStringLenDiffs, char * prefix)
+int OutputFileList(File f, const char * name, Array<String> list, Map<String, int> varStringLenDiffs, const char * prefix)
{
int numOfBreaks = 0;
const int breakListLength = 1536;
{
if(numOfBreaks > 1)
f.Printf("%s%d =", name, c+1);
-
+
len = 3;
itemCount = breaks[c];
for(n=offset; n<offset+itemCount; n++)
return numOfBreaks;
}
-void OutputLinkObjectActions(File f, char * name, int parts)
+void OutputFileListActions(File f, const char * name, int parts, const char * fileName)
{
if(parts > 1)
{
int c;
for(c=0; c<parts; c++)
- f.Printf("\t@$(call echo,$(%s%d)) >> $(OBJ)linkobjects.lst\n", name, c+1);
+ f.Printf("\t@$(call echo,$(%s%d)) >> %s\n", name, c+1, fileName);
} else if(parts) {
- f.Printf("\t@$(call echo,$(%s)) >> $(OBJ)linkobjects.lst\n", name);
+ f.Printf("\t@$(call echo,$(%s)) >> %s\n", name, fileName);
}
}
-void OutputCleanActions(File f, char * name, int parts)
+void OutputCleanActions(File f, const char * name, int parts)
{
if(parts > 1)
{
enum StringOutputMethod { asIs, escape, escapePath};
enum ToolchainFlag { any, _D, _I, _isystem, _Wl, _L/*, _Wl-rpath*/ };
-String flagNames[ToolchainFlag] = { "", "-D", "-I", "-isystem ", "-Wl,", /*"-Wl,--library-path="*/"-L"/*, "-Wl,-rpath "*/ };
+const String flagNames[ToolchainFlag] = { "", "-D", "-I", "-isystem ", "-Wl,", /*"-Wl,--library-path="*/"-L"/*, "-Wl,-rpath "*/ };
void OutputFlags(File f, ToolchainFlag flag, Array<String> list, LineOutputMethod lineMethod)
{
if(list.count)
strcpy(temp, item);
StripExtension(temp);
s = temp;
- }
+ }
f.Puts(" \\\n\t$(call _L,");
usedFunction = true;
}
void CamelCase(char * string)
{
- int c, len = strlen(string);
- for(c=0; c<len && string[c] >= 'A' && string[c] <= 'Z'; c++)
- string[c] = (char)tolower(string[c]);
+ if(string)
+ {
+ int c, len = strlen(string);
+ for(c=0; c<len && string[c] >= 'A' && string[c] <= 'Z'; c++)
+ string[c] = (char)tolower(string[c]);
+ }
}
CompilerConfig GetCompilerConfig()
projectPOs.options.targetType : TargetTypes::unset;
-char * PlatformToMakefileTargetVariable(Platform platform)
+const char * PlatformToMakefileTargetVariable(Platform platform)
{
return platform == win32 ? "WINDOWS_TARGET" :
platform == tux ? "LINUX_TARGET" :
"ERROR_BAD_TARGET";
}
-char * TargetTypeToMakefileVariable(TargetTypes targetType)
+const char * TargetTypeToMakefileVariable(TargetTypes targetType)
{
return targetType == executable ? "executable" :
targetType == sharedLibrary ? "sharedlib" :
}
// Move this to ProjectConfig? null vs Common to consider...
-char * GetConfigName(ProjectConfig config)
+const char * GetConfigName(ProjectConfig config)
{
return config ? config.name : "Common";
}
float version;
String moduleName;
- property char * moduleVersion
+ property const char * moduleVersion
{
set { delete moduleVersion; if(value && value[0]) moduleVersion = CopyString(value); } // TODO: use CopyString function that filters chars
get { return moduleVersion ? moduleVersion : ""; } // version number should only use digits and dots
isset { return moduleVersion != null && moduleVersion[0]; } // add leading/trailing 0 if value start/ends with dot(s)
}
- property char * description
+ property const char * description
{
set { delete description; if(value && value[0]) description = CopyString(value); }
get { return description ? description : ""; }
isset { return description != null && description[0]; }
}
- property char * license
+ property const char * license
{
set { delete license; if(value && value[0]) license = CopyString(value); }
get { return license ? license : ""; }
isset { return license != null && license[0]; }
}
- property char * compilerConfigsDir
+ property const char * compilerConfigsDir
{
set { delete compilerConfigsDir; if(value && value[0]) compilerConfigsDir = CopyString(value); }
get { return compilerConfigsDir ? compilerConfigsDir : ""; }
FileMonitor fileMonitor
{
this, FileChange { modified = true };
- bool OnFileNotify(FileChange action, char * param)
+ bool OnFileNotify(FileChange action, const char * param)
{
fileMonitor.StopMonitoring();
if(OnProjectModified(action, param))
return true;
}
- bool OnProjectModified(FileChange fileChange, char * param)
+ bool OnProjectModified(FileChange fileChange, const char * param)
{
char temp[4096];
sprintf(temp, $"The project %s was modified by another application.\n"
}
}
- property char * filePath
+ property const char * filePath
{
set
{
}
}
- ProjectConfig GetConfig(char * configName)
+ ProjectConfig GetConfig(const char * configName)
{
ProjectConfig result = null;
if(configName && configName[0] && configurations.count)
return result;
}
- ProjectNode FindNodeByObjectFileName(char * fileName, IntermediateFileType type, bool dotMain, ProjectConfig config)
+ ProjectNode FindNodeByObjectFileName(const char * fileName, IntermediateFileType type, bool dotMain, ProjectConfig config)
{
ProjectNode result;
- char * cfgName;
+ const char * cfgName;
if(!config)
config = this.config;
cfgName = config ? config.name : "";
return false;
}
- char * GetObjDirExpression(ProjectConfig config)
+ const char * GetObjDirExpression(ProjectConfig config)
{
// TODO: Support platform options
- char * expression = localObjectsDirectory;
+ const char * expression = localObjectsDirectory;
if(!expression)
expression = settingsObjectsDirectory;
return expression;
DirExpression GetObjDir(CompilerConfig compiler, ProjectConfig config, int bitDepth)
{
- char * expression = GetObjDirExpression(config);
+ const char * expression = GetObjDirExpression(config);
DirExpression objDir { type = intermediateObjectsDir };
objDir.Evaluate(expression, this, compiler, config, bitDepth);
return objDir;
}
- char * GetTargetDirExpression(ProjectConfig config)
+ const char * GetTargetDirExpression(ProjectConfig config)
{
// TODO: Support platform options
- char * expression = localTargetDirectory;
+ const char * expression = localTargetDirectory;
if(!expression)
expression = settingsTargetDirectory;
return expression;
DirExpression GetTargetDir(CompilerConfig compiler, ProjectConfig config, int bitDepth)
{
- char * expression = GetTargetDirExpression(config);
+ const char * expression = GetTargetDirExpression(config);
DirExpression targetDir { type = DirExpressionType::targetDir /*intermediateObjectsDir*/};
targetDir.Evaluate(expression, this, compiler, config, bitDepth);
return targetDir;
return fastMath == true;
}
- String GetDefaultNameSpace(ProjectConfig config)
+ const String GetDefaultNameSpace(ProjectConfig config)
{
- String defaultNameSpace = localDefaultNameSpace;
+ const String defaultNameSpace = localDefaultNameSpace;
return defaultNameSpace;
}
return strictNameSpaces == true;
}
- String GetTargetFileName(ProjectConfig config)
+ const String GetTargetFileName(ProjectConfig config)
{
- String targetFileName = localTargetFileName;
+ const String targetFileName = localTargetFileName;
return targetFileName;
}
{
#ifndef MAKEFILE_GENERATOR
return ide.project == this && ide.debugger && ide.debugger.prjConfig == config && ide.debugger.isActive;
+#else
+ return false;
#endif
}
{
#ifndef MAKEFILE_GENERATOR
return ide.project == this && ide.debugger && ide.debugger.prjConfig == config && ide.debugger.isPrepared;
+#else
+ return false;
#endif
}
}
#ifndef MAKEFILE_GENERATOR
- bool Save(char * fileName)
+ bool Save(const char * fileName)
{
File f;
/*char output[MAX_LOCATION];
void CatTargetFileName(char * string, CompilerConfig compiler, ProjectConfig config)
{
TargetTypes targetType = GetTargetType(config);
- String targetFileName = GetTargetFileName(config);
+ const String targetFileName = GetTargetFileName(config);
if(targetType == staticLibrary)
{
PathCatSlash(string, "lib");
}
else
PathCatSlash(string, targetFileName);
-
+
switch(targetType)
{
case executable:
strcat(string, ".dylib");
else
strcat(string, ".so");
- if(compiler.targetPlatform == tux && GetRuntimePlatform() == tux && moduleVersion && moduleVersion[0])
+ if(compiler.targetPlatform == tux && __runtimePlatform == tux && moduleVersion && moduleVersion[0])
{
strcat(string, ".");
strcat(string, moduleVersion);
if(c && ((c.options && cfg.options && cfg.options.console != c.options.console) ||
(!c.options || !cfg.options)))
cfg.symbolGenModified = true;
- if(c && ((c.options && cfg.options &&
- ( (cfg.options.libraries && c.options.libraries && cfg.options.libraries.OnCompare(c.options.libraries)) || (!cfg.options.libraries || !c.options.libraries)) )
+ if(c && ((c.options && cfg.options &&
+ ( (cfg.options.libraries && c.options.libraries && cfg.options.libraries.OnCompare(c.options.libraries)) || (!cfg.options.libraries || !c.options.libraries)) )
|| (!c.options || !cfg.options)))
cfg.linkingModified = true;
void ModifiedAllConfigs(bool making, bool compiling, bool linking, bool symbolGen)
{
- Map<String, NameCollisionInfo> cfgNameCollision = configsNameCollisions[""];
- if(cfgNameCollision)
+ Map<String, NameCollisionInfo> cfgNameCollision;
+ MapIterator<const String, Map<String, NameCollisionInfo>> it { map = configsNameCollisions };
+ if(it.Index("", false))
{
+ cfgNameCollision = it.data;
cfgNameCollision.Free();
delete cfgNameCollision;
- configsNameCollisions[""] = null;
+ it.Remove();
}
for(cfg : configurations)
{
if(making)
{
cfg.makingModified = true;
- cfgNameCollision = configsNameCollisions[cfg.name];
- if(cfgNameCollision)
+ if(it.Index(cfg.name, false))
{
+ cfgNameCollision = it.data;
cfgNameCollision.Free();
delete cfgNameCollision;
- configsNameCollisions[cfg.name] = null;
+ it.Remove();
}
}
if(compiling)
ide.workspace.modified = true;
}
}
-
+
void RotateActiveConfig(bool forward, bool syncAllProjects)
{
if(configurations.first && configurations.last != configurations.first)
bool loggedALine = false;
int lenMakeCommand = strlen(compiler.makeCommand);
int testLen = 0;
- char * t, * s;
+ const char * t, * s, * s2;
char moduleName[MAX_FILENAME];
- char * gnuToolchainPrefix = compiler.gnuToolchainPrefix ? compiler.gnuToolchainPrefix : "";
+ const char * gnuToolchainPrefix = compiler.gnuToolchainPrefix ? compiler.gnuToolchainPrefix : "";
DynamicString test { };
DynamicString ecp { };
DynamicString windres { };
/*
- if(bitDepth == 64 && compiler.targetPlatform == win32)
+ if(bitDepth == 64 && compiler.targetPlatform == win32)
gnuToolchainPrefix = "x86_64-w64-mingw32-";
else if(bitDepth == 32 && compiler.targetPlatform == win32)
gnuToolchainPrefix = "i686-w64-mingw32-";
//printf("Peeking and GetLine...\n");
if((result = f.Peek()) && (result = f.GetLine(line, sizeof(line)-1)) && line[0])
{
- char * message = null;
- char * inFileIncludedFrom = strstr(line, stringInFileIncludedFrom);
- char * from = strstr(line, stringFrom);
+ const char * message = null;
+ const char * inFileIncludedFrom = strstr(line, stringInFileIncludedFrom);
+ const char * from = strstr(line, stringFrom);
test.copyLenSingleBlankReplTrim(line, ' ', true, testLen);
- if((t = strstr(line, (s=": recipe for target"))) && (t = strstr(t+strlen(s), (s=" failed"))) && (t+strlen(s))[0] == '\0')
+ if((t = strstr(line, (s=": recipe for target"))) && (t = strstr(t+strlen(s), (s2 = " failed"))) && (t+strlen(s2))[0] == '\0')
; // ignore this new gnu make error but what is it about?
else if(strstr(line, compiler.makeCommand) == line && line[lenMakeCommand] == ':')
{
- char * module = strstr(line, "No rule to make target `");
+ const char * module = strstr(line, "No rule to make target `");
if(module)
{
char * end;
if(module)
{
- byte * tokens[1];
+ char * tokens[1];
if(!compiling && !isPrecomp)
{
ide.outputView.buildBox.Logf($"Compiling...\n");
if(module) module++;
if(module)
{
- byte * tokens[1];
+ char * tokens[1];
char * dashF = strstr(module, "-F ");
if(dashF)
{
{
if(linking || compiling || precompiling)
{
- char * start = inFileIncludedFrom ? inFileIncludedFrom + strlen(stringInFileIncludedFrom) : from ? from + strlen(stringFrom) : line;
- char * colon = strstr(start, ":"); //, * bracket;
+ const char * start = inFileIncludedFrom ? inFileIncludedFrom + strlen(stringInFileIncludedFrom) : from ? from + strlen(stringFrom) : line;
+ const char * colon = strstr(start, ":"); //, * bracket;
if(colon && (colon[1] == '/' || colon[1] == '\\'))
colon = strstr(colon + 1, ":");
if(colon)
{
- char * sayError = "";
+ const char * sayError = "";
char moduleName[MAX_LOCATION], temp[MAX_LOCATION];
char * pointer;
char * error;
{
// Silence warnings for compiled eC
char * objDir = strstr(moduleName, objDirExp.dir);
-
+
if(linking)
{
if((pointer = strstr(line, "undefined")) ||
numErrors++;
}
else if(compilingEC == 1 || (objDir && objDir == moduleName))
- continue;
+ {
+ bool skip = false;
+
+ // Filter out these warnings caused by eC generated C code:
+
+ // Declaration ordering bugs -- Awaiting topo sort implementation
+ if(strstr(line, "declared inside parameter list")) skip = true;
+ else if(strstr(line, "its scope is only this definition")) skip = true;
+ else if(strstr(line, "note: expected 'struct ") || strstr(line, "note: expected ‘struct "))
+ {
+ #define STRUCT_A "'struct "
+ #define STRUCT_B "‘struct "
+ char * struct1, * struct2, ch1, ch2;
+ struct1 = strstr(line, STRUCT_A);
+ if(struct1) { struct1 += sizeof(STRUCT_A)-1; } else { struct1 = strstr(line, STRUCT_B); struct1 += sizeof(STRUCT_B)-1; };
+
+ struct2 = strstr(struct1, STRUCT_A);
+ if(struct2) { struct2 += sizeof(STRUCT_A)-1; } else { struct2 = strstr(struct1, STRUCT_B); if(struct2) struct2 += sizeof(STRUCT_B)-1; };
+
+ if(struct1 && struct2)
+ {
+ while(ch1 = *(struct1++), ch2 = *(struct2++), ch1 && ch2 && (ch1 == '_' || isalnum(ch1)) && (ch2 == '_' || isalnum(ch2)));
+ if(ch1 == ch2)
+ skip = true;
+ }
+ }
+ // Pointers warnings (eC should already warn about relevant problems, more forgiving for function pointers, should cast in generated code)
+ else if((strstr(line, "note: expected '") || strstr(line, "note: expected ‘")) && strstr(line, "(*)")) skip = true;
+ else if(strstr(line, "expected 'void **") || strstr(line, "expected ‘void **")) skip = true;
+ else if(strstr(line, "from incompatible pointer type")) skip = true;
+ else if(strstr(line, "comparison of distinct pointer types lacks a cast")) skip = true;
+
+ // Things being defined for potential use -- Should mark as unused
+ else if(strstr(line, "unused variable") && (strstr(line, "'__") || strstr(line, "‘__") || strstr(line, "'class'") || strstr(line, "‘class’"))) skip = true;
+ else if(strstr(line, "defined but not used") && strstr(line, "__ecereProp")) skip = true;
+
+ // For preprocessed code from objidl.h (MinGW-w64 headers)
+ else if(strstr(line, "declaration does not declare anything")) skip = true;
+
+ // Location information that could apply to ignored warnings
+ else if(strstr(line, "In function '") || strstr(line, "In function ‘") ) skip = true;
+ else if(strstr(line, "At top level")) skip = true;
+ else if(strstr(line, "(near initialization for '") || strstr(line, "(near initialization for ‘")) skip = true;
+
+ if(skip) continue;
+ numWarnings++;
+ }
else if(strstr(line, "warning:"))
{
numWarnings++;
{
char fullModuleName[MAX_LOCATION];
FileAttribs found = 0;
- Project foundProject = this;
+ //Project foundProject = this;
if(moduleName[0])
{
char * loc = strstr(moduleName, ":");
found = FileExists(fullModuleName);
if(found)
{
- foundProject = prj;
+ //foundProject = prj;
break;
}
}
found = FileExists(fullModuleName);
if(found)
{
- foundProject = prj;
+ //foundProject = prj;
break;
}
}
{
if(f.GetExitCode() && !numErrors)
{
- bool result = f.GetLine(line, sizeof(line)-1);
+ /*bool result = */f.GetLine(line, sizeof(line)-1);
ide.outputView.buildBox.Logf($"Fatal Error: child process terminated unexpectedly\n");
}
else if(buildType != install)
ide.outputView.buildBox.Logf("%d %s, ", numErrors, (numErrors > 1) ? $"errors" : $"error");
else
ide.outputView.buildBox.Logf($"no error, ");
-
+
if(numWarnings)
ide.outputView.buildBox.Logf("%d %s\n", numWarnings, (numWarnings > 1) ? $"warnings" : $"warning");
else
char configName[MAX_LOCATION];
DirExpression objDirExp = GetObjDir(compiler, config, bitDepth);
PathBackup pathBackup { };
- bool crossCompiling = (compiler.targetPlatform != GetRuntimePlatform());
- char * targetPlatform = crossCompiling ? (char *)compiler.targetPlatform : "";
+ bool crossCompiling = (compiler.targetPlatform != __runtimePlatform);
+ const char * targetPlatform = crossCompiling ? (char *)compiler.targetPlatform : "";
bool eC_Debug = mode.eC_ToolsDebug;
bool singleProjectOnlyNode = onlyNodes && onlyNodes.count == 1 && onlyNodes[0].type == project;
}
else
{
- int len;
char pushD[MAX_LOCATION];
char cfDir[MAX_LOCATION];
GetIDECompilerConfigsDir(cfDir, true, true);
// Create object dir if it does not exist already
if(!FileExists(objDirExp.dir).isDirectory)
{
- sprintf(command, "%s CF_DIR=\"%s\"%s%s%s%s COMPILER=%s objdir -C \"%s\"%s -f \"%s\"",
+ sprintf(command, "%s CF_DIR=\"%s\"%s%s%s%s%s COMPILER=%s objdir -C \"%s\"%s -f \"%s\"",
compiler.makeCommand, cfDir,
crossCompiling ? " TARGET_PLATFORM=" : "",
targetPlatform,
if(compiler.type.isVC)
{
- bool result = false;
+ //bool result = false;
char oldwd[MAX_LOCATION];
GetWorkingDir(oldwd, sizeof(oldwd));
ChangeWorkingDir(topNode.path);
{
ProcessPipeOutputRaw(f);
delete f;
- result = true;
+ //result = true;
}
ChangeWorkingDir(oldwd);
}
}
else
{
+ GccVersionInfo ccVersion = GetGccVersionInfo(compiler, compiler.ccCommand);
+ GccVersionInfo cxxVersion = GetGccVersionInfo(compiler, compiler.cxxCommand);
char cfDir[MAX_LOCATION];
GetIDECompilerConfigsDir(cfDir, true, true);
- sprintf(command, "%s%s %sCF_DIR=\"%s\"%s%s%s%s%s%s COMPILER=%s %s-j%d %s%s%s -C \"%s\"%s -f \"%s\"",
+ sprintf(command, "%s%s %sCF_DIR=\"%s\"%s%s%s%s%s%s COMPILER=%s %s%s%s-j%d %s%s%s -C \"%s\"%s -f \"%s\"",
#if defined(__WIN32__)
"",
#else
bitDepth == 32 ? "32" : bitDepth == 64 ? "64" : "",
ide.workspace.useValgrind ? " DISABLED_POOLING=1" : "",
/*(bitDepth == 64 && compiler.targetPlatform == win32) ? " GCC_PREFIX=x86_64-w64-mingw32-" : (bitDepth == 32 && compiler.targetPlatform == win32) ? " GCC_PREFIX=i686-w64-mingw32-" :*/ "",
- compilerName, eC_Debug ? "--always-make " : "", numJobs,
+ compilerName, eC_Debug ? "--always-make " : "",
+ ccVersion == post4_8 ? "GCC_CC_FLAGS=-fno-diagnostics-show-caret " : "",
+ cxxVersion == post4_8 ? "GCC_CXX_FLAGS=-fno-diagnostics-show-caret " : "",
+ numJobs,
(compiler.ccacheEnabled && !eC_Debug) ? "CCACHE=y " : "",
(compiler.distccEnabled && !eC_Debug) ? "DISTCC=y " : "",
(String)makeTargets, topNode.path, (justPrint || eC_Debug) ? " -n" : "", makeFilePath);
{
if(justPrint)
ide.outputView.buildBox.Logf("%s\n", line);
- if(!error && !found && strstr(line, "echo ") == line)
+ if(!error && !found && strstr(line, "echo ") == line && strstr(line, "ECERE_SDK_SRC"))
{
strcpy(command, line+5);
error = true;
char * compilerName;
DualPipe f;
PathBackup pathBackup { };
- bool crossCompiling = (compiler.targetPlatform != GetRuntimePlatform());
- char * targetPlatform = crossCompiling ? (char *)compiler.targetPlatform : "";
+ bool crossCompiling = (compiler.targetPlatform != __runtimePlatform);
+ const char * targetPlatform = crossCompiling ? (char *)compiler.targetPlatform : "";
compilerName = CopyString(compiler.name);
CamelCase(compilerName);
strcpy(makeFilePath, topNode.path);
CatMakeFileName(makeFile, config);
PathCatSlash(makeFilePath, makeFile);
-
+
if(compiler.type.isVC)
{
- bool result = false;
+ //bool result = false;
char oldwd[MAX_LOCATION];
GetWorkingDir(oldwd, sizeof(oldwd));
ChangeWorkingDir(topNode.path);
-
+
// TODO: justPrint support
sprintf(command, "%s /useenv /clean /nologo /logcommands %s.sln %s|Win32", compiler.makeCommand, name, config.name);
if(justPrint)
{
ProcessPipeOutputRaw(f);
delete f;
- result = true;
+ //result = true;
}
ChangeWorkingDir(oldwd);
- return result;
+ //return result;
}
else
{
delete compilerName;
}
- void Run(char * args, CompilerConfig compiler, ProjectConfig config, int bitDepth)
- {
+ void Run(const char * args, CompilerConfig compiler, ProjectConfig config, int bitDepth)
+ {
String target = new char[maxPathLen];
char oldDirectory[MAX_LOCATION];
char * executableLauncher = compiler.executableLauncher;
return result;
}
- bool GenerateCompilerCf(CompilerConfig compiler)
+ bool GenerateCompilerCf(CompilerConfig compiler, bool eC)
{
bool result = false;
char path[MAX_LOCATION];
char * name;
char * compilerName;
bool gccCompiler = compiler.ccCommand && (strstr(compiler.ccCommand, "gcc") != null || strstr(compiler.ccCommand, "g++") != null);
- char * gnuToolchainPrefix = compiler.gnuToolchainPrefix ? compiler.gnuToolchainPrefix : "";
+ const char * gnuToolchainPrefix = compiler.gnuToolchainPrefix ? compiler.gnuToolchainPrefix : "";
Platform platform = compiler.targetPlatform;
compilerName = CopyString(compiler.name);
//f.Printf("SHELL := %s\n", "sh"/*compiler.shellCommand*/); // is this really needed?
f.Printf("CPP := $(CCACHE_COMPILE)$(DISTCC_COMPILE)$(GCC_PREFIX)%s$(_SYSROOT)\n", compiler.cppCommand);
- f.Printf("CC := $(CCACHE_COMPILE)$(DISTCC_COMPILE)$(GCC_PREFIX)%s$(_SYSROOT)\n", compiler.ccCommand);
- f.Printf("CXX := $(CCACHE_COMPILE)$(DISTCC_COMPILE)$(GCC_PREFIX)%s$(_SYSROOT)\n", compiler.cxxCommand);
- f.Printf("ECP := $(if $(ECP_DEBUG),ide -debug-start \"$(ECERE_SDK_SRC)/compiler/ecp/ecp.epj\" -debug-work-dir \"${CURDIR}\" -@,%s)\n", compiler.ecpCommand);
- f.Printf("ECC := $(if $(ECC_DEBUG),ide -debug-start \"$(ECERE_SDK_SRC)/compiler/ecc/ecc.epj\" -debug-work-dir \"${CURDIR}\" -@,%s)$(if $(CROSS_TARGET), -t $(TARGET_PLATFORM),)\n", compiler.eccCommand);
- f.Printf("ECS := $(if $(ECS_DEBUG),ide -debug-start \"$(ECERE_SDK_SRC)/compiler/ecs/ecs.epj\" -debug-work-dir \"${CURDIR}\" -@,%s)$(if $(CROSS_TARGET), -t $(TARGET_PLATFORM),)$(if $(OUTPUT_POT), -outputpot,)$(if $(DISABLED_POOLING), -disabled-pooling,)\n", compiler.ecsCommand);
+ f.Printf("CC := $(CCACHE_COMPILE)$(DISTCC_COMPILE)$(GCC_PREFIX)%s$(_SYSROOT)$(if $(GCC_CC_FLAGS),$(space)$(GCC_CC_FLAGS),)\n", compiler.ccCommand);
+ f.Printf("CXX := $(CCACHE_COMPILE)$(DISTCC_COMPILE)$(GCC_PREFIX)%s$(_SYSROOT)$(if $(GCC_CXX_FLAGS),$(space)$(GCC_CXX_FLAGS),)\n", compiler.cxxCommand);
+ if(eC)
+ {
+ f.Printf("ECP := $(if $(ECP_DEBUG),ide -debug-start \"$(ECERE_SDK_SRC)/compiler/ecp/ecp.epj\" -debug-work-dir \"${CURDIR}\" -@,%s)$(if $(GCC_CC_FLAGS),$(space)$(GCC_CC_FLAGS),)\n", compiler.ecpCommand);
+ f.Printf("ECC := $(if $(ECC_DEBUG),ide -debug-start \"$(ECERE_SDK_SRC)/compiler/ecc/ecc.epj\" -debug-work-dir \"${CURDIR}\" -@,%s)$(if $(CROSS_TARGET), -t $(TARGET_PLATFORM),)$(if $(GCC_CC_FLAGS),$(space)$(GCC_CC_FLAGS),)\n", compiler.eccCommand);
+ f.Printf("ECS := $(if $(ECS_DEBUG),ide -debug-start \"$(ECERE_SDK_SRC)/compiler/ecs/ecs.epj\" -debug-work-dir \"${CURDIR}\" -@,%s)$(if $(CROSS_TARGET), -t $(TARGET_PLATFORM),)$(if $(OUTPUT_POT), -outputpot,)$(if $(DISABLED_POOLING), -disabled-pooling,)\n", compiler.ecsCommand);
+ }
+ else
+ {
+ f.Printf("ECP := %s\n", compiler.ecpCommand);
+ f.Printf("ECC := %s$(if $(CROSS_TARGET), -t $(TARGET_PLATFORM),)\n", compiler.eccCommand);
+ f.Printf("ECS := %s$(if $(CROSS_TARGET), -t $(TARGET_PLATFORM),)$(if $(OUTPUT_POT), -outputpot,)$(if $(DISABLED_POOLING), -disabled-pooling,)\n", compiler.ecsCommand);
+ }
f.Printf("EAR := %s\n", compiler.earCommand);
f.Puts("AS := $(GCC_PREFIX)as\n");
f.Puts(l);
}
}
+ if(compiler.eCcompilerFlags && compiler.eCcompilerFlags.count)
+ {
+ f.Puts("\nECFLAGS +=");
+ OutputFlags(f, any, compiler.eCcompilerFlags, inPlace);
+ f.Puts("\n");
+ }
if(compiler.compilerFlags && compiler.compilerFlags.count)
{
f.Puts("\nCFLAGS +=");
return result;
}
- bool GenerateMakefile(char * altMakefilePath, bool noResources, char * includemkPath, ProjectConfig config)
+ bool GenerateMakefile(const char * altMakefilePath, bool noResources, const char * includemkPath, ProjectConfig config)
{
bool result = false;
char filePath[MAX_LOCATION];
char targetDirExpNoSpaces[MAX_LOCATION];
char fixedModuleName[MAX_FILENAME];
char fixedConfigName[MAX_FILENAME];
- int c, len;
+ int c;
int lenObjDirExpNoSpaces, lenTargetDirExpNoSpaces;
// Non-zero if we're building eC code
// We'll have to be careful with this when merging configs where eC files can be excluded in some configs and included in others
int numRCObjects = 0;
bool containsCXX = false; // True if the project contains a C++ file
bool relObjDir, sameOrRelObjTargetDirs;
- String objDirExp = GetObjDirExpression(config);
+ const String objDirExp = GetObjDirExpression(config);
TargetTypes targetType = GetTargetType(config);
char cfDir[MAX_LOCATION];
if(compilerConfigsDir && compilerConfigsDir[0])
{
strcpy(cfDir, compilerConfigsDir);
- if(cfDir && cfDir[0] && cfDir[strlen(cfDir)-1] != '/')
+ if(cfDir[0] && cfDir[strlen(cfDir)-1] != '/')
strcat(cfDir, "/");
}
else
{
int c;
- char * map[5][2] = { { "COBJECTS", "C" }, { "SYMBOLS", "S" }, { "IMPORTS", "I" }, { "ECOBJECTS", "O" }, { "BOWLS", "B" } };
+ const char * map[5][2] = { { "COBJECTS", "C" }, { "SYMBOLS", "S" }, { "IMPORTS", "I" }, { "ECOBJECTS", "O" }, { "BOWLS", "B" } };
numCObjects = topNode.GenMakefilePrintNode(f, this, eCsources, namesInfo, listItems, config, null);
if(numCObjects)
topNode.GenMakefilePrintNode(f, this, sources, null, listItems, config, null);
{
- char * prefix;
+ const char * prefix;
if(numCObjects && numRCObjects)
prefix = "$(ECSOURCES) $(RCSOURCES)";
else if(numCObjects)
f.Puts("\n");
}
- topNode.GenMakeCollectAssignNodeFlags(config, numCObjects,
+ topNode.GenMakeCollectAssignNodeFlags(config, numCObjects != 0,
cflagsVariations, nodeCFlagsMapping,
ecflagsVariations, nodeECFlagsMapping, null);
GenMakePrintCustomFlags(f, "PRJ_CFLAGS", false, cflagsVariations);
+ f.Puts("ECFLAGS += -module $(MODULE)\n");
GenMakePrintCustomFlags(f, "ECFLAGS", true, ecflagsVariations);
if(platforms || (config && config.platforms))
f.Puts("objdir:\n");
if(!relObjDir)
f.Puts("\t$(if $(wildcard $(OBJ)),,$(call mkdirq,$(OBJ)))\n");
-
+ if(numCObjects)
+ {
f.Puts("\t$(if $(ECERE_SDK_SRC),$(if $(wildcard $(call escspace,$(ECERE_SDK_SRC)/crossplatform.mk)),,@$(call echo,Ecere SDK Source Warning: The value of ECERE_SDK_SRC is pointing to an incorrect ($(ECERE_SDK_SRC)) location.)),)\n");
f.Puts("\t$(if $(ECERE_SDK_SRC),,$(if $(ECP_DEBUG)$(ECC_DEBUG)$(ECS_DEBUG),@$(call echo,ECC Debug Warning: Please define ECERE_SDK_SRC before using ECP_DEBUG, ECC_DEBUG or ECS_DEBUG),))\n");
+ }
//f.Puts("# PRE-BUILD COMMANDS\n");
if(options && options.prebuildCommands)
{
{
// Main Module (Linking) for ECERE C modules
f.Puts("$(OBJ)$(MODULE).main.ec: $(SYMBOLS) $(COBJECTS)\n");
+ f.Printf("\t@$(call rmq,$(OBJ)symbols.lst)\n");
+ f.Printf("\t@$(call touch,$(OBJ)symbols.lst)\n");
+ OutputFileListActions(f, "SYMBOLS", eCsourcesParts, "$(OBJ)symbols.lst");
+ OutputFileListActions(f, "IMPORTS", eCsourcesParts, "$(OBJ)symbols.lst");
// use of objDirExpNoSpaces used instead of $(OBJ) to prevent problematic joining of arguments in ecs
- f.Printf("\t$(ECS)%s $(ARCH_FLAGS) $(ECSLIBOPT) $(SYMBOLS) $(IMPORTS) -symbols %s -o $(call quote_path,$@)\n",
+ f.Printf("\t$(ECS)%s $(ARCH_FLAGS) $(ECSLIBOPT) @$(OBJ)symbols.lst -symbols %s -o $(call quote_path,$@)\n",
GetConsole(config) ? " -console" : "", objDirExpNoSpaces);
f.Puts("\n");
// Main Module (Linking) for ECERE C modules
f.Printf("$(TARGET): $(SOURCES)%s $(RESOURCES) $(SYMBOLS) $(OBJECTS) | objdir%s\n",
rcSourcesParts ? " $(RCSOURCES)" : "", sameOrRelObjTargetDirs ? "" : " targetdir");
- f.Printf("\t@$(call rmq,$(OBJ)linkobjects.lst)\n");
- f.Printf("\t@$(call touch,$(OBJ)linkobjects.lst)\n");
- OutputLinkObjectActions(f, "_OBJECTS", objectsParts);
+ f.Printf("\t@$(call rmq,$(OBJ)objects.lst)\n");
+ f.Printf("\t@$(call touch,$(OBJ)objects.lst)\n");
+ OutputFileListActions(f, "_OBJECTS", objectsParts, "$(OBJ)objects.lst");
if(rcSourcesParts)
{
f.Puts("ifdef WINDOWS_TARGET\n");
- OutputLinkObjectActions(f, "RCOBJECTS", rcSourcesParts);
+ OutputFileListActions(f, "RCOBJECTS", rcSourcesParts, "$(OBJ)objects.lst");
f.Puts("endif\n");
}
if(numCObjects)
{
- f.Printf("\t@$(call echo,$(OBJ)$(MODULE).main$(O)) >> $(OBJ)linkobjects.lst\n");
- OutputLinkObjectActions(f, "ECOBJECTS", eCsourcesParts);
+ f.Printf("\t@$(call echo,$(OBJ)$(MODULE).main$(O)) >> $(OBJ)objects.lst\n");
+ OutputFileListActions(f, "ECOBJECTS", eCsourcesParts, "$(OBJ)objects.lst");
}
f.Puts("ifndef STATIC_LIBRARY_TARGET\n");
- f.Printf("\t$(%s) $(OFLAGS) @$(OBJ)linkobjects.lst $(LIBS) %s-o $(TARGET) $(INSTALLNAME)\n", containsCXX ? "CXX" : "CC", containsCXX ? "-lstdc++ " : "");
+ f.Printf("\t$(%s) $(OFLAGS) @$(OBJ)objects.lst $(LIBS) -o $(TARGET) $(INSTALLNAME)\n", containsCXX ? "CXX" : "CC");
if(!GetDebug(config))
{
f.Puts("ifndef NOSTRIP\n");
f.Puts("\t$(UPX) $(UPXFLAGS) $(TARGET)\n");
f.Puts("endif\n");
f.Puts("else\n");
- f.Puts("ifneq \"$(TARGET_ARCH)\" \"x86_64\"\n");
+ //f.Puts("ifneq \"$(TARGET_ARCH)\" \"x86_64\"\n");
f.Puts("\t$(UPX) $(UPXFLAGS) $(TARGET)\n");
- f.Puts("endif\n");
+ //f.Puts("endif\n");
f.Puts("endif\n");
}
}
if(resNode.files && resNode.files.count && !noResources)
resNode.GenMakefileAddResources(f, resNode.path, config);
f.Puts("else\n");
- f.Puts("\t$(AR) rcs $(TARGET) @$(OBJ)linkobjects.lst $(LIBS)\n");
+ f.Puts("\t$(AR) rcs $(TARGET) @$(OBJ)objects.lst $(LIBS)\n");
f.Puts("endif\n");
f.Puts("ifdef SHARED_LIBRARY_TARGET\n");
f.Puts("ifdef LINUX_TARGET\n");
GenMakefilePrintMainObjectRule(f, config);
f.Printf("cleantarget: objdir%s\n", sameOrRelObjTargetDirs ? "" : " targetdir");
- f.Puts("\t$(call rmq,$(TARGET))\n");
if(numCObjects)
+ {
f.Printf("\t$(call rmq,%s)\n", "$(OBJ)$(MODULE).main.o $(OBJ)$(MODULE).main.c $(OBJ)$(MODULE).main.ec $(OBJ)$(MODULE).main$(I) $(OBJ)$(MODULE).main$(S)");
+ f.Printf("\t$(call rmq,$(OBJ)symbols.lst)\n");
+ }
+ f.Printf("\t$(call rmq,$(OBJ)objects.lst)\n");
+ f.Puts("\t$(call rmq,$(TARGET))\n");
f.Puts("ifdef SHARED_LIBRARY_TARGET\n");
f.Puts("ifdef LINUX_TARGET\n");
f.Puts("ifdef LINUX_HOST\n");
f.Puts("\n");
f.Puts("clean: cleantarget\n");
- f.Printf("\t$(call rmq,$(OBJ)linkobjects.lst)\n");
OutputCleanActions(f, "OBJECTS", objectsParts);
if(rcSourcesParts)
{
void GenMakefilePrintMainObjectRule(File f, ProjectConfig config)
{
char extension[MAX_EXTENSION] = "c";
- char modulePath[MAX_LOCATION];
+ //char modulePath[MAX_LOCATION];
char fixedModuleName[MAX_FILENAME];
- DualPipe dep;
- char command[2048];
+ //DualPipe dep;
+ //char command[2048];
char objDirNoSpaces[MAX_LOCATION];
- String objDirExp = GetObjDirExpression(config);
+ const String objDirExp = GetObjDirExpression(config);
ReplaceSpaces(objDirNoSpaces, objDirExp);
ReplaceSpaces(fixedModuleName, moduleName);
-
+
//sprintf(fixedModuleName, "%s.main", fixedPrjName);
//strcat(fixedModuleName, ".main");
#endif
}
- void GenMakePrintCustomFlags(File f, String variableName, bool printNonCustom, Map<String, int> cflagsVariations)
+ void GenMakePrintCustomFlags(File f, const String variableName, bool printNonCustom, Map<String, int> cflagsVariations)
{
int c;
for(c = printNonCustom ? 0 : 1; c <= cflagsVariations.count; c++)
static inline void ProjectLoadLastBuildNamesInfo(Project prj, ProjectConfig cfg)
{
- char * cfgName = cfg ? cfg.name : "";
+ const char * cfgName = cfg ? cfg.name : "";
Map<String, NameCollisionInfo> cfgNameCollisions = prj.configsNameCollisions[cfgName];
if(cfgNameCollisions)
{
prj.topNode.GenMakefileGetNameCollisionInfo(cfgNameCollisions, cfg);
}
-Project LegacyBinaryLoadProject(File f, char * filePath)
+Project LegacyBinaryLoadProject(File f, const char * filePath)
{
Project project = null;
char signature[sizeof(epjSignature)];
PathCatSlash(topNodePath, filePath);
project.filePath = topNodePath;
-
+
/* THIS IS ALREADY DONE BY filePath property
StripLastDirectory(topNodePath, topNodePath);
project.topNode.path = CopyString(topNodePath);
*/
// Shouldn't this be done BEFORE the StripLastDirectory? project.filePath = topNodePath;
-
+
// newConfig.options.defaultNameSpace = "";
/*newConfig.objDir.dir = "obj";
newConfig.targetDir.dir = "";*/
f.Read(&temp, sizeof(int),1);
project./*config.*/options.debug = temp ? true : false;
- f.Read(&temp, sizeof(int),1);
+ f.Read(&temp, sizeof(int),1);
project./*config.*/options.optimization = temp ? speed : none;
f.Read(&temp, sizeof(int),1);
project./*config.*/options.profile = temp ? true : false;
project.options.libraryDirs = { };
for(c = 0; c < count; c++)
{
- char * name;
+ char * name;
f.Read(&len, sizeof(int),1);
name = new char[len+1];
f.Read(name, sizeof(char), len+1);
}
void ProjectConfig::LegacyProjectConfigLoad(File f)
-{
+{
delete options;
options = { };
while(!f.Eof())
char section[128];
char subSection[128];
char * equal;
- int len;
uint pos;
-
+
pos = f.Tell();
f.GetLine(buffer, 65536 - 1);
TrimLSpaces(buffer, buffer);
makingModified = true;
}
-Project LegacyAsciiLoadProject(File f, char * filePath)
+Project LegacyAsciiLoadProject(File f, const char * filePath)
{
Project project = null;
- ProjectNode node = null;
+ //ProjectNode node = null;
int pos;
char parentPath[MAX_LOCATION];
char section[128] = "";
child.type = file;
child.icon = NodeIcons::SelectFileIcon(child.name);
parent.files.Add(child);
- node = child;
+ //node = child;
//child = null;
}
else
PathCatSlash(parentPath, child.name);
parent.files.Add(child);
parent = child;
- node = child;
+ //node = child;
//child = null;
}
else if(!strcmpi(section, "Configurations"))
project.filePath = topNodePath;
parentPath[0] = '\0';
parent = project.topNode;
- node = parent;
+ //node = parent;
strcpy(section, "Target");
equal = &buffer[6];
if(equal[0] == ' ')
child.icon = archiveFile;
project.resNode = child;
parent = child;
- node = child;
+ //node = child;
strcpy(subSection, buffer);
}
else
}
}
}
- }
+ }
}
}
if(cfg.options.targetType != staticLibrary)
{
int result;
-
+
if(type.type == noHeadClass || type.type == normalClass)
{
- result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
+ result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
*(void **)((byte *)firstConfig.options + member.offset + member._class.offset),
*(void **)((byte *)cfg.options + member.offset + member._class.offset));
}
else
{
- result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
+ result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
(byte *)firstConfig.options + member.offset + member._class.offset,
(byte *)cfg.options + member.offset + member._class.offset);
}
break;
}
}
- }
+ }
}
if(same)
{
if(type.type == noHeadClass || type.type == normalClass)
{
- if(!((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
+ if(!((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
*(void **)((byte *)firstConfig.options + member.offset + member._class.offset),
*(void **)((byte *)nullOptions + member.offset + member._class.offset)))
continue;
}
else
{
- if(!((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
+ if(!((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
(byte *)firstConfig.options + member.offset + member._class.offset,
(byte *)nullOptions + member.offset + member._class.offset))
continue;
}
if(!project.options) project.options = { };
-
+
/*if(type.type == noHeadClass || type.type == normalClass)
{
- ((void (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCopy])(type,
+ ((void (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCopy])(type,
(byte *)project.options + member.offset + member._class.offset,
*(void **)((byte *)firstConfig.options + member.offset + member._class.offset));
}
{
void * address = (byte *)firstConfig.options + member.offset + member._class.offset;
// TOFIX: ListBox::SetData / OnCopy mess
- ((void (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCopy])(type,
+ ((void (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCopy])(type,
(byte *)project.options + member.offset + member._class.offset,
- (type.typeSize > 4) ? address :
- ((type.typeSize == 4) ? (void *)*(uint32 *)address :
- ((type.typeSize == 2) ? (void *)*(uint16*)address :
- (void *)*(byte *)address )));
+ (type.typeSize > 4) ? address :
+ ((type.typeSize == 4) ? (void *)*(uint32 *)address :
+ ((type.typeSize == 2) ? (void *)*(uint16*)address :
+ (void *)*(byte *)address )));
}*/
memcpy(
(byte *)project.options + member.offset + member._class.offset,
if(cfg.options.targetType == staticLibrary)
{
int result;
-
+
if(type.type == noHeadClass || type.type == normalClass)
{
- result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
+ result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
*(void **)((byte *)firstConfig.options + member.offset + member._class.offset),
*(void **)((byte *)cfg.options + member.offset + member._class.offset));
}
else
{
- result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
+ result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
(byte *)firstConfig.options + member.offset + member._class.offset,
(byte *)cfg.options + member.offset + member._class.offset);
}
{
if(type.type == noHeadClass || type.type == normalClass)
{
- ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type,
+ ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type,
*(void **)((byte *)cfg.options + member.offset + member._class.offset));
}
else
{
- ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type,
+ ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type,
(byte *)cfg.options + member.offset + member._class.offset);
}
memset((byte *)cfg.options + member.offset + member._class.offset, 0, type.typeSize);
- }
+ }
}
memset((byte *)firstConfig.options + member.offset + member._class.offset, 0, type.typeSize);
}
continue;
if(cfg != firstConfig)
{
- cfg.platforms.Free();
- delete cfg.platforms;
+ cfg.platforms = null;
}
}
project.platforms = firstConfig.platforms;
- firstConfig.platforms = null;
+ *&firstConfig.platforms = null;
}
}
}
}
-Project LoadProject(char * filePath, char * activeConfigName)
+Project LoadProject(const char * filePath, const char * activeConfigName)
{
Project project = null;
File f = FileOpen(filePath, read);
if(!project)
{
JSONParser parser { f = f };
- JSONResult result = parser.GetObject(class(Project), &project);
+ /*JSONResult result = */parser.GetObject(class(Project), &project);
if(project)
{
char insidePath[MAX_LOCATION];
{
project.resNode = project.topNode.Add(project, "Resources", project.topNode.files.last, resources, archiveFile, false);
}
-
+
if(!project.moduleName)
project.moduleName = CopyString(project.name);
- if(project.config &&
+ if(project.config &&
(!project.options || !project.options.targetFileName || !project.options.targetFileName[0]) &&
(!project.config.options.targetFileName || !project.config.options.targetFileName[0]))
{
//delete project.config.options.targetFileName;
-
+
project.options.targetFileName = /*CopyString(*/project.moduleName/*)*/;
project.config.options.optimization = none;
project.config.options.debug = true;
}
return project;
}
+
+#ifndef MAKEFILE_GENERATOR
+static GccVersionInfo GetGccVersionInfo(CompilerConfig compiler, const String compilerCommand)
+{
+ GccVersionInfo result = unknown;
+ if(compiler.ccCommand)
+ {
+ char command[MAX_F_STRING*4];
+ DualPipe f;
+ sprintf(command, "%s%s --version", compiler.gccPrefix ? compiler.gccPrefix : "", compilerCommand);
+ if((f = DualPipeOpen(PipeOpenMode { output = true, error = true, input = true }, command)))
+ {
+ bool firstLine = true;
+ while(!f.eof)
+ {
+ char line[1024];
+ char * tokens[128];
+ if(f.GetLine(line,sizeof(line)))
+ {
+ if(firstLine)
+ {
+ uint count = Tokenize(line, sizeof(tokens)/sizeof(tokens[0]), tokens,false);
+ char * token = null;
+ int i;
+ bool inPar = false;
+ for(i = 0; i < count; i++)
+ {
+ if(tokens[i][0] == '(')
+ {
+ if(tokens[i][strlen(tokens[i])-1] != ')')
+ inPar = true;
+ }
+ else if(tokens[i][0] && tokens[i][strlen(tokens[i])-1] == ')')
+ inPar = false;
+ else if(!inPar && isdigit(tokens[i][0]) && strchr(tokens[i], '.'))
+ token = tokens[i];
+ }
+ if(token)
+ result = GccVersionInfo::GetVersionInfo(token);
+ firstLine = false;
+ }
+ }
+ }
+ delete f;
+ }
+ }
+ return result;
+}
+
+static enum GccVersionInfo
+{
+ unknown, pre4_8, post4_8;
+
+ GccVersionInfo ::GetVersionInfo(char * version)
+ {
+ GccVersionInfo result = unknown;
+ int ver;
+ char * s = CopyString(version);
+ char * tokens[16];
+ uint count = TokenizeWith(s, sizeof(tokens)/sizeof(tokens[0]), tokens, ".", false);
+ ver = count > 1 ? atoi(tokens[1]) : 0;
+ ver += count ? atoi(tokens[0]) * 1000 : 0;
+ if(ver > 0)
+ {
+ if(ver < 4008)
+ result = pre4_8;
+ else
+ result = post4_8;
+ }
+ delete s;
+ return result;
+ }
+};
+#endif