1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-08 23:24:19 +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" },
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) };
ValueTreePropertyWithDefaultWrapper modulePathValue;

View file

@ -335,7 +335,7 @@ private:
websiteValue { pipTree, Ids::website, nullptr },
descriptionValue { pipTree, Ids::description, nullptr },
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" },
definesValue { pipTree, Ids::defines, nullptr },
typeValue { pipTree, Ids::type, nullptr, "Component" },

View file

@ -127,39 +127,51 @@ void HeaderComponent::updateExporters()
auto selectedExporter = getSelectedExporter();
exporterBox.clear();
auto preferredExporterIndex = -1;
int i = 0;
for (Project::ExporterIterator exporter (*project); exporter.next(); ++i)
{
auto exporterName = exporter->getUniqueName();
exporterBox.addItem (exporterName, i + 1);
const auto exporterName = exporter->getUniqueName();
const auto id = i + 1;
exporterBox.addItem (exporterName, id);
if (selectedExporter != nullptr && exporterName == selectedExporter->getUniqueName())
exporterBox.setSelectedId (i + 1);
if (exporterName.contains (ProjectExporter::getCurrentPlatformExporterTypeInfo().displayName) && preferredExporterIndex == -1)
preferredExporterIndex = i;
exporterBox.setSelectedId (id);
}
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;
for (Project::ExporterIterator exporter (*project); exporter.next(); ++i)
int index = 0;
for (Project::ExporterIterator exporter (*project); exporter.next(); ++index)
{
if (exporter->canLaunchProject())
{
preferredExporterIndex = i;
break;
}
if (exporter->getUniqueName().contains (info.displayName))
return index;
}
}
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);
}
updateExporterButton();
}

View file

@ -2661,7 +2661,8 @@ void Project::addNewExporter (const Identifier& exporterIdentifier)
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)

View file

@ -116,17 +116,24 @@ ProjectExporter::ExporterTypeInfo ProjectExporter::getTypeInfoForExporter (const
return {};
}
ProjectExporter::ExporterTypeInfo ProjectExporter::getCurrentPlatformExporterTypeInfo()
void ProjectExporter::getCurrentPlatformExporterTypeInfos (std::vector<ExporterTypeInfo>& result)
{
#if JUCE_MAC
return ProjectExporter::getTypeInfoForExporter (XcodeProjectExporter::getValueTreeTypeNameMac());
#elif JUCE_WINDOWS
return ProjectExporter::getTypeInfoForExporter (MSVCProjectExporterVC2022::getValueTreeTypeName());
#elif JUCE_LINUX || JUCE_BSD
return ProjectExporter::getTypeInfoForExporter (MakefileProjectExporter::getValueTreeTypeName());
#else
#error "unknown platform!"
#endif
const auto typeNames =
#if JUCE_MAC
{ XcodeProjectExporter::getValueTreeTypeNameMac(),
XcodeProjectExporter::getValueTreeTypeNameiOS() };
#elif JUCE_WINDOWS
{ MSVCProjectExporterVC2026::getValueTreeTypeName(),
MSVCProjectExporterVC2022::getValueTreeTypeName(),
MSVCProjectExporterVC2019::getValueTreeTypeName() };
#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)

View file

@ -110,7 +110,20 @@ public:
static std::vector<ExporterTypeInfo> getExporterTypeInfos();
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> createExporterFromSettings (Project&, const ValueTree& settings);