1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-16 00:34:19 +00:00

Introjucer: avoided adding unnecessary .r files in plugin builds that don't target RTAS or AU.

This commit is contained in:
jules 2014-11-08 13:32:57 +00:00
parent 3e662da32b
commit 9191455677
4 changed files with 28 additions and 20 deletions

View file

@ -467,16 +467,6 @@ static bool exporterTargetMatches (const String& test, String target)
return false;
}
bool LibraryModule::fileTargetMatches (ProjectExporter& exporter, const String& target)
{
if (exporter.isXcode()) return exporterTargetMatches ("xcode", target);
if (exporter.isWindows()) return exporterTargetMatches ("msvc", target);
if (exporter.isLinux()) return exporterTargetMatches ("linux", target);
if (exporter.isAndroid()) return exporterTargetMatches ("android", target);
if (exporter.isCodeBlocks()) return exporterTargetMatches ("mingw", target);
return target.isEmpty();
}
struct FileSorter
{
static int compareElements (const File& f1, const File& f2)
@ -503,6 +493,30 @@ void LibraryModule::findWildcardMatches (const File& localModuleFolder, const St
result.addArray (tempList);
}
static bool fileTargetMatches (ProjectExporter& exporter, const String& target)
{
if (exporter.isXcode()) return exporterTargetMatches ("xcode", target);
if (exporter.isWindows()) return exporterTargetMatches ("msvc", target);
if (exporter.isLinux()) return exporterTargetMatches ("linux", target);
if (exporter.isAndroid()) return exporterTargetMatches ("android", target);
if (exporter.isCodeBlocks()) return exporterTargetMatches ("mingw", target);
return target.isEmpty();
}
static bool fileShouldBeAdded (ProjectExporter& exporter, const var& properties)
{
if (! fileTargetMatches (exporter, properties["target"].toString()))
return false;
if (properties["RTASOnly"] && ! shouldBuildRTAS (exporter.getProject()).getValue())
return false;
if (properties["AudioUnitOnly"] && ! shouldBuildAU (exporter.getProject()).getValue())
return false;
return true;
}
void LibraryModule::findAndAddCompiledCode (ProjectExporter& exporter, ProjectSaver& projectSaver,
const File& localModuleFolder, Array<File>& result) const
{
@ -515,8 +529,7 @@ void LibraryModule::findAndAddCompiledCode (ProjectExporter& exporter, ProjectSa
const var& file = files->getReference(i);
const String filename (file ["file"].toString());
if (filename.isNotEmpty()
&& fileTargetMatches (exporter, file ["target"].toString()))
if (filename.isNotEmpty() && fileShouldBeAdded (exporter, file))
{
const File compiledFile (localModuleFolder.getChildFile (filename));
result.add (compiledFile);