ecsDefaultCommand,
earDefaultCommand,
cppDefaultCommand,
- ccDefaultCommand
+ ccDefaultCommand,
+ cxxDefaultCommand
};
incref defaultCompiler;
return defaultCompiler;
get { return ccCommand; }
isset { return ccCommand && ccCommand[0]; }
}
+ property char * cxxCommand
+ {
+ set { delete cxxCommand; if(value && value[0]) cxxCommand = CopyString(value); }
+ get { return cxxCommand; }
+ isset { return cxxCommand && cxxCommand[0]; }
+ }
property char * execPrefixCommand
{
set { delete execPrefixCommand; if(value && value[0]) execPrefixCommand = CopyString(value); }
char * earCommand;
char * cppCommand;
char * ccCommand;
+ char * cxxCommand;
char * execPrefixCommand;
char * distccHosts;
/*union
delete earCommand;
delete cppCommand;
delete ccCommand;
+ delete cxxCommand;
delete makeCommand;
delete execPrefixCommand;
delete distccHosts;
earCommand,
cppCommand,
ccCommand,
+ cxxCommand,
execPrefixCommand,
ccacheEnabled,
distccEnabled,
define earCommandSetting = "EAR Command";
define cPreprocessorCommandSetting = "C Preprocessor Command";
define cCompilerCommandSetting = "C Compiler Command";
+define cxxCompilerCommandSetting = "C++ Compiler Command";
define projectOptions = "Project Options";
define defaultTargetDir = "Default Target Directory";
define earDefaultCommand = "ear";
define cppDefaultCommand = "cpp";
define ccDefaultCommand = "gcc";
+define cxxDefaultCommand = "g++";
class OldIDESettings : GlobalAppSettings
{
GetGlobalValue(section, earCommandSetting, singleString, &v); compiler.earCommand = v && v[0] ? v : earDefaultCommand; delete v;
GetGlobalValue(section, cPreprocessorCommandSetting, singleString, &v); compiler.cppCommand = v && v[0] ? v : cppDefaultCommand; delete v;
GetGlobalValue(section, cCompilerCommandSetting, singleString, &v); compiler.ccCommand = v && v[0] ? v : ccDefaultCommand; delete v;
+ GetGlobalValue(section, cCompilerCommandSetting, singleString, &v); compiler.cxxCommand = v && v[0] ? v : cxxDefaultCommand; delete v;
delete section;
section = new char[len + 13];
sprintf(section, "%s Directories", configName);
PutGlobalValue(section, earCommandSetting, singleString, compiler.earCommand);
PutGlobalValue(section, cPreprocessorCommandSetting, singleString, compiler.cppCommand);
PutGlobalValue(section, cCompilerCommandSetting, singleString, compiler.ccCommand);
+ PutGlobalValue(section, cxxCompilerCommandSetting, singleString, compiler.cxxCommand);
delete section;
section = new char[len + 13];
sprintf(section, "%s Directories", compiler.name);
hasClose = true;
borderStyle = sizable;
text = $"Global Settings";
- minClientSize = { 560, 420 };
+ minClientSize = { 560, 446 };
nativeDecorations = true;
IDESettings ideSettings;
this, anchor = { left = 120, top = 138, right = 8 };
text = $"C Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
};
- Label makeLabel { this, position = { 8, 168 }, labeledWindow = make, tabCycle = false, inactive = true };
- PathBox make
+ Label cxxLabel { this, position = { 8, 168 }, labeledWindow = cxx, tabCycle = false, inactive = true };
+ PathBox cxx
{
this, anchor = { left = 120, top = 164, right = 8 };
+ text = $"C++ Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
+ };
+ Label makeLabel { this, position = { 8, 194 }, labeledWindow = make, tabCycle = false, inactive = true };
+ PathBox make
+ {
+ this, anchor = { left = 120, top = 190, right = 8 };
text = $"GNU Make", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
};
- Label execPrefixLabel { this, position = { 8, 194 }, labeledWindow = execPrefix, tabCycle = false, inactive = true };
+ Label execPrefixLabel { this, position = { 8, 220 }, labeledWindow = execPrefix, tabCycle = false, inactive = true };
PathBox execPrefix
{
- this, anchor = { left = 120, top = 190, right = 8 };
+ this, anchor = { left = 120, top = 216, right = 8 };
text = $"Execution Prefix", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
};
compiler.cppCommand = pathBox.slashPath;
else if(pathBox == cc)
compiler.ccCommand = pathBox.slashPath;
+ else if(pathBox == cxx)
+ compiler.cxxCommand = pathBox.slashPath;
else if(pathBox == make)
compiler.makeCommand = pathBox.slashPath;
else if(pathBox == execPrefix)
ear.path = compiler.earCommand;
cpp.path = compiler.cppCommand;
cc.path = compiler.ccCommand;
+ cxx.path = compiler.cxxCommand;
make.path = compiler.makeCommand;
execPrefix.path = compiler.execPrefixCommand;
char cppCommand[MAX_LOCATION];
char ccCommand[MAX_LOCATION];
+ char cxxCommand[MAX_LOCATION];
char ecpCommand[MAX_LOCATION];
char eccCommand[MAX_LOCATION];
char ecsCommand[MAX_LOCATION];
char earCommand[MAX_LOCATION];
char * cc = compiler.ccCommand;
+ char * cxx = compiler.cxxCommand;
char * cpp = compiler.cppCommand;
sprintf(cppCommand, "%s%s%s%s ",
compiler.ccacheEnabled ? "ccache " : "",
compiler.ccacheEnabled && !compiler.distccEnabled ? " " : "",
compiler.distccEnabled ? "distcc " : "",
compiler.ccCommand);
+ sprintf(cxxCommand, "%s%s%s%s ",
+ compiler.ccacheEnabled ? "ccache " : "",
+ compiler.ccacheEnabled && !compiler.distccEnabled ? " " : "",
+ compiler.distccEnabled ? "distcc " : "",
+ compiler.cxxCommand);
sprintf(ecpCommand, "%s ", compiler.ecpCommand);
sprintf(eccCommand, "%s ", compiler.eccCommand);
sprintf(ecsCommand, "%s ", compiler.ecsCommand);
}
else if(strstr(line, "ear ") == line);
else if(strstr(line, "strip ") == line);
- else if(strstr(line, ccCommand) == line || strstr(line, ecpCommand) == line || strstr(line, eccCommand) == line)
+ else if(strstr(line, ccCommand) == line || strstr(line, cxxCommand) == line || strstr(line, ecpCommand) == line || strstr(line, eccCommand) == line)
{
char moduleName[MAX_FILENAME];
byte * tokens[1];
char * module;
bool isPrecomp = false;
- if(strstr(line, ccCommand) == line)
+ if(strstr(line, ccCommand) == line || strstr(line, cxxCommand) == line)
{
module = strstr(line, " -c ");
if(module) module += 4;
char path[MAX_LOCATION];
char * name;
char * compilerName;
- bool gccCompiler = compiler.ccCommand && strstr(compiler.ccCommand, "gcc") != null;
+ bool gccCompiler = compiler.ccCommand && (strstr(compiler.ccCommand, "gcc") != null || strstr(compiler.ccCommand, "g++") != null);
Platform platform = GetRuntimePlatform();
compilerName = CopyString(compiler.name);
//f.Printf("SHELL := %s\n", "ar"/*compiler.arCommand*/); // is this really needed?
f.Printf("CPP := $(CCACHE_COMPILE) $(DISTCC_COMPILE) %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,
// 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 numCObjects = 0;
+ bool containsCXX = false; // True if the project contains a C++ file
bool sameObjTargetDirs;
DirExpression objDirExp = GetObjDir(compiler, config);
TargetTypes targetType = GetTargetType(config);
bool crossCompiling = compiler.targetPlatform != runtimePlatform;
- bool gccCompiler = compiler.ccCommand && strstr(compiler.ccCommand, "gcc") != null;
+ bool gccCompiler = compiler.ccCommand && (strstr(compiler.ccCommand, "gcc") != null || strstr(compiler.ccCommand, "g++") != null);
bool tccCompiler = compiler.ccCommand && strstr(compiler.ccCommand, "tcc") != null;
bool defaultPreprocessor = compiler.cppCommand && (strstr(compiler.cppCommand, "gcc") != null || compiler.cppCommand && strstr(compiler.cppCommand, "cpp") != null);
char cfDir[MAX_LOCATION];
topNode.GenMakefileGetNameCollisionInfo(namesInfo, config);
- numCObjects = topNode.GenMakefilePrintNode(f, this, objects, namesInfo, listItems, config);
+ numCObjects = topNode.GenMakefilePrintNode(f, this, objects, namesInfo, listItems, config, &containsCXX);
if(numCObjects)
listItems.Add(CopyString("$(OBJ)$(MODULE).main$(O)"));
objectsParts = OutputFileList(f, "OBJECTS", listItems, varStringLenDiffs, null);
int c;
char * map[4][2] = { { "COBJECTS", "C" }, { "SYMBOLS", "S" }, { "IMPORTS", "I" }, { "BOWLS", "B" } };
- topNode.GenMakefilePrintNode(f, this, eCsources, namesInfo, listItems, config);
+ topNode.GenMakefilePrintNode(f, this, eCsources, namesInfo, listItems, config, null);
eCsourcesParts = OutputFileList(f, "_ECSOURCES", listItems, varStringLenDiffs, null);
f.Printf("ECSOURCES = $(call shwspace,$(_ECSOURCES))\n");
}
}
- topNode.GenMakefilePrintNode(f, this, sources, null, listItems, config);
+ topNode.GenMakefilePrintNode(f, this, sources, null, listItems, config, null);
OutputFileList(f, "SOURCES", listItems, varStringLenDiffs, "$(ECSOURCES)");
if(!noResources)
- resNode.GenMakefilePrintNode(f, this, resources, null, listItems, config);
+ resNode.GenMakefilePrintNode(f, this, resources, null, listItems, config, null);
OutputFileList(f, "RESOURCES", listItems, varStringLenDiffs, null);
f.Printf("LIBS += $(SHAREDLIB) $(EXECUTABLE) $(LINKOPT)\n\n");
f.Printf("$(TARGET): $(SOURCES) $(RESOURCES) $(SYMBOLS) $(OBJECTS) | objdir%s\n", sameObjTargetDirs ? "" : " targetdir");
f.Printf("ifneq \"$(TARGET_TYPE)\" \"%s\"\n", TargetTypeToMakefileVariable(staticLibrary));
- f.Printf("\t$(CC) $(OFLAGS) $(OBJECTS) $(LIBS) -o $(TARGET) $(INSTALLNAME)\n");
+ f.Printf("\t$(%s) $(OFLAGS) $(OBJECTS) $(LIBS) %s-o $(TARGET) $(INSTALLNAME)\n", containsCXX ? "CXX" : "CC", containsCXX ? "-lstdc++ " : "");
if(!GetDebug(config))
{
f.Printf("ifndef NOSTRIP\n");
int GenMakefilePrintNode(File f, Project project, GenMakefilePrintTypes printType,
Map<String, NameCollisionInfo> namesInfo, Array<String> items,
- ProjectConfig prjConfig)
+ ProjectConfig prjConfig, bool * containsCXX)
{
int count = 0;
if(type == file)
collision = info ? info.IsExtensionColliding(extension) : false;
sprintf(s, "%s$(OBJ)%s%s%s.o%s", ts.a, moduleName, collision ? "." : "", collision ? extension : "", ts.b);
items.Add(CopyString(s));
+ if(containsCXX && (!strcmpi(extension, "cpp") || !strcmpi(extension, "cc") || !strcmpi(extension, "cxx")))
+ *containsCXX = true;
}
}
else if(!strcmpi(extension, "ec"))
for(child : files)
{
if(child.type != resources && (child.type == folder || !child.GetIsExcluded(prjConfig)))
- count += child.GenMakefilePrintNode(f, project, printType, namesInfo, items, prjConfig);
+ count += child.GenMakefilePrintNode(f, project, printType, namesInfo, items, prjConfig, containsCXX);
}
}
return count;
if(!strcmpi(extension, "ec"))
sprintf(command, "%s -MT $(OBJ)%s.o -MM $(OBJ)%s.c", compiler.ccCommand, moduleName, moduleName);
else
- sprintf(command, "%s -MT $(OBJ)%s.o -MM %s%s.%s", compiler.ccCommand, moduleName, modulePath, moduleName, extension);
+ sprintf(command, "%s -MT $(OBJ)%s.o -MM %s%s.%s", (!strcmpi(extension, "cc") || !strcmpi(extension, "cxx") || !strcmpi(extension, "cpp")) ? compiler.cxxCommand : compiler.ccCommand,
+ moduleName, modulePath, moduleName, extension);
if(!strcmpi(extension, "ec"))
f.Printf("$(OBJ)%s.o: $(OBJ)%s.c\n", moduleName, moduleName);
}
#endif
}
- f.Printf("\t$(CC)");
+ f.Printf("\t$(%s)", (!strcmpi(extension, "cc") || !strcmpi(extension, "cpp") || !strcmpi(extension, "cxx")) ? "CXX" : "CC");
// Give priority to file flags
GenFileFlags(f, project, prjConfig);