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

Modules: Update JUCE module format for improved consistency

This commit is contained in:
Anthony Nicholls 2023-03-24 17:13:18 +00:00 committed by reuk
parent 05d5c94990
commit c04354e1ee
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
4 changed files with 38 additions and 41 deletions

View file

@ -266,15 +266,20 @@ void LibraryModule::findBrowseableFiles (const File& folder, Array<File>& filesF
bool LibraryModule::CompileUnit::isNeededForExporter (ProjectExporter& exporter) const
{
if ((hasSuffix (file, "_osx") && ! exporter.isOSX())
|| (hasSuffix (file, "_mac") && ! exporter.isOSX())
|| (hasSuffix (file, "_ios") && ! exporter.isiOS())
|| (hasSuffix (file, "_windows") && ! exporter.isWindows())
|| (hasSuffix (file, "_linux") && ! exporter.isLinux())
|| (hasSuffix (file, "_android") && ! exporter.isAndroid()))
return false;
const auto trimmedFileNameLowercase = file.getFileNameWithoutExtension().toLowerCase();
auto targetType = Project::getTargetTypeFromFilePath (file, false);
const std::tuple<const char*, bool> shouldBuildForSuffix[] { { "_android", exporter.isAndroid() },
{ "_ios", exporter.isiOS() },
{ "_linux", exporter.isLinux() },
{ "_mac", exporter.isOSX() },
{ "_osx", exporter.isOSX() },
{ "_windows", exporter.isWindows() } };
for (const auto& [suffix, shouldBuild] : shouldBuildForSuffix)
if (trimmedFileNameLowercase.endsWith (suffix))
return shouldBuild;
const auto targetType = Project::getTargetTypeFromFilePath (file, false);
if (targetType != build_tools::ProjectType::Target::unspecified && ! exporter.shouldBuildTargetType (targetType))
return false;
@ -288,14 +293,6 @@ String LibraryModule::CompileUnit::getFilenameForProxyFile() const
return "include_" + file.getFileName();
}
bool LibraryModule::CompileUnit::hasSuffix (const File& f, const char* suffix)
{
auto fileWithoutSuffix = f.getFileNameWithoutExtension() + ".";
return fileWithoutSuffix.containsIgnoreCase (suffix + String ("."))
|| fileWithoutSuffix.containsIgnoreCase (suffix + String ("_"));
}
Array<LibraryModule::CompileUnit> LibraryModule::getAllCompileUnits (build_tools::ProjectType::Target::Type forTarget) const
{
auto files = getFolder().findChildFiles (File::findFiles, false);