From bbc3a56b848a102b7cabb8b66ec8482054846c79 Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 2 Mar 2015 14:54:57 +0000 Subject: [PATCH] Introjucer: added module option flags for OSXLibs and iOSLibs --- .../jucer_ProjectExport_XCode.h | 16 +++++++++++--- .../Project Saving/jucer_ProjectExporter.h | 2 +- .../Source/Project/jucer_Module.cpp | 22 ++++++++++--------- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h index 36e2bf9506..923dcc2f64 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h @@ -631,11 +631,17 @@ private: return "(" + paths.joinIntoString (", ") + ")"; } + static String getLinkerFlagForLib (String library) + { + if (library.substring (0, 3) == "lib") + library = library.substring (3); + + return "-l" + library.upToLastOccurrenceOf (".", false, false); + } + void getLinkerFlagsForStaticLibrary (const RelativePath& library, StringArray& flags, StringArray& librarySearchPaths) const { - jassert (library.getFileNameWithoutExtension().substring (0, 3) == "lib"); - - flags.add ("-l" + library.getFileNameWithoutExtension().substring (3)); + flags.add (getLinkerFlagForLib (library.getFileNameWithoutExtension())); String searchPath (library.toUnixStyle().upToLastOccurrenceOf ("/", false, false)); @@ -666,7 +672,11 @@ private: flags.add (replacePreprocessorTokens (config, getExtraLinkerFlagsString())); flags.add (getExternalLibraryFlags (config)); + for (int i = 0; i < xcodeLibs.size(); ++i) + flags.add (getLinkerFlagForLib (xcodeLibs[i])); + flags.removeEmptyStrings (true); + flags.removeDuplicates (false); } StringArray getProjectSettings (const XcodeBuildConfiguration& config) const diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h index 23d0606a1e..6ddc35d008 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h @@ -165,7 +165,7 @@ public: String xcodeProductType, xcodeProductInstallPath, xcodeFileType; String xcodeOtherRezFlags, xcodeExcludedFiles64Bit; bool xcodeIsBundle, xcodeCreatePList, xcodeCanUseDwarf; - StringArray xcodeFrameworks; + StringArray xcodeFrameworks, xcodeLibs; Array xcodeExtraLibrariesDebug, xcodeExtraLibrariesRelease; Array xcodeExtraPListEntries; diff --git a/extras/Introjucer/Source/Project/jucer_Module.cpp b/extras/Introjucer/Source/Project/jucer_Module.cpp index 4ba59aeb93..813d4f9e82 100644 --- a/extras/Introjucer/Source/Project/jucer_Module.cpp +++ b/extras/Introjucer/Source/Project/jucer_Module.cpp @@ -325,6 +325,14 @@ void LibraryModule::createLocalHeaderWrapper (ProjectSaver& projectSaver, const } //============================================================================== +static void parseAndAddLibs (StringArray& libList, const String& libs) +{ + libList.addTokens (libs, ", ", StringRef()); + libList.trim(); + libList.sort (false); + libList.removeDuplicates (false); +} + void LibraryModule::prepareExporter (ProjectExporter& exporter, ProjectSaver& projectSaver) const { Project& project = exporter.getProject(); @@ -359,22 +367,16 @@ void LibraryModule::prepareExporter (ProjectExporter& exporter, ProjectSaver& pr const String frameworks (moduleInfo.moduleInfo [exporter.isOSX() ? "OSXFrameworks" : "iOSFrameworks"].toString()); exporter.xcodeFrameworks.addTokens (frameworks, ", ", StringRef()); + + parseAndAddLibs (exporter.xcodeLibs, moduleInfo.moduleInfo [exporter.isOSX() ? "OSXLibs" : "iOSLibs"].toString()); } else if (exporter.isLinux()) { - const String libs (moduleInfo.moduleInfo ["LinuxLibs"].toString()); - exporter.linuxLibs.addTokens (libs, ", ", StringRef()); - exporter.linuxLibs.trim(); - exporter.linuxLibs.sort (false); - exporter.linuxLibs.removeDuplicates (false); + parseAndAddLibs (exporter.linuxLibs, moduleInfo.moduleInfo ["LinuxLibs"].toString()); } else if (exporter.isCodeBlocks()) { - const String libs (moduleInfo.moduleInfo ["mingwLibs"].toString()); - exporter.mingwLibs.addTokens (libs, ", ", StringRef()); - exporter.mingwLibs.trim(); - exporter.mingwLibs.sort (false); - exporter.mingwLibs.removeDuplicates (false); + parseAndAddLibs (exporter.mingwLibs, moduleInfo.moduleInfo ["mingwLibs"].toString()); } if (moduleInfo.isPluginClient())