9 import "OldIDESettings"
13 enum DirTypes { includes, libraries, executables };
15 define defaultCompilerName = "Default";
17 define defaultObjDirExpression = "obj/$(CONFIG).$(PLATFORM)$(COMPILER_SUFFIX)$(DEBUG_SUFFIX)";
19 char * settingsDirectoryNames[DirTypes] =
26 enum GlobalSettingsChange { none, editorSettings, projectOptions, compilerSettings };
28 enum PathRelationship { unrelated, identical, siblings, subPath, parentPath, insuficientInput, pathEmpty, toEmpty, pathNull, toNull, bothEmpty, bothNull };
29 PathRelationship eString_PathRelated(char * path, char * to, char * pathDiff)
31 PathRelationship result;
32 if(pathDiff) *pathDiff = '\0';
33 if(path && *path && to && *to)
35 char toPart[MAX_FILENAME], toRest[MAX_LOCATION];
36 char pathPart[MAX_FILENAME], pathRest[MAX_LOCATION];
38 strcpy(pathRest, path);
39 for(; toRest[0] && pathRest[0];)
41 SplitDirectory(toRest, toPart, toRest);
42 SplitDirectory(pathRest, pathPart, pathRest);
43 if(!fstrcmp(pathPart, toPart)) result = siblings;
46 if(result == siblings)
48 if(!*toRest && !*pathRest) result = identical;
49 else if(!*pathRest) result = parentPath;
50 else result = subPath;
51 if(pathDiff && result != identical) strcpy(pathDiff, *pathRest == '\0' ? toRest : pathRest);
53 else result = unrelated;
59 if(!*path && !*to) result = bothEmpty;
60 else if(!*path) result = pathEmpty;
61 else result = toEmpty;
63 else if(!path && !to) result = bothNull;
64 else if(!path) result = pathNull;
70 char * CopyValidateMakefilePath(char * path)
72 const int map[] = { 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 7 };
73 const char * vars[] = { "$(MODULE)", "$(CONFIG)", "$(PLATFORM)", "$(COMPILER)", "$(TARGET)", "$(COMPILER_SUFFIX)", "$(DEBUG_SUFFIX)", "$(PROJECT)", "$(CONFIGURATION)", "$(TARGET_PLATFORM)",(char *)0 };
80 copy = CopyString(path);
86 Array<char *> parts { };
93 for(v=0; vars[v]; v++)
95 if(SearchString(&tmp[c], 0, vars[v], false, false) == &tmp[c])
99 parts.Add(vars[map[v]]);
100 c += strlen(vars[v]);
114 for(c=0; c<parts.count; c++) len += strlen(parts[c]);
115 copy = new char[++len];
117 for(c=0; c<parts.count; c++) strcat(copy, parts[c]);
128 CompilerConfig MakeDefaultCompiler(char * name, bool readOnly)
130 CompilerConfig defaultCompiler
135 GetRuntimePlatform(),
146 incref defaultCompiler;
147 return defaultCompiler;
150 class IDESettingsContainer : GlobalSettings
153 settingsName = "ecereIDESettingsTest";
155 settingsName = "ecereIDE";
158 virtual void OnLoad(GlobalSettingsData data);
160 char moduleLocation[MAX_LOCATION];
163 FileSize settingsFileSize;
165 IDESettingsContainer()
167 char path[MAX_LOCATION];
169 LocateModule(null, moduleLocation);
170 strcpy(path, moduleLocation);
171 StripLastDirectory(moduleLocation, moduleLocation);
172 ChangeCh(moduleLocation, '\\', '/');
173 // PortableApps.com directory structure
174 if((start = strstr(path, "\\App\\EcereSDK\\bin\\ide.exe")))
176 char configFilePath[MAX_LOCATION];
177 char defaultConfigFilePath[MAX_LOCATION];
181 strcpy(configFilePath, path);
182 PathCat(configFilePath, "Data");
183 PathCat(configFilePath, "ecereIDE.ini");
185 strcpy(defaultConfigFilePath, path);
186 PathCat(defaultConfigFilePath, "App");
187 PathCat(defaultConfigFilePath, "DefaultData");
188 PathCat(defaultConfigFilePath, "ecereIDE.ini");
190 if(FileExists(defaultConfigFilePath))
192 if(!FileExists(configFilePath))
194 File f = FileOpen(defaultConfigFilePath, read);
195 f.CopyTo(configFilePath);
199 PathCat(path, "Data");
200 // the forced settings location will only be
201 // used if the running ide's path matches
202 // the PortableApps.com directory structure
203 // and the default ini file is found in
204 // the DefaultData directory
205 settingsLocation = path;
211 void OnAskReloadSettings()
213 /*if(MessageBox { type = YesNo, master = this,
214 text = "Global Settings Modified Externally",
215 contents = "The global settings were modified by another instance.\n"
216 "Would you like to reload them?" }.Modal() == Yes)*/
219 FileSize newSettingsFileSize;
220 FileGetSize(settingsFilePath, &newSettingsFileSize);
221 o = settingsFileSize;
222 n = newSettingsFileSize;
227 GuiApplication app = ((GuiApplication)__thisModule.application);
229 for(w = app.desktop.firstChild; w && (!w.created || !w.visible); w = w.next);
230 MessageBox { master = w, type = ok,
231 text = "Global Settings Modified Externally",
232 contents = "The global settings were modified by another process and a drastic shrinking of the settings file was detected.\n"
233 "The new settings will not be loaded to prevent loss of your ide settings.\n"
234 "Please check your settings file and make sure to save this IDE's global settings if your settings file has been compromised."
241 SettingsIOResult Load()
243 SettingsIOResult result = GlobalSettings::Load();
244 IDESettings data = (IDESettings)this.data;
245 CompilerConfig defaultCompiler = null;
248 this.data = IDESettings { };
250 *dataOwner = this.data;
252 if(result == fileNotCompatibleWithDriver)
255 OldIDESettings oldSettings { };
257 loaded = oldSettings.Load() == success;
261 data = (IDESettings)this.data;
263 for(c : oldSettings.compilerConfigs)
264 data.compilerConfigs.Add(c.Copy());
266 for(s : oldSettings.recentFiles) data.recentFiles.Add(CopyString(s));
267 for(s : oldSettings.recentProjects) data.recentProjects.Add(CopyString(s));
269 data.docDir = oldSettings.docDir;
270 data.ideFileDialogLocation = oldSettings.ideFileDialogLocation;
271 data.ideProjectFileDialogLocation = oldSettings.ideProjectFileDialogLocation;
272 data.useFreeCaret = oldSettings.useFreeCaret;
273 data.showLineNumbers = oldSettings.showLineNumbers;
274 data.caretFollowsScrolling = oldSettings.caretFollowsScrolling;
275 delete data.displayDriver; data.displayDriver = CopyString(oldSettings.displayDriver);
276 data.projectDefaultTargetDir = oldSettings.projectDefaultTargetDir;
277 data.projectDefaultIntermediateObjDir = oldSettings.projectDefaultIntermediateObjDir;
284 if(result == fileNotFound || !data)
286 data = (IDESettings)this.data;
287 data.useFreeCaret = true;
288 data.showLineNumbers = true;
289 data.caretFollowsScrolling = true;
292 // Ensure we have a default compiler
293 defaultCompiler = data.GetCompilerConfig(defaultCompilerName);
296 defaultCompiler = MakeDefaultCompiler(defaultCompilerName, true);
297 data.compilerConfigs.Add(defaultCompiler);
300 // We incref the compilers below, so reset refCount to 0
301 defaultCompiler._refCount = 0;
304 FileGetSize(settingsFilePath, &settingsFileSize);
305 if(data.compilerConfigs)
307 for(c : data.compilerConfigs)
309 CompilerConfig compiler = c;
310 char * cxxCommand = compiler.cxxCommand;
311 if(!cxxCommand || !cxxCommand[0])
312 compiler.cxxCommand = cxxDefaultCommand;
316 if(portable && moduleLocation[0] && FileExists(moduleLocation).isDirectory)
317 data.ManagePortablePaths(moduleLocation, true);
318 data.ForcePathSeparatorStyle(true);
323 SettingsIOResult Save()
325 SettingsIOResult result;
327 IDESettings data = (IDESettings)this.data;
328 Platform runtimePlatform = GetRuntimePlatform();
329 if(portable && moduleLocation[0] && FileExists(moduleLocation).isDirectory)
330 data.ManagePortablePaths(moduleLocation, false);
331 data.ForcePathSeparatorStyle(true);
332 result = GlobalSettings::Save();
333 if(result != success)
334 PrintLn("Error saving IDE settings");
335 if(portable && moduleLocation[0] && FileExists(moduleLocation).isDirectory)
336 data.ManagePortablePaths(moduleLocation, true);
338 FileGetSize(settingsFilePath, &settingsFileSize);
343 class IDESettings : GlobalSettingsData
346 List<CompilerConfig> compilerConfigs { };
347 Array<String> recentFiles { };
348 Array<String> recentProjects { };
349 property char * docDir
351 set { delete docDir; if(value && value[0]) docDir = CopyString(value); }
352 get { return docDir ? docDir : ""; }
353 isset { return docDir && docDir[0]; }
355 property char * ideFileDialogLocation
357 set { delete ideFileDialogLocation; if(value && value[0]) ideFileDialogLocation = CopyString(value); }
358 get { return ideFileDialogLocation ? ideFileDialogLocation : ""; }
359 isset { return ideFileDialogLocation && ideFileDialogLocation[0]; }
361 property char * ideProjectFileDialogLocation
363 set { delete ideProjectFileDialogLocation; if(value && value[0]) ideProjectFileDialogLocation = CopyString(value); }
364 get { return ideProjectFileDialogLocation ? ideProjectFileDialogLocation : ""; }
365 isset { return ideProjectFileDialogLocation && ideProjectFileDialogLocation[0]; }
368 bool showLineNumbers;
369 bool caretFollowsScrolling;
370 char * displayDriver;
372 // TODO: Classify settings
373 //EditorSettings editor { };
375 property char * projectDefaultTargetDir
377 set { delete projectDefaultTargetDir; if(value && value[0]) projectDefaultTargetDir = CopyValidateMakefilePath(value); }
378 get { return projectDefaultTargetDir ? projectDefaultTargetDir : ""; }
379 isset { return projectDefaultTargetDir && projectDefaultTargetDir[0]; }
381 property char * projectDefaultIntermediateObjDir
383 set { delete projectDefaultIntermediateObjDir; if(value && value[0]) projectDefaultIntermediateObjDir = CopyValidateMakefilePath(value); }
384 get { return projectDefaultIntermediateObjDir ? projectDefaultIntermediateObjDir : ""; }
385 isset { return projectDefaultIntermediateObjDir && projectDefaultIntermediateObjDir[0]; }
388 property char * compilerConfigsDir
390 set { delete compilerConfigsDir; if(value && value[0]) compilerConfigsDir = CopyString(value); }
391 get { return compilerConfigsDir ? compilerConfigsDir : ""; }
392 isset { return compilerConfigsDir && compilerConfigsDir[0]; }
395 property char * defaultCompiler
397 set { delete defaultCompiler; if(value && value[0]) defaultCompiler = CopyString(value); }
398 get { return defaultCompiler && defaultCompiler[0] ? defaultCompiler : defaultCompilerName; }
399 isset { return defaultCompiler && defaultCompiler[0]; }
404 char * ideFileDialogLocation;
405 char * ideProjectFileDialogLocation;
406 char * projectDefaultTargetDir;
407 char * projectDefaultIntermediateObjDir;
408 char * compilerConfigsDir;
409 char * defaultCompiler;
411 CompilerConfig GetCompilerConfig(String compilerName)
413 char * name = compilerName && compilerName[0] ? compilerName : defaultCompilerName;
414 CompilerConfig compilerConfig = null;
415 for(compiler : compilerConfigs)
417 if(!strcmp(compiler.name, name))
419 compilerConfig = compiler;
423 if(!compilerConfig && compilerConfigs.count)
424 compilerConfig = compilerConfigs.firstIterator.data;
426 incref compilerConfig;
427 return compilerConfig;
432 compilerConfigs.Free();
433 delete compilerConfigs;
436 recentProjects.Free();
437 delete recentProjects;
440 delete projectDefaultTargetDir;
441 delete projectDefaultIntermediateObjDir;
442 delete compilerConfigsDir;
443 delete defaultCompiler;
445 delete ideFileDialogLocation;
446 delete ideProjectFileDialogLocation;
447 delete displayDriver;
450 void ForcePathSeparatorStyle(bool unixStyle)
454 from = '\\', to = '/';
456 from = '/', to = '\\';
457 if(compilerConfigs && compilerConfigs.count)
460 for(config : compilerConfigs)
462 if(config.includeDirs && config.includeDirs.count)
464 for(i = 0; i < config.includeDirs.count; i++)
466 if(config.includeDirs[i] && config.includeDirs[i][0])
467 ChangeCh(config.includeDirs[i], from, to);
470 if(config.libraryDirs && config.libraryDirs.count)
472 for(i = 0; i < config.libraryDirs.count; i++)
474 if(config.libraryDirs[i] && config.libraryDirs[i][0])
475 ChangeCh(config.libraryDirs[i], from, to);
478 if(config.executableDirs && config.executableDirs.count)
480 for(i = 0; i < config.executableDirs.count; i++)
482 if(config.executableDirs[i] && config.executableDirs[i][0])
483 ChangeCh(config.executableDirs[i], from, to);
488 if(recentFiles && recentFiles.count)
491 for(c = 0; c < recentFiles.count; c++)
493 if(recentFiles[c] && recentFiles[c][0])
494 ChangeCh(recentFiles[c], from, to);
497 if(recentProjects && recentProjects.count)
500 for(c = 0; c < recentProjects.count; c++)
502 if(recentProjects[c] && recentProjects[c][0])
503 ChangeCh(recentProjects[c], from, to);
506 if(docDir && docDir[0])
507 ChangeCh(docDir, from, to);
508 if(ideFileDialogLocation && ideFileDialogLocation[0])
509 ChangeCh(ideFileDialogLocation, from, to);
510 if(ideProjectFileDialogLocation && ideProjectFileDialogLocation[0])
511 ChangeCh(ideProjectFileDialogLocation, from, to);
513 if(projectDefaultTargetDir && projectDefaultTargetDir[0])
514 ChangeCh(projectDefaultTargetDir, from, to);
515 if(projectDefaultIntermediateObjDir && projectDefaultIntermediateObjDir[0])
516 ChangeCh(projectDefaultIntermediateObjDir, from, to);
518 if(compilerConfigsDir && compilerConfigsDir[0])
519 ChangeCh(compilerConfigsDir, from, to);
522 void ManagePortablePaths(char * location, bool makeAbsolute)
525 if(compilerConfigs && compilerConfigs.count)
527 for(config : compilerConfigs)
530 for(t = 0; t < DirTypes::enumSize; t++)
532 Array<String> dirs = null;
533 if(t == executables) dirs = config.executableDirs;
534 else if(t == includes) dirs = config.includeDirs;
535 else if(t == libraries) dirs = config.libraryDirs;
536 if(dirs && dirs.count)
538 for(c = 0; c < dirs.count; c++)
540 if(dirs[c] && dirs[c][0])
541 dirs[c] = UpdatePortablePath(dirs[c], location, makeAbsolute);
547 if(recentFiles && recentFiles.count)
549 for(c = 0; c < recentFiles.count; c++)
551 if(recentFiles[c] && recentFiles[c][0])
552 recentFiles[c] = UpdatePortablePath(recentFiles[c], location, makeAbsolute);
555 if(recentProjects && recentProjects.count)
557 for(c = 0; c < recentProjects.count; c++)
559 if(recentProjects[c] && recentProjects[c][0])
560 recentProjects[c] = UpdatePortablePath(recentProjects[c], location, makeAbsolute);
563 if(docDir && docDir[0])
564 docDir = UpdatePortablePath(docDir, location, makeAbsolute);
565 if(ideFileDialogLocation && ideFileDialogLocation[0])
566 ideFileDialogLocation = UpdatePortablePath(ideFileDialogLocation, location, makeAbsolute);
567 if(ideProjectFileDialogLocation && ideProjectFileDialogLocation[0])
568 ideProjectFileDialogLocation = UpdatePortablePath(ideProjectFileDialogLocation, location, makeAbsolute);
570 if(projectDefaultTargetDir && projectDefaultTargetDir[0])
571 projectDefaultTargetDir = UpdatePortablePath(projectDefaultTargetDir, location, makeAbsolute);
572 if(projectDefaultIntermediateObjDir && projectDefaultIntermediateObjDir[0])
573 projectDefaultIntermediateObjDir = UpdatePortablePath(projectDefaultIntermediateObjDir, location, makeAbsolute);
575 if(compilerConfigsDir && compilerConfigsDir[0])
576 compilerConfigsDir = UpdatePortablePath(compilerConfigsDir, location, makeAbsolute);
579 char * UpdatePortablePath(char * path, char * location, bool makeAbsolute)
584 char p[MAX_LOCATION];
586 PathCatSlash(p, path);
588 output = CopyString(p);
592 PathRelationship rel = eString_PathRelated(path, location, null);
593 if(rel == subPath || rel == identical)
595 char p[MAX_LOCATION];
596 MakePathRelative(path, location, p);
597 if(!*p) strcpy(p, "./");
598 else ChangeCh(p, '\\', '/');
600 output = CopyString(p);
608 void AddRecentFile(char * fileName)
611 char * filePath = CopyString(fileName);
612 ChangeCh(filePath, '\\', '/');
613 for(c = 0; c<recentFiles.count; c++)
615 if(recentFiles[c] && !fstrcmp(recentFiles[c], filePath))
617 recentFiles.Delete((void *)&recentFiles[c]);
621 while(recentFiles.count >= MaxRecent)
622 recentFiles.Delete(recentFiles.GetLast());
623 recentFiles.Insert(null, filePath);
624 //UpdateRecentMenus(owner);
627 void AddRecentProject(char * projectName)
630 char * filePath = CopyString(projectName);
631 ChangeCh(filePath, '\\', '/');
632 for(c = 0; c<recentProjects.count; c++)
634 if(recentProjects[c] && !fstrcmp(recentProjects[c], filePath))
636 recentProjects.Delete((void *)&recentProjects[c]);
640 while(recentProjects.count >= MaxRecent)
641 recentProjects.Delete(recentProjects.GetLast());
642 recentProjects.Insert(null, filePath);
643 //UpdateRecentMenus(owner);
647 static const char * compilerTypeNames[CompilerType] = { "GCC", "TCC", "PCC", "VS8", "VS9", "VS10" };
648 static const char * compilerTypeVersionString[CompilerType] = { "", "", "", "8.00", "9.00", "10.00" };
649 static const char * compilerTypeSolutionFileVersionString[CompilerType] = { "", "", "", "9.00", "10.00", "11.00" };
650 static const char * compilerTypeYearString[CompilerType] = { "", "", "", "2005", "2008", "2010" };
651 static const char * compilerTypeProjectFileExtension[CompilerType] = { "", "", "", "vcproj", "vcproj", "vcxproj" };
652 // TODO: i18n with Array
653 static Array<String> compilerTypeLongNames
655 $"GNU Compiler Collection (GCC) / GNU Make",
656 $"Tiny C Compiler / GNU Make",
657 $"Portable C Compiler / GNU Make",
658 $"Microsoft Visual Studio 2005 (8.0) Compiler",
659 $"Microsoft Visual Studio 2008 (9.0) Compiler",
660 $"Microsoft Visual Studio 2010 (10.0) Compiler"
662 const CompilerType firstCompilerType = gcc;
663 const CompilerType lastCompilerType = vs10;
664 public enum CompilerType
666 gcc, tcc, pcc, vs8, vs9, vs10;
670 get { return this == vs8 || this == vs9 || this == vs10; }
675 get { return OnGetString(null, null, null); }
681 for(c = firstCompilerType; c <= lastCompilerType; c++)
682 if(!strcmpi(value, compilerTypeNames[c]))
689 property char * longName { get { return OnGetString(null, (void*)1, null); } };
690 property char * versionString { get { return OnGetString(null, (void*)2, null); } };
691 property char * yearString { get { return OnGetString(null, (void*)3, null); } };
692 property char * projectFileExtension { get { return OnGetString(null, (void*)4, null); } };
693 property char * solutionFileVersionString { get { return OnGetString(null, (void*)5, null); } };
695 char * OnGetString(char * tempString, void * fieldData, bool * needClass)
697 if(this >= firstCompilerType && this <= lastCompilerType)
700 strcpy(tempString, compilerTypeNames[this]);
701 if(fieldData == null)
702 return compilerTypeNames[this];
703 else if(fieldData == (void*)1)
704 return compilerTypeLongNames[this];
705 else if(fieldData == (void*)2)
706 return compilerTypeVersionString[this];
707 else if(fieldData == (void*)3)
708 return compilerTypeYearString[this];
709 else if(fieldData == (void*)4)
710 return compilerTypeProjectFileExtension[this];
711 else if(fieldData == (void*)5)
712 return compilerTypeSolutionFileVersionString[this];
730 name = CopyString(value);
736 Platform targetPlatform;
738 property char * makeCommand
740 set { delete makeCommand; if(value && value[0]) makeCommand = CopyString(value); }
741 get { return makeCommand; }
742 isset { return makeCommand && makeCommand[0]; }
744 property char * ecpCommand
746 set { delete ecpCommand; if(value && value[0]) ecpCommand = CopyString(value); }
747 get { return ecpCommand; }
748 isset { return ecpCommand && ecpCommand[0]; }
750 property char * eccCommand
752 set { delete eccCommand; if(value && value[0]) eccCommand = CopyString(value); }
753 get { return eccCommand; }
754 isset { return eccCommand && eccCommand[0]; }
756 property char * ecsCommand
758 set { delete ecsCommand; if(value && value[0]) ecsCommand = CopyString(value); }
759 get { return ecsCommand; }
760 isset { return ecsCommand && ecsCommand[0]; }
762 property char * earCommand
764 set { delete earCommand; if(value && value[0]) earCommand = CopyString(value); }
765 get { return earCommand; }
766 isset { return earCommand && earCommand[0]; }
768 property char * cppCommand
770 set { delete cppCommand; if(value && value[0]) cppCommand = CopyString(value); }
771 get { return cppCommand; }
772 isset { return cppCommand && cppCommand[0]; }
774 property char * ccCommand
776 set { delete ccCommand; if(value && value[0]) ccCommand = CopyString(value); }
777 get { return ccCommand; }
778 isset { return ccCommand && ccCommand[0]; }
780 property char * cxxCommand
782 set { delete cxxCommand; if(value && value[0]) cxxCommand = CopyString(value); }
783 get { return cxxCommand; }
784 isset { return cxxCommand && cxxCommand[0]; }
786 property char * execPrefixCommand // <-- old name for json ide settings file compatibility
788 set { delete executableLauncher; if(value && value[0]) executableLauncher = CopyString(value); }
789 get { return executableLauncher; }
790 isset { return executableLauncher && executableLauncher[0]; }
792 // TODO: implement CompilerConfig::windresCommand
796 property bool supportsBitDepth { set { } get { return true; } isset { return false; } }
798 property char * distccHosts
800 set { delete distccHosts; if(value && value[0]) distccHosts = CopyString(value); }
801 get { return distccHosts; }
802 isset { return distccHosts && distccHosts[0]; }
804 property char * gccPrefix // <-- old name for json ide settings file compatibility
806 set { delete gnuToolchainPrefix; if(value && value[0]) gnuToolchainPrefix = CopyString(value); }
807 get { return gnuToolchainPrefix; }
808 isset { return gnuToolchainPrefix && gnuToolchainPrefix[0]; }
810 property char * sysroot
812 set { delete sysroot; if(value && value[0]) sysroot = CopyString(value); }
813 get { return sysroot; }
814 isset { return sysroot && sysroot[0]; }
816 property Array<String> includeDirs
827 get { return includeDirs; }
828 isset { return includeDirs.count != 0; }
830 property Array<String> libraryDirs
841 get { return libraryDirs; }
842 isset { return libraryDirs.count != 0; }
844 property Array<String> executableDirs
848 executableDirs.Free();
851 delete executableDirs;
852 executableDirs = value;
855 get { return executableDirs; }
856 isset { return executableDirs.count != 0; }
858 property Array<NamedString> environmentVars
862 environmentVars.Free();
865 delete environmentVars;
866 environmentVars = value;
869 get { return environmentVars; }
870 isset { return environmentVars.count != 0; }
872 property Array<String> prepDirectives
876 prepDirectives.Free();
879 delete prepDirectives;
880 prepDirectives = value;
883 get { return prepDirectives; }
884 isset { return prepDirectives.count != 0; }
886 property Array<String> excludeLibs
897 get { return excludeLibs; }
898 isset { return excludeLibs.count != 0; }
900 property Array<String> compilerFlags
904 compilerFlags.Free();
907 delete compilerFlags;
908 compilerFlags = value;
911 get { return compilerFlags; }
912 isset { return compilerFlags.count != 0; }
914 property Array<String> linkerFlags
925 get { return linkerFlags; }
926 isset { return linkerFlags.count != 0; }
929 Array<String> includeDirs { };
930 Array<String> libraryDirs { };
931 Array<String> executableDirs { };
932 // TODO: Can JSON parse and serialize maps?
933 //EnvironmentVariables { };
934 Array<NamedString> environmentVars { };
935 Array<String> prepDirectives { };
936 Array<String> excludeLibs { };
937 Array<String> compilerFlags { };
938 Array<String> linkerFlags { };
948 char * executableLauncher;
950 char * gnuToolchainPrefix;
954 struct { Array<String> includes, libraries, executables; };
955 Array<String> dirs[DirTypes];
969 delete executableLauncher;
971 delete gnuToolchainPrefix;
973 if(environmentVars) environmentVars.Free();
974 if(includeDirs) { includeDirs.Free(); }
975 if(libraryDirs) { libraryDirs.Free(); }
976 if(executableDirs) { executableDirs.Free(); }
977 if(prepDirectives) { prepDirectives.Free(); }
978 if(excludeLibs) { excludeLibs.Free(); }
979 if(compilerFlags) { compilerFlags.Free(); }
980 if(linkerFlags) { linkerFlags.Free(); }
982 CompilerConfig Copy()
1007 for(s : includeDirs) copy.includeDirs.Add(CopyString(s));
1008 for(s : libraryDirs) copy.libraryDirs.Add(CopyString(s));
1009 for(s : executableDirs) copy.executableDirs.Add(CopyString(s));
1010 for(ns : environmentVars) copy.environmentVars.Add(NamedString { name = ns.name, string = ns.string });
1011 for(s : prepDirectives) copy.prepDirectives.Add(CopyString(s));
1012 for(s : excludeLibs) copy.excludeLibs.Add(CopyString(s));
1013 for(s : compilerFlags) copy.compilerFlags.Add(CopyString(s));
1014 for(s : linkerFlags) copy.linkerFlags.Add(CopyString(s));