diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h index 695b98ab16..7b663a8653 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h @@ -802,8 +802,11 @@ protected: if (config.config [Ids::msvcModuleDefinitionFile].toString().isNotEmpty()) linker->setAttribute ("ModuleDefinitionFile", config.config [Ids::msvcModuleDefinitionFile].toString()); - String extraLinkerOptions (getExtraLinkerFlagsString()); + String externalLibraries (getExternalLibrariesString()); + if (externalLibraries.isNotEmpty()) + linker->setAttribute ("AdditionalDependencies", replacePreprocessorTokens (config, externalLibraries).trim()); + String extraLinkerOptions (getExtraLinkerFlagsString()); if (extraLinkerOptions.isNotEmpty()) linker->setAttribute ("AdditionalOptions", replacePreprocessorTokens (config, extraLinkerOptions).trim()); } @@ -817,6 +820,10 @@ protected: extraLinkerOptions << " /IMPLIB:" << getOutDirFile (config.getOutputFilename (".lib", true)); linker->setAttribute ("AdditionalOptions", replacePreprocessorTokens (config, extraLinkerOptions).trim()); + String externalLibraries (getExternalLibrariesString()); + if (externalLibraries.isNotEmpty()) + linker->setAttribute ("AdditionalDependencies", replacePreprocessorTokens (config, externalLibraries).trim()); + linker->setAttribute ("OutputFile", getOutDirFile (config.getOutputFilename (msvcTargetSuffix, false))); linker->setAttribute ("IgnoreDefaultLibraryNames", isDebug ? "libcmt.lib, msvcrt.lib" : ""); } @@ -1188,6 +1195,11 @@ protected: link->createNewChildElement ("EnableCOMDATFolding")->addTextElement ("true"); } + String externalLibraries (getExternalLibrariesString()); + if (externalLibraries.isNotEmpty()) + link->createNewChildElement ("AdditionalDependencies")->addTextElement (replacePreprocessorTokens (config, externalLibraries).trim() + + ";%(AdditionalDependencies)"); + String extraLinkerOptions (getExtraLinkerFlagsString()); if (extraLinkerOptions.isNotEmpty()) link->createNewChildElement ("AdditionalOptions")->addTextElement (replacePreprocessorTokens (config, extraLinkerOptions).trim() diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h index 227af49f83..b8a0c411ac 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h @@ -167,6 +167,13 @@ private: for (int i = 0; i < linuxLibs.size(); ++i) out << " -l" << linuxLibs[i]; + StringArray libraries; + libraries.addTokens (getExternalLibrariesString(), ";", "\"'"); + libraries.removeEmptyStrings(); + + if (libraries.size() != 0) + out << " -l" << replacePreprocessorTokens (config, libraries.joinIntoString (" -l")).trim(); + out << " " << replacePreprocessorTokens (config, getExtraLinkerFlagsString()).trim() << newLine; } diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h index d2d3de9027..388283ee8c 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h @@ -620,6 +620,14 @@ private: getLinkerFlagsForStaticLibrary (extraLibs.getReference(i), flags, librarySearchPaths); flags.add (replacePreprocessorTokens (config, getExtraLinkerFlagsString())); + + StringArray libraries; + libraries.addTokens (getExternalLibrariesString(), ";", "\"'"); + libraries.removeEmptyStrings (true); + + if (libraries.size() != 0) + flags.add (replacePreprocessorTokens (config, "-l" + libraries.joinIntoString (" -l")).trim()); + flags.removeEmptyStrings (true); } diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp index f8054f4b46..896f7cf004 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp @@ -204,10 +204,13 @@ bool ProjectExporter::shouldFileBeCompiledByDefault (const RelativePath& file) c void ProjectExporter::createPropertyEditors (PropertyListBuilder& props) { props.add (new TextPropertyComponent (getTargetLocationValue(), "Target Project Folder", 1024, false), - "The location of the folder in which the " + name + " project will be created. This path can be absolute, but it's much more sensible to make it relative to the jucer project directory."); + "The location of the folder in which the " + name + " project will be created. " + "This path can be absolute, but it's much more sensible to make it relative to the jucer project directory."); props.add (new TextPropertyComponent (getJuceFolderValue(), "Local JUCE folder", 1024, false), - "The location of the Juce library folder that the " + name + " project will use to when compiling. This can be an absolute path, or relative to the jucer project folder, but it must be valid on the filesystem of the machine you use to actually do the compiling."); + "The location of the Juce library folder that the " + name + " project will use to when compiling. " + "This can be an absolute path, or relative to the jucer project folder, but it must be valid on the " + "filesystem of the machine you use to actually do the compiling."); OwnedArray modules; ModuleList moduleList; @@ -221,9 +224,16 @@ void ProjectExporter::createPropertyEditors (PropertyListBuilder& props) "or new-lines to separate the items - to include a space or comma in a definition, precede it with a backslash."); props.add (new TextPropertyComponent (getExtraCompilerFlags(), "Extra compiler flags", 2048, true), - "Extra command-line flags to be passed to the compiler. This string can contain references to preprocessor definitions in the form ${NAME_OF_DEFINITION}, which will be replaced with their values."); + "Extra command-line flags to be passed to the compiler. This string can contain references to preprocessor definitions in the " + "form ${NAME_OF_DEFINITION}, which will be replaced with their values."); + props.add (new TextPropertyComponent (getExtraLinkerFlags(), "Extra linker flags", 2048, true), - "Extra command-line flags to be passed to the linker. You might want to use this for adding additional libraries. This string can contain references to preprocessor definitions in the form ${NAME_OF_VALUE}, which will be replaced with their values."); + "Extra command-line flags to be passed to the linker. You might want to use this for adding additional libraries. " + "This string can contain references to preprocessor definitions in the form ${NAME_OF_VALUE}, which will be replaced with their values."); + + props.add (new TextPropertyComponent (getExternalLibraries(), "External libraries to link", 2048, true), + "Additional libraries to link (one per line). You should not add any platform specific decoration to these names. " + "This string can contain references to preprocessor definitions in the form ${NAME_OF_VALUE}, which will be replaced with their values."); { OwnedArray images; diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h index d340bfeb0e..cf8ab5f35c 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h @@ -84,6 +84,9 @@ public: Value getExtraLinkerFlags() { return getSetting (Ids::extraLinkerFlags); } String getExtraLinkerFlagsString() const { return getSettingString (Ids::extraLinkerFlags).replaceCharacters ("\r\n", " "); } + Value getExternalLibraries() { return getSetting (Ids::externalLibraries); } + String getExternalLibrariesString() const { return getSettingString (Ids::externalLibraries).replaceCharacters ("\r\n", " ;"); } + Value getUserNotes() { return getSetting (Ids::userNotes); } // This adds the quotes, and may return angle-brackets, eg: or normal quotes. diff --git a/extras/Introjucer/Source/Utility/jucer_PresetIDs.h b/extras/Introjucer/Source/Utility/jucer_PresetIDs.h index 80ad74a62a..501e5e49de 100644 --- a/extras/Introjucer/Source/Utility/jucer_PresetIDs.h +++ b/extras/Introjucer/Source/Utility/jucer_PresetIDs.h @@ -55,6 +55,7 @@ namespace Ids DECLARE_ID (time); DECLARE_ID (extraCompilerFlags); DECLARE_ID (extraLinkerFlags); + DECLARE_ID (externalLibraries); DECLARE_ID (extraDefs); DECLARE_ID (projectType); DECLARE_ID (libraryType);