1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Introjucer: added custom external libraries to link.

This commit is contained in:
jules 2012-11-30 20:12:57 +00:00
parent 3c83383d0e
commit 54eebff76d
6 changed files with 46 additions and 5 deletions

View file

@ -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()

View file

@ -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;
}

View file

@ -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);
}

View file

@ -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<LibraryModule> 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<Project::Item> images;

View file

@ -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: <foo/bar.h> or normal quotes.

View file

@ -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);