Skip to content

Commit 54813c8

Browse files
committed
Projucer: Make VS2026 the default exporter on Windows
1 parent 2a9c249 commit 54813c8

File tree

6 files changed

+65
-32
lines changed

6 files changed

+65
-32
lines changed

extras/Projucer/Source/Application/StartPage/jucer_ContentComponents.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class TemplateComponent final : public Component
179179

180180
ValueTreePropertyWithDefault projectNameValue { settingsTree, Ids::name, nullptr, "NewProject" },
181181
modulesValue { settingsTree, Ids::dependencies_, nullptr, projectTemplate.requiredModules, "," },
182-
exportersValue { settingsTree, Ids::exporters, nullptr, StringArray (ProjectExporter::getCurrentPlatformExporterTypeInfo().identifier.toString()), "," },
182+
exportersValue { settingsTree, Ids::exporters, nullptr, StringArray { ProjectExporter::getBestPlatformExporterIdentifier() }, "," },
183183
fileOptionsValue { settingsTree, Ids::file, nullptr, NewProjectTemplates::getVarForFileOption (projectTemplate.defaultFileOption) };
184184

185185
ValueTreePropertyWithDefaultWrapper modulePathValue;

extras/Projucer/Source/Application/Windows/jucer_PIPCreatorWindowComponent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ class PIPCreatorWindowComponent final : public Component,
335335
websiteValue { pipTree, Ids::website, nullptr },
336336
descriptionValue { pipTree, Ids::description, nullptr },
337337
dependenciesValue { pipTree, Ids::dependencies_, nullptr, getModulesRequiredForComponent(), "," },
338-
exportersValue { pipTree, Ids::exporters, nullptr, StringArray (ProjectExporter::getCurrentPlatformExporterTypeInfo().identifier.toString()), "," },
338+
exportersValue { pipTree, Ids::exporters, nullptr, StringArray { ProjectExporter::getBestPlatformExporterIdentifier() }, "," },
339339
moduleFlagsValue { pipTree, Ids::moduleFlags, nullptr, "JUCE_STRICT_REFCOUNTEDPOINTER=1" },
340340
definesValue { pipTree, Ids::defines, nullptr },
341341
typeValue { pipTree, Ids::type, nullptr, "Component" },

extras/Projucer/Source/Project/UI/jucer_HeaderComponent.cpp

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -127,39 +127,51 @@ void HeaderComponent::updateExporters()
127127
auto selectedExporter = getSelectedExporter();
128128

129129
exporterBox.clear();
130-
auto preferredExporterIndex = -1;
131130

132131
int i = 0;
132+
133133
for (Project::ExporterIterator exporter (*project); exporter.next(); ++i)
134134
{
135-
auto exporterName = exporter->getUniqueName();
136-
137-
exporterBox.addItem (exporterName, i + 1);
135+
const auto exporterName = exporter->getUniqueName();
136+
const auto id = i + 1;
137+
exporterBox.addItem (exporterName, id);
138138

139139
if (selectedExporter != nullptr && exporterName == selectedExporter->getUniqueName())
140-
exporterBox.setSelectedId (i + 1);
141-
142-
if (exporterName.contains (ProjectExporter::getCurrentPlatformExporterTypeInfo().displayName) && preferredExporterIndex == -1)
143-
preferredExporterIndex = i;
140+
exporterBox.setSelectedId (id);
144141
}
145142

146-
if (exporterBox.getSelectedItemIndex() == -1)
143+
const auto preferredExporterIndex = std::invoke ([&]
147144
{
148-
if (preferredExporterIndex == -1)
145+
std::vector<ProjectExporter::ExporterTypeInfo> infos;
146+
ProjectExporter::getCurrentPlatformExporterTypeInfos (infos);
147+
148+
for (const auto& info : infos)
149149
{
150-
i = 0;
151-
for (Project::ExporterIterator exporter (*project); exporter.next(); ++i)
150+
int index = 0;
151+
152+
for (Project::ExporterIterator exporter (*project); exporter.next(); ++index)
153+
{
154+
if (exporter->getUniqueName().contains (info.displayName))
155+
return index;
156+
}
157+
}
158+
159+
if (exporterBox.getSelectedItemIndex() == -1)
160+
{
161+
int index = 0;
162+
163+
for (Project::ExporterIterator exporter (*project); exporter.next(); ++index)
152164
{
153165
if (exporter->canLaunchProject())
154-
{
155-
preferredExporterIndex = i;
156-
break;
157-
}
166+
return index;
158167
}
159168
}
160169

170+
return -1;
171+
});
172+
173+
if (exporterBox.getSelectedItemIndex() == -1)
161174
exporterBox.setSelectedItemIndex (preferredExporterIndex != -1 ? preferredExporterIndex : 0);
162-
}
163175

164176
updateExporterButton();
165177
}

extras/Projucer/Source/Project/jucer_Project.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2661,7 +2661,8 @@ void Project::addNewExporter (const Identifier& exporterIdentifier)
26612661

26622662
void Project::createExporterForCurrentPlatform()
26632663
{
2664-
addNewExporter (ProjectExporter::getCurrentPlatformExporterTypeInfo().identifier);
2664+
if (const auto identifier = ProjectExporter::getBestPlatformExporterIdentifier(); identifier.isNotEmpty())
2665+
addNewExporter (identifier);
26652666
}
26662667

26672668
String Project::getUniqueTargetFolderSuffixForExporter (const Identifier& exporterIdentifier, const String& base)

extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.cpp

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,24 @@ ProjectExporter::ExporterTypeInfo ProjectExporter::getTypeInfoForExporter (const
116116
return {};
117117
}
118118

119-
ProjectExporter::ExporterTypeInfo ProjectExporter::getCurrentPlatformExporterTypeInfo()
120-
{
121-
#if JUCE_MAC
122-
return ProjectExporter::getTypeInfoForExporter (XcodeProjectExporter::getValueTreeTypeNameMac());
123-
#elif JUCE_WINDOWS
124-
return ProjectExporter::getTypeInfoForExporter (MSVCProjectExporterVC2022::getValueTreeTypeName());
125-
#elif JUCE_LINUX || JUCE_BSD
126-
return ProjectExporter::getTypeInfoForExporter (MakefileProjectExporter::getValueTreeTypeName());
127-
#else
128-
#error "unknown platform!"
129-
#endif
119+
void ProjectExporter::getCurrentPlatformExporterTypeInfos (std::vector<ExporterTypeInfo>& result)
120+
{
121+
const auto typeNames =
122+
#if JUCE_MAC
123+
{ XcodeProjectExporter::getValueTreeTypeNameMac(),
124+
XcodeProjectExporter::getValueTreeTypeNameiOS() };
125+
#elif JUCE_WINDOWS
126+
{ MSVCProjectExporterVC2026::getValueTreeTypeName(),
127+
MSVCProjectExporterVC2022::getValueTreeTypeName(),
128+
MSVCProjectExporterVC2019::getValueTreeTypeName() };
129+
#elif JUCE_LINUX || JUCE_BSD
130+
{ MakefileProjectExporter::getValueTreeTypeName() };
131+
#else
132+
#error "unknown platform!"
133+
#endif
134+
135+
for (const auto& typeName : typeNames)
136+
result.push_back (getTypeInfoForExporter (typeName));
130137
}
131138

132139
std::unique_ptr<ProjectExporter> ProjectExporter::createNewExporter (Project& project, const Identifier& exporterIdentifier)

extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,20 @@ class ProjectExporter : private Value::Listener
110110

111111
static std::vector<ExporterTypeInfo> getExporterTypeInfos();
112112
static ExporterTypeInfo getTypeInfoForExporter (const Identifier& exporterIdentifier);
113-
static ExporterTypeInfo getCurrentPlatformExporterTypeInfo();
113+
114+
/** Sorted by suitability, with the 'best' exporter for the current platform first. */
115+
static void getCurrentPlatformExporterTypeInfos (std::vector<ExporterTypeInfo>&);
116+
117+
static String getBestPlatformExporterIdentifier()
118+
{
119+
std::vector<ExporterTypeInfo> infos;
120+
getCurrentPlatformExporterTypeInfos (infos);
121+
122+
if (infos.empty())
123+
return {};
124+
125+
return infos.front().identifier.toString();
126+
}
114127

115128
static std::unique_ptr<ProjectExporter> createNewExporter (Project&, const Identifier& exporterIdentifier);
116129
static std::unique_ptr<ProjectExporter> createExporterFromSettings (Project&, const ValueTree& settings);

0 commit comments

Comments
 (0)