Browse Source

Introjucer: added custom external libraries to link.

tags/2021-05-28
jules 13 years ago
parent
commit
54eebff76d
6 changed files with 46 additions and 5 deletions
  1. +13
    -1
      extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h
  2. +7
    -0
      extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h
  3. +8
    -0
      extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h
  4. +14
    -4
      extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp
  5. +3
    -0
      extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h
  6. +1
    -0
      extras/Introjucer/Source/Utility/jucer_PresetIDs.h

+ 13
- 1
extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h 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()


+ 7
- 0
extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h 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;
}


+ 8
- 0
extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h 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);
}


+ 14
- 4
extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp 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;


+ 3
- 0
extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h 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.


+ 1
- 0
extras/Introjucer/Source/Utility/jucer_PresetIDs.h 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);


Loading…
Cancel
Save