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

Projucer: Add all format-specific plug-in files in juce_audio_plugin_client to correct targets in Visual Studio

This commit is contained in:
ed 2020-05-22 16:44:30 +01:00
parent b57509c4a2
commit 991ff626e1
2 changed files with 42 additions and 32 deletions

View file

@ -1184,16 +1184,31 @@ bool Project::shouldBuildTargetType (build_tools::ProjectType::Target::Type targ
return true;
}
static bool hasParentDirectory (File f, StringRef parentName)
{
for (int depth = 0; depth < 2; ++depth)
{
auto parent = f.getParentDirectory();
if (parent.getFileName() == parentName)
return true;
f = parent;
}
return false;
}
build_tools::ProjectType::Target::Type Project::getTargetTypeFromFilePath (const File& file, bool returnSharedTargetIfNoValidSuffix)
{
if (LibraryModule::CompileUnit::hasSuffix (file, "_AU")) return build_tools::ProjectType::Target::AudioUnitPlugIn;
else if (LibraryModule::CompileUnit::hasSuffix (file, "_AUv3")) return build_tools::ProjectType::Target::AudioUnitv3PlugIn;
else if (LibraryModule::CompileUnit::hasSuffix (file, "_AAX")) return build_tools::ProjectType::Target::AAXPlugIn;
else if (LibraryModule::CompileUnit::hasSuffix (file, "_RTAS")) return build_tools::ProjectType::Target::RTASPlugIn;
else if (LibraryModule::CompileUnit::hasSuffix (file, "_VST2")) return build_tools::ProjectType::Target::VSTPlugIn;
else if (LibraryModule::CompileUnit::hasSuffix (file, "_VST3")) return build_tools::ProjectType::Target::VST3PlugIn;
else if (LibraryModule::CompileUnit::hasSuffix (file, "_Standalone")) return build_tools::ProjectType::Target::StandalonePlugIn;
else if (LibraryModule::CompileUnit::hasSuffix (file, "_Unity")) return build_tools::ProjectType::Target::UnityPlugIn;
if (LibraryModule::CompileUnit::hasSuffix (file, "_AU") || hasParentDirectory (file, "AU")) return build_tools::ProjectType::Target::AudioUnitPlugIn;
else if (LibraryModule::CompileUnit::hasSuffix (file, "_AUv3") || hasParentDirectory (file, "AU")) return build_tools::ProjectType::Target::AudioUnitv3PlugIn;
else if (LibraryModule::CompileUnit::hasSuffix (file, "_AAX") || hasParentDirectory (file, "AAX")) return build_tools::ProjectType::Target::AAXPlugIn;
else if (LibraryModule::CompileUnit::hasSuffix (file, "_RTAS") || hasParentDirectory (file, "RTAS")) return build_tools::ProjectType::Target::RTASPlugIn;
else if (LibraryModule::CompileUnit::hasSuffix (file, "_VST2") || hasParentDirectory (file, "VST")) return build_tools::ProjectType::Target::VSTPlugIn;
else if (LibraryModule::CompileUnit::hasSuffix (file, "_VST3") || hasParentDirectory (file, "VST3")) return build_tools::ProjectType::Target::VST3PlugIn;
else if (LibraryModule::CompileUnit::hasSuffix (file, "_Standalone") || hasParentDirectory (file, "Standalone")) return build_tools::ProjectType::Target::StandalonePlugIn;
else if (LibraryModule::CompileUnit::hasSuffix (file, "_Unity") || hasParentDirectory (file, "Unity")) return build_tools::ProjectType::Target::UnityPlugIn;
return (returnSharedTargetIfNoValidSuffix ? build_tools::ProjectType::Target::SharedCodeTarget : build_tools::ProjectType::Target::unspecified);
}

View file

@ -770,25 +770,22 @@ public:
if (path.hasFileExtension (cOrCppFileExtensions) || path.hasFileExtension (asmFileExtensions))
{
if (targetType == SharedCodeTarget || projectItem.shouldBeCompiled())
auto* e = cpps.createNewChildElement ("ClCompile");
e->setAttribute ("Include", path.toWindowsStyle());
if (shouldUseStdCall (path))
e->createNewChildElement ("CallingConvention")->addTextElement ("StdCall");
if (projectItem.shouldBeCompiled())
{
auto* e = cpps.createNewChildElement ("ClCompile");
e->setAttribute ("Include", path.toWindowsStyle());
auto extraCompilerFlags = owner.compilerFlagSchemesMap[projectItem.getCompilerFlagSchemeString()].get().toString();
if (shouldUseStdCall (path))
e->createNewChildElement ("CallingConvention")->addTextElement ("StdCall");
if (projectItem.shouldBeCompiled())
{
auto extraCompilerFlags = owner.compilerFlagSchemesMap[projectItem.getCompilerFlagSchemeString()].get().toString();
if (extraCompilerFlags.isNotEmpty())
e->createNewChildElement ("AdditionalOptions")->addTextElement (extraCompilerFlags + " %(AdditionalOptions)");
}
else
{
e->createNewChildElement ("ExcludedFromBuild")->addTextElement ("true");
}
if (extraCompilerFlags.isNotEmpty())
e->createNewChildElement ("AdditionalOptions")->addTextElement (extraCompilerFlags + " %(AdditionalOptions)");
}
else
{
e->createNewChildElement ("ExcludedFromBuild")->addTextElement ("true");
}
}
else if (path.hasFileExtension (headerFileExtensions))
@ -853,7 +850,9 @@ public:
return filesWereAdded;
}
else if (projectItem.shouldBeAddedToTargetProject() && projectItem.shouldBeAddedToTargetExporter (getOwner()))
else if (projectItem.shouldBeAddedToTargetProject()
&& projectItem.shouldBeAddedToTargetExporter (getOwner())
&& getOwner().getProject().getTargetTypeFromFilePath (projectItem.getFile(), true) == targetType)
{
build_tools::RelativePath relativePath (projectItem.getFile(),
getOwner().getTargetFolder(),
@ -861,12 +860,8 @@ public:
jassert (relativePath.getRoot() == build_tools::RelativePath::buildTargetFolder);
if (getOwner().getProject().getTargetTypeFromFilePath (projectItem.getFile(), true) == targetType
&& (targetType == SharedCodeTarget || projectItem.shouldBeCompiled()))
{
addFileToFilter (relativePath, path.upToLastOccurrenceOf ("\\", false, false), cpps, headers, otherFiles);
return true;
}
addFileToFilter (relativePath, path.upToLastOccurrenceOf ("\\", false, false), cpps, headers, otherFiles);
return true;
}
return false;