From 972f866c40a6af819e9049b7f03fb6f53dfa68d3 Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Mon, 3 Sep 2012 17:23:53 -0400 Subject: [PATCH] ide/Project: Added support for Linker Flags in the Compilers Configurations --- ide/locale/ide.pot | 114 +++++++++++++++++--------------- ide/src/IDESettings.ec | 17 +++++ ide/src/dialogs/GlobalSettingsDialog.ec | 42 +++++++++--- ide/src/project/Project.ec | 16 ++++- 4 files changed, 120 insertions(+), 69 deletions(-) diff --git a/ide/locale/ide.pot b/ide/locale/ide.pot index 6d27322..f82223f 100644 --- a/ide/locale/ide.pot +++ b/ide/locale/ide.pot @@ -74,19 +74,19 @@ msgstr "%s - %s%smakefile for %s config...\n" msgid "%s Compiler\n" msgstr "%s Compiler\n" -#: ./src/debugger/Debugger.ec:2877 +#: ./src/debugger/Debugger.ec:2879 msgid "%s Constructor, %s:%d\n" msgstr "%s Constructor, %s:%d\n" -#: ./src/debugger/Debugger.ec:2879 +#: ./src/debugger/Debugger.ec:2881 msgid "%s Destructor, %s:%d\n" msgstr "%s Destructor, %s:%d\n" -#: ./src/debugger/Debugger.ec:2881 +#: ./src/debugger/Debugger.ec:2883 msgid "%s Function, %s:%d\n" msgstr "%s Function, %s:%d\n" -#: ./src/debugger/Debugger.ec:2873 +#: ./src/debugger/Debugger.ec:2875 msgid "%s Method, %s:%d\n" msgstr "%s Method, %s:%d\n" @@ -94,7 +94,7 @@ msgstr "%s Method, %s:%d\n" msgid "%s Project" msgstr "%s Project" -#: ./src/debugger/Debugger.ec:2875 +#: ./src/debugger/Debugger.ec:2877 msgid "%s Property, %s:%d\n" msgstr "%s Property, %s:%d\n" @@ -233,6 +233,10 @@ msgstr "Additional Libraries" msgid "Additional Library Directories" msgstr "Additional Library Directories" +#: ./src/dialogs/GlobalSettingsDialog.ec:978 +msgid "Additional Linker flags:" +msgstr "Additional Linker flags:" + #: ./src/ProjectSettings.ec:1124 msgid "All" msgstr "All" @@ -508,11 +512,6 @@ msgstr "Condition" msgid "Configurations: " msgstr "Configurations: " -#: ./src/designer/CodeEditor.ec:38 -#: ./src/designer/CodeEditor.ec:39 -msgid "Consolas" -msgstr "Consolas" - #: ./src/ProjectSettings.ec:2039 msgid "Console Application" msgstr "Console Application" @@ -527,10 +526,15 @@ msgstr "Copy" msgid "Couldn't create file." msgstr "Couldn't create file." -#: ./src/debugger/Debugger.ec:2382 +#: ./src/debugger/Debugger.ec:2384 msgid "Couldn't read memory" msgstr "Couldn't read memory" +#: ./src/designer/CodeEditor.ec:35 +#: ./src/designer/CodeEditor.ec:36 +msgid "Courier New" +msgstr "Courier New" + #: ./src/dialogs/NewProjectDialog.ec:215 msgid "Create Form" msgstr "Create Form" @@ -552,23 +556,23 @@ msgstr "Debug Working Directory" msgid "Debuggable" msgstr "Debuggable" -#: ./src/debugger/Debugger.ec:3328 +#: ./src/debugger/Debugger.ec:3330 msgid "Debugger Error: No target process ID\n" msgstr "Debugger Error: No target process ID\n" -#: ./src/debugger/Debugger.ec:1893 +#: ./src/debugger/Debugger.ec:1895 msgid "Debugger Fatal Error: Couldn't get GDB process ID\n" msgstr "Debugger Fatal Error: Couldn't get GDB process ID\n" -#: ./src/debugger/Debugger.ec:1882 +#: ./src/debugger/Debugger.ec:1884 msgid "Debugger Fatal Error: Couldn't start GDB\n" msgstr "Debugger Fatal Error: Couldn't start GDB\n" -#: ./src/debugger/Debugger.ec:2678 +#: ./src/debugger/Debugger.ec:2680 msgid "Debugger Fatal Error: GDB lost\n" msgstr "Debugger Fatal Error: GDB lost\n" -#: ./src/debugger/Debugger.ec:2305 +#: ./src/debugger/Debugger.ec:2307 msgid "Debugger required for symbol evaluation in \"%s\"" msgstr "Debugger required for symbol evaluation in \"%s\"" @@ -576,17 +580,17 @@ msgstr "Debugger required for symbol evaluation in \"%s\"" msgid "Debugging compressed applications is not supported\n" msgstr "Debugging compressed applications is not supported\n" -#: ./src/debugger/Debugger.ec:1998 -#: ./src/debugger/Debugger.ec:2679 -#: ./src/debugger/Debugger.ec:3345 +#: ./src/debugger/Debugger.ec:2000 +#: ./src/debugger/Debugger.ec:2681 +#: ./src/debugger/Debugger.ec:3347 msgid "Debugging stopped\n" msgstr "Debugging stopped\n" -#: ./src/dialogs/GlobalSettingsDialog.ec:1129 +#: ./src/dialogs/GlobalSettingsDialog.ec:1149 msgid "Default Compiler" msgstr "Default Compiler" -#: ./src/dialogs/GlobalSettingsDialog.ec:1094 +#: ./src/dialogs/GlobalSettingsDialog.ec:1114 msgid "Default Intermediate Objects Directory" msgstr "Default Intermediate Objects Directory" @@ -594,7 +598,7 @@ msgstr "Default Intermediate Objects Directory" msgid "Default Name Space" msgstr "Default Name Space" -#: ./src/dialogs/GlobalSettingsDialog.ec:1081 +#: ./src/dialogs/GlobalSettingsDialog.ec:1101 msgid "Default Target Directory" msgstr "Default Target Directory" @@ -620,7 +624,7 @@ msgstr "Delete Folder" msgid "Deleting target and object files..." msgstr "Deleting target and object files..." -#: ./src/debugger/Debugger.ec:2299 +#: ./src/debugger/Debugger.ec:2301 msgid "Dereference failure for \"%s\"" msgstr "Dereference failure for \"%s\"" @@ -690,7 +694,7 @@ msgstr "Edit" msgid "Editor" msgstr "Editor" -#: ./src/debugger/Debugger.ec:2378 +#: ./src/debugger/Debugger.ec:2380 msgid "Empty string" msgstr "Empty string" @@ -728,11 +732,11 @@ msgstr "Error opening project file" msgid "Error writing project file" msgstr "Error writing project file" -#: ./src/debugger/Debugger.ec:2266 +#: ./src/debugger/Debugger.ec:2268 msgid "Error: Struct member not found for \"%s\"" msgstr "Error: Struct member not found for \"%s\"" -#: ./src/debugger/Debugger.ec:2490 +#: ./src/debugger/Debugger.ec:2492 msgid "Evaluation failed for \"%s\" of type \"%s\"" msgstr "Evaluation failed for \"%s\" of type \"%s\"" @@ -802,7 +806,7 @@ msgstr "File not in project error" msgid "File with same name already in project." msgstr "File with same name already in project." -#: ./src/project/Workspace.ec:1150 +#: ./src/project/Workspace.ec:1154 msgid "File%s not found" msgstr "File%s not found" @@ -986,7 +990,7 @@ msgstr "Include Files" msgid "Include Subdirectories" msgstr "Include Subdirectories" -#: ./src/debugger/Debugger.ec:2308 +#: ./src/debugger/Debugger.ec:2310 msgid "Incorrect debugger state for symbol evaluation in \"%s\"" msgstr "Incorrect debugger state for symbol evaluation in \"%s\"" @@ -1002,7 +1006,7 @@ msgstr "Initializing Debugger" msgid "Intermediate Objects Directory" msgstr "Intermediate Objects Directory" -#: ./src/debugger/Debugger.ec:2400 +#: ./src/debugger/Debugger.ec:2402 msgid "Invalid Enum Value" msgstr "Invalid Enum Value" @@ -1013,11 +1017,11 @@ msgstr "Invalid Enum Value" msgid "Invalid Source Directory" msgstr "Invalid Source Directory" -#: ./src/debugger/Debugger.ec:2462 +#: ./src/debugger/Debugger.ec:2464 msgid "Invalid Unicode Keypoint (0x%08X)" msgstr "Invalid Unicode Keypoint (0x%08X)" -#: ./src/debugger/Debugger.ec:2497 +#: ./src/debugger/Debugger.ec:2499 msgid "Invalid expression: \"%s\"" msgstr "Invalid expression: \"%s\"" @@ -1037,7 +1041,7 @@ msgstr "Keep caret visible (move along) when scrolling" msgid "Lead Architect and Developer" msgstr "Lead Architect and Developer" -#: ./src/dialogs/GlobalSettingsDialog.ec:959 +#: ./src/dialogs/GlobalSettingsDialog.ec:997 msgid "Libraries to exclude:" msgstr "Libraries to exclude:" @@ -1088,11 +1092,11 @@ msgstr "Makefile doesn't exist. " msgid "Match case" msgstr "Match case" -#: ./src/debugger/Debugger.ec:2286 +#: ./src/debugger/Debugger.ec:2288 msgid "Member \"%s\" not found in class \"%s\"" msgstr "Member \"%s\" not found in class \"%s\"" -#: ./src/debugger/Debugger.ec:2296 +#: ./src/debugger/Debugger.ec:2298 msgid "Memory can't be read at %s" msgstr "Memory can't be read at %s" @@ -1133,7 +1137,7 @@ msgstr "Microsoft Visual Studio 2010 (10.0) Compiler" msgid "Misc" msgstr "Misc" -#: ./src/debugger/Debugger.ec:2488 +#: ./src/debugger/Debugger.ec:2490 msgid "Missing property evaluation support for \"%s\"" msgstr "Missing property evaluation support for \"%s\"" @@ -1210,7 +1214,7 @@ msgstr "No Line Numbers" msgid "No Source Directory Provided" msgstr "No Source Directory Provided" -#: ./src/debugger/Debugger.ec:2091 +#: ./src/debugger/Debugger.ec:2093 msgid "No source file found for selected frame" msgstr "No source file found for selected frame" @@ -1227,11 +1231,11 @@ msgstr "Normal" msgid "Nothing to be found. Please specify at least one criteria." msgstr "Nothing to be found. Please specify at least one criteria." -#: ./src/debugger/Debugger.ec:2343 +#: ./src/debugger/Debugger.ec:2345 msgid "Null string" msgstr "Null string" -#: ./src/debugger/Debugger.ec:2311 +#: ./src/debugger/Debugger.ec:2313 msgid "Null type for \"%s\"" msgstr "Null type for \"%s\"" @@ -1353,7 +1357,7 @@ msgstr "Pre-build Commands" msgid "Preprocessor Definitions" msgstr "Preprocessor Definitions" -#: ./src/dialogs/GlobalSettingsDialog.ec:978 +#: ./src/dialogs/GlobalSettingsDialog.ec:959 msgid "Preprocessor directives:" msgstr "Preprocessor directives:" @@ -1370,7 +1374,7 @@ msgctxt "Menu" msgid "Project" msgstr "Project" -#: ./src/dialogs/GlobalSettingsDialog.ec:1075 +#: ./src/dialogs/GlobalSettingsDialog.ec:1095 #: ./src/dialogs/ProjectTabSettings.ec:8 msgid "Project" msgstr "Project" @@ -1736,7 +1740,7 @@ msgstr "Starting Debug" #: ./src/debugger/Debugger.ec:891 #: ./src/debugger/Debugger.ec:911 #: ./src/debugger/Debugger.ec:955 -#: ./src/debugger/Debugger.ec:1838 +#: ./src/debugger/Debugger.ec:1840 msgid "Starting debug mode\n" msgstr "Starting debug mode\n" @@ -1779,11 +1783,11 @@ msgstr "Stop" msgid "Strict Name Spaces" msgstr "Strict Name Spaces" -#: ./src/dialogs/GlobalSettingsDialog.ec:996 +#: ./src/dialogs/GlobalSettingsDialog.ec:1015 msgid "Supports forcing bit depth" msgstr "Supports forcing bit depth" -#: ./src/debugger/Debugger.ec:2262 +#: ./src/debugger/Debugger.ec:2264 msgid "Symbol \"%s\" not found" msgstr "Symbol \"%s\" not found" @@ -1824,7 +1828,7 @@ msgstr "Target Type" msgid "Target and object files deleted\n" msgstr "Target and object files deleted\n" -#: ./src/debugger/Debugger.ec:2737 +#: ./src/debugger/Debugger.ec:2739 msgid "Target doesn't contain debug information!\n" msgstr "Target doesn't contain debug information!\n" @@ -1862,7 +1866,7 @@ msgstr "The document %s was modified by another application.\nWould you like to msgid "The following file" msgstr "The following file" -#: ./src/project/Workspace.ec:1151 +#: ./src/project/Workspace.ec:1155 msgid "The following file%s could not be re-opened.%s" msgstr "The following file%s could not be re-opened.%s" @@ -1948,15 +1952,15 @@ msgstr "Unable to locate source file.\nWould you like to try again?" msgid "Unable to open file %s\n\n" msgstr "Unable to open file %s\n\n" -#: ./src/debugger/Debugger.ec:2302 +#: ./src/debugger/Debugger.ec:2304 msgid "Unknown error for \"%s\"" msgstr "Unknown error for \"%s\"" -#: ./src/debugger/Debugger.ec:3394 +#: ./src/debugger/Debugger.ec:3396 msgid "Unknown output" msgstr "Unknown output" -#: ./src/debugger/Debugger.ec:3372 +#: ./src/debugger/Debugger.ec:3374 msgid "Unknown prompt" msgstr "Unknown prompt" @@ -2042,7 +2046,7 @@ msgid "With contributions from..." msgstr "With contributions from..." #: ./src/dialogs/FindInFilesDialog.ec:441 -#: ./src/dialogs/GlobalSettingsDialog.ec:1123 +#: ./src/dialogs/GlobalSettingsDialog.ec:1143 #: ./src/dialogs/WorkspaceSettings.ec:6 msgid "Workspace" msgstr "Workspace" @@ -2051,11 +2055,11 @@ msgstr "Workspace" msgid "Workspace Files (*.ews)" msgstr "Workspace Files (*.ews)" -#: ./src/project/Workspace.ec:1118 +#: ./src/project/Workspace.ec:1122 msgid "Workspace Load File Error" msgstr "Workspace Load File Error" -#: ./src/project/Workspace.ec:1118 +#: ./src/project/Workspace.ec:1122 msgid "Workspace load file failed" msgstr "Workspace load file failed" @@ -2128,11 +2132,11 @@ msgstr "eC/C/C++ Files (*.ec, *.eh, *.c, *.cpp, *.cc, *.cxx, *.h, *.hpp, *.hh, * msgid "eC/C/C++ Source Files (*.ec, *.c, *.cpp, *.cc, *.cxx)" msgstr "eC/C/C++ Source Files (*.ec, *.c, *.cpp, *.cc, *.cxx)" -#: ./src/debugger/Debugger.ec:3538 +#: ./src/debugger/Debugger.ec:3540 msgid "err: Unable to create FIFO %s\n" msgstr "err: Unable to create FIFO %s\n" -#: ./src/debugger/Debugger.ec:3539 +#: ./src/debugger/Debugger.ec:3541 msgid "err: Unable to open FIFO %s for read\n" msgstr "err: Unable to open FIFO %s for read\n" @@ -2154,7 +2158,7 @@ msgstr "es" msgid "found" msgstr "found" -#: ./src/debugger/Debugger.ec:2891 +#: ./src/debugger/Debugger.ec:2893 msgid "inside %s, %s\n" msgstr "inside %s, %s\n" @@ -2183,7 +2187,7 @@ msgstr "s" msgid "s were " msgstr "s were " -#: ./src/debugger/Debugger.ec:2897 +#: ./src/debugger/Debugger.ec:2899 msgid "unknown source\n" msgstr "unknown source\n" diff --git a/ide/src/IDESettings.ec b/ide/src/IDESettings.ec index f01da3a..1f42573 100644 --- a/ide/src/IDESettings.ec +++ b/ide/src/IDESettings.ec @@ -858,6 +858,20 @@ public: get { return excludeLibs; } isset { return excludeLibs.count != 0; } } + property Array linkerFlags + { + set + { + linkerFlags.Free(); + if(value) + { + delete linkerFlags; + linkerFlags = value; + } + } + get { return linkerFlags; } + isset { return linkerFlags.count != 0; } + } private: Array includeDirs { }; Array libraryDirs { }; @@ -867,6 +881,7 @@ private: Array environmentVars { }; Array prepDirectives { }; Array excludeLibs { }; + Array linkerFlags { }; char * name; char * makeCommand; char * ecpCommand; @@ -904,6 +919,7 @@ private: if(executableDirs) { executableDirs.Free(); } if(prepDirectives) { prepDirectives.Free(); } if(excludeLibs) { excludeLibs.Free(); } + if(linkerFlags) { linkerFlags.Free(); } } CompilerConfig Copy() { @@ -934,6 +950,7 @@ private: for(ns : environmentVars) copy.environmentVars.Add(NamedString { name = ns.name, string = ns.string }); for(s : prepDirectives) copy.prepDirectives.Add(CopyString(s)); for(s : excludeLibs) copy.excludeLibs.Add(CopyString(s)); + for(s : linkerFlags) copy.linkerFlags.Add(CopyString(s)); incref copy; return copy; diff --git a/ide/src/dialogs/GlobalSettingsDialog.ec b/ide/src/dialogs/GlobalSettingsDialog.ec index dcd88e1..6a20880 100644 --- a/ide/src/dialogs/GlobalSettingsDialog.ec +++ b/ide/src/dialogs/GlobalSettingsDialog.ec @@ -917,7 +917,7 @@ class CompilerOptionsTab : CompilersSubTab Button distccEnabled { - this, text = $"Use distcc", hotKey = altD, position = { 8, 96 }; + this, text = $"Use distcc", hotKey = altD, position = { 158, 68 }; isCheckbox = true; bool NotifyClicked(Button button, int x, int y, Modifiers mods) @@ -934,11 +934,11 @@ class CompilerOptionsTab : CompilersSubTab } }; - Label distccHostsLabel { this, position = { 8, 124 }, labeledWindow = distccHosts }; + Label distccHostsLabel { this, position = { 8, 96 }, labeledWindow = distccHosts }; EditBox distccHosts { this, text = $"distcc hosts", hotKey = altH; - position = { 88, 120 }, size = { 300 }; + position = { 88, 92 }, size = { 300 }; bool NotifyModified(EditBox editBox) { @@ -953,10 +953,29 @@ class CompilerOptionsTab : CompilersSubTab } } - Label lblExcludedLibraries { this, position = { 8, 152 }, labeledWindow = excludedLibraries }; - StringListBox excludedLibraries + Label lblPrepDefs { this, position = { 8, 124 }, labeledWindow = prepDefs }; + StringListBox prepDefs { - this, text = $"Libraries to exclude:", hotKey = altX; + this, text = $"Preprocessor directives:", hotKey = altP; + position = { 148, 124 }, size = { 300 }; + + bool NotifyModified(EditBox editBox) + { + if(loadedCompiler) + { + CompilerConfig compiler = loadedCompiler; + compiler.prepDirectives = ((StringListBox)editBox).strings; + modifiedDocument = true; + compilersTab.modifiedDocument = true; + } + return true; + } + } + + Label lblLinkerFlags { this, position = { 8, 152 }, labeledWindow = linkerFlags }; + StringListBox linkerFlags + { + this, text = $"Additional Linker flags:", hotKey = altL; position = { 148, 152 }, size = { 300 }; bool NotifyModified(EditBox editBox) @@ -964,7 +983,7 @@ class CompilerOptionsTab : CompilersSubTab if(loadedCompiler) { CompilerConfig compiler = loadedCompiler; - compiler.excludeLibs = ((StringListBox)editBox).strings; + compiler.linkerFlags = ((StringListBox)editBox).strings; modifiedDocument = true; compilersTab.modifiedDocument = true; } @@ -972,10 +991,10 @@ class CompilerOptionsTab : CompilersSubTab } } - Label lblPrepDefs { this, position = { 8, 180 }, labeledWindow = prepDefs }; - StringListBox prepDefs + Label lblExcludedLibraries { this, position = { 8, 180 }, labeledWindow = excludedLibraries }; + StringListBox excludedLibraries { - this, text = $"Preprocessor directives:", hotKey = altP; + this, text = $"Libraries to exclude:", hotKey = altX; position = { 148, 180 }, size = { 300 }; bool NotifyModified(EditBox editBox) @@ -983,7 +1002,7 @@ class CompilerOptionsTab : CompilersSubTab if(loadedCompiler) { CompilerConfig compiler = loadedCompiler; - compiler.prepDirectives = ((StringListBox)editBox).strings; + compiler.excludeLibs = ((StringListBox)editBox).strings; modifiedDocument = true; compilersTab.modifiedDocument = true; } @@ -1037,6 +1056,7 @@ class CompilerOptionsTab : CompilersSubTab supportsBitDepth.checked = compiler.supportsBitDepth; prepDefs.strings = compiler.prepDirectives; excludedLibraries.strings = compiler.excludeLibs; + linkerFlags.strings = compiler.linkerFlags; labelTargetPlatform.disabled = disabled; targetPlatform.disabled = disabled; diff --git a/ide/src/project/Project.ec b/ide/src/project/Project.ec index 4605ab1..40f2189 100644 --- a/ide/src/project/Project.ec +++ b/ide/src/project/Project.ec @@ -1992,12 +1992,12 @@ private: f.Printf("# HARD CODED PLATFORM-SPECIFIC OPTIONS\n"); f.Printf("ifeq \"$(PLATFORM)\" \"linux\"\n"); //, PlatformToMakefileVariable(tux)); - f.Printf("OFLAGS += -Wl,--no-undefined\n"); + f.Printf("LDFLAGS += -Wl,--no-undefined\n"); f.Printf("endif\n\n"); // JF's f.Printf("ifeq \"$(PLATFORM)\" \"apple\"\n"); //%s\n", PlatformToMakefileVariable(apple)); - f.Printf("OFLAGS += -framework cocoa -framework OpenGL\n"); + f.Printf("LDFLAGS += -framework cocoa -framework OpenGL\n"); f.Printf("endif\n"); if(gccCompiler) @@ -2019,8 +2019,10 @@ private: } if(compiler.libraryDirs && compiler.libraryDirs.count) { - f.Printf("\nOFLAGS +="); + f.Printf("\nLDFLAGS +="); OutputListOption(f, "L", compiler.libraryDirs, lineEach, true); + // We would need a bool option to know whether we want to add to rpath as well... + // OutputListOption(f, "Wl,-rpath ", compiler.libraryDirs, lineEach, true); f.Printf("\n"); } if(compiler.excludeLibs && compiler.excludeLibs.count) @@ -2032,6 +2034,12 @@ private: f.Puts(l); } } + if(compiler.linkerFlags && compiler.linkerFlags.count) + { + f.Printf("\nLDFLAGS +="); + OutputListOption(f, "Wl,", compiler.linkerFlags, inPlace, true); + f.Printf("\n"); + } f.Printf("\nFORCE_64_BIT = %s", compiler.supportsBitDepth ? "-m64" : ""); f.Printf("\nFORCE_32_BIT = %s", compiler.supportsBitDepth ? "-m32" : ""); f.Printf("\n"); @@ -2199,6 +2207,7 @@ private: f.Printf("CECFLAGS =\n"); f.Printf("ECFLAGS =\n"); f.Printf("OFLAGS =\n"); + f.Printf("LDFLAGS =\n"); f.Printf("LIBS =\n"); f.Printf("\n"); @@ -2487,6 +2496,7 @@ private: if(options && options.libraryDirs) OutputListOption(f, "L", options.libraryDirs, lineEach, true); f.Printf("\n"); + f.Printf("OFLAGS += $(LDFLAGS)\n"); f.Printf("endif\n\n"); f.Printf("# TARGETS\n\n"); -- 1.8.3.1