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

Projucer: Make VS2026 the default exporter on Windows

This commit is contained in:
reuk 2025-12-03 13:09:18 +00:00
parent 2a9c249aba
commit 54813c8937
No known key found for this signature in database
6 changed files with 65 additions and 32 deletions

View file

@ -179,7 +179,7 @@ private:
ValueTreePropertyWithDefault projectNameValue { settingsTree, Ids::name, nullptr, "NewProject" }, ValueTreePropertyWithDefault projectNameValue { settingsTree, Ids::name, nullptr, "NewProject" },
modulesValue { settingsTree, Ids::dependencies_, nullptr, projectTemplate.requiredModules, "," }, modulesValue { settingsTree, Ids::dependencies_, nullptr, projectTemplate.requiredModules, "," },
exportersValue { settingsTree, Ids::exporters, nullptr, StringArray (ProjectExporter::getCurrentPlatformExporterTypeInfo().identifier.toString()), "," }, exportersValue { settingsTree, Ids::exporters, nullptr, StringArray { ProjectExporter::getBestPlatformExporterIdentifier() }, "," },
fileOptionsValue { settingsTree, Ids::file, nullptr, NewProjectTemplates::getVarForFileOption (projectTemplate.defaultFileOption) }; fileOptionsValue { settingsTree, Ids::file, nullptr, NewProjectTemplates::getVarForFileOption (projectTemplate.defaultFileOption) };
ValueTreePropertyWithDefaultWrapper modulePathValue; ValueTreePropertyWithDefaultWrapper modulePathValue;

View file

@ -335,7 +335,7 @@ private:
websiteValue { pipTree, Ids::website, nullptr }, websiteValue { pipTree, Ids::website, nullptr },
descriptionValue { pipTree, Ids::description, nullptr }, descriptionValue { pipTree, Ids::description, nullptr },
dependenciesValue { pipTree, Ids::dependencies_, nullptr, getModulesRequiredForComponent(), "," }, dependenciesValue { pipTree, Ids::dependencies_, nullptr, getModulesRequiredForComponent(), "," },
exportersValue { pipTree, Ids::exporters, nullptr, StringArray (ProjectExporter::getCurrentPlatformExporterTypeInfo().identifier.toString()), "," }, exportersValue { pipTree, Ids::exporters, nullptr, StringArray { ProjectExporter::getBestPlatformExporterIdentifier() }, "," },
moduleFlagsValue { pipTree, Ids::moduleFlags, nullptr, "JUCE_STRICT_REFCOUNTEDPOINTER=1" }, moduleFlagsValue { pipTree, Ids::moduleFlags, nullptr, "JUCE_STRICT_REFCOUNTEDPOINTER=1" },
definesValue { pipTree, Ids::defines, nullptr }, definesValue { pipTree, Ids::defines, nullptr },
typeValue { pipTree, Ids::type, nullptr, "Component" }, typeValue { pipTree, Ids::type, nullptr, "Component" },

View file

@ -127,39 +127,51 @@ void HeaderComponent::updateExporters()
auto selectedExporter = getSelectedExporter(); auto selectedExporter = getSelectedExporter();
exporterBox.clear(); exporterBox.clear();
auto preferredExporterIndex = -1;
int i = 0; int i = 0;
for (Project::ExporterIterator exporter (*project); exporter.next(); ++i) for (Project::ExporterIterator exporter (*project); exporter.next(); ++i)
{ {
auto exporterName = exporter->getUniqueName(); const auto exporterName = exporter->getUniqueName();
const auto id = i + 1;
exporterBox.addItem (exporterName, i + 1); exporterBox.addItem (exporterName, id);
if (selectedExporter != nullptr && exporterName == selectedExporter->getUniqueName()) if (selectedExporter != nullptr && exporterName == selectedExporter->getUniqueName())
exporterBox.setSelectedId (i + 1); exporterBox.setSelectedId (id);
if (exporterName.contains (ProjectExporter::getCurrentPlatformExporterTypeInfo().displayName) && preferredExporterIndex == -1)
preferredExporterIndex = i;
} }
if (exporterBox.getSelectedItemIndex() == -1) const auto preferredExporterIndex = std::invoke ([&]
{ {
if (preferredExporterIndex == -1) std::vector<ProjectExporter::ExporterTypeInfo> infos;
ProjectExporter::getCurrentPlatformExporterTypeInfos (infos);
for (const auto& info : infos)
{ {
i = 0; int index = 0;
for (Project::ExporterIterator exporter (*project); exporter.next(); ++i)
for (Project::ExporterIterator exporter (*project); exporter.next(); ++index)
{ {
if (exporter->canLaunchProject()) if (exporter->getUniqueName().contains (info.displayName))
{ return index;
preferredExporterIndex = i;
break;
}
} }
} }
if (exporterBox.getSelectedItemIndex() == -1)
{
int index = 0;
for (Project::ExporterIterator exporter (*project); exporter.next(); ++index)
{
if (exporter->canLaunchProject())
return index;
}
}
return -1;
});
if (exporterBox.getSelectedItemIndex() == -1)
exporterBox.setSelectedItemIndex (preferredExporterIndex != -1 ? preferredExporterIndex : 0); exporterBox.setSelectedItemIndex (preferredExporterIndex != -1 ? preferredExporterIndex : 0);
}
updateExporterButton(); updateExporterButton();
} }

View file

@ -2661,7 +2661,8 @@ void Project::addNewExporter (const Identifier& exporterIdentifier)
void Project::createExporterForCurrentPlatform() void Project::createExporterForCurrentPlatform()
{ {
addNewExporter (ProjectExporter::getCurrentPlatformExporterTypeInfo().identifier); if (const auto identifier = ProjectExporter::getBestPlatformExporterIdentifier(); identifier.isNotEmpty())
addNewExporter (identifier);
} }
String Project::getUniqueTargetFolderSuffixForExporter (const Identifier& exporterIdentifier, const String& base) String Project::getUniqueTargetFolderSuffixForExporter (const Identifier& exporterIdentifier, const String& base)

View file

@ -116,17 +116,24 @@ ProjectExporter::ExporterTypeInfo ProjectExporter::getTypeInfoForExporter (const
return {}; return {};
} }
ProjectExporter::ExporterTypeInfo ProjectExporter::getCurrentPlatformExporterTypeInfo() void ProjectExporter::getCurrentPlatformExporterTypeInfos (std::vector<ExporterTypeInfo>& result)
{ {
#if JUCE_MAC const auto typeNames =
return ProjectExporter::getTypeInfoForExporter (XcodeProjectExporter::getValueTreeTypeNameMac()); #if JUCE_MAC
#elif JUCE_WINDOWS { XcodeProjectExporter::getValueTreeTypeNameMac(),
return ProjectExporter::getTypeInfoForExporter (MSVCProjectExporterVC2022::getValueTreeTypeName()); XcodeProjectExporter::getValueTreeTypeNameiOS() };
#elif JUCE_LINUX || JUCE_BSD #elif JUCE_WINDOWS
return ProjectExporter::getTypeInfoForExporter (MakefileProjectExporter::getValueTreeTypeName()); { MSVCProjectExporterVC2026::getValueTreeTypeName(),
#else MSVCProjectExporterVC2022::getValueTreeTypeName(),
#error "unknown platform!" MSVCProjectExporterVC2019::getValueTreeTypeName() };
#endif #elif JUCE_LINUX || JUCE_BSD
{ MakefileProjectExporter::getValueTreeTypeName() };
#else
#error "unknown platform!"
#endif
for (const auto& typeName : typeNames)
result.push_back (getTypeInfoForExporter (typeName));
} }
std::unique_ptr<ProjectExporter> ProjectExporter::createNewExporter (Project& project, const Identifier& exporterIdentifier) std::unique_ptr<ProjectExporter> ProjectExporter::createNewExporter (Project& project, const Identifier& exporterIdentifier)

View file

@ -110,7 +110,20 @@ public:
static std::vector<ExporterTypeInfo> getExporterTypeInfos(); static std::vector<ExporterTypeInfo> getExporterTypeInfos();
static ExporterTypeInfo getTypeInfoForExporter (const Identifier& exporterIdentifier); static ExporterTypeInfo getTypeInfoForExporter (const Identifier& exporterIdentifier);
static ExporterTypeInfo getCurrentPlatformExporterTypeInfo();
/** Sorted by suitability, with the 'best' exporter for the current platform first. */
static void getCurrentPlatformExporterTypeInfos (std::vector<ExporterTypeInfo>&);
static String getBestPlatformExporterIdentifier()
{
std::vector<ExporterTypeInfo> infos;
getCurrentPlatformExporterTypeInfos (infos);
if (infos.empty())
return {};
return infos.front().identifier.toString();
}
static std::unique_ptr<ProjectExporter> createNewExporter (Project&, const Identifier& exporterIdentifier); static std::unique_ptr<ProjectExporter> createNewExporter (Project&, const Identifier& exporterIdentifier);
static std::unique_ptr<ProjectExporter> createExporterFromSettings (Project&, const ValueTree& settings); static std::unique_ptr<ProjectExporter> createExporterFromSettings (Project&, const ValueTree& settings);