Skip to content

Commit 9ab76d1

Browse files
committed
Allow outputting Platform conditions in output project.
Currently this feature is unused.
1 parent d6d75ee commit 9ab76d1

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

include/projectGenerator.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,8 @@ class ProjectGenerator
319319

320320
void outputSourceFileType(StaticList& fileList, const string& type, const string& filterType,
321321
string& projectTemplate, string& filterTemplate, StaticList& foundObjects, set<string>& foundFilters,
322-
bool checkExisting, bool staticOnly = false, bool sharedOnly = false) const;
322+
bool checkExisting, bool staticOnly = false, bool sharedOnly = false, bool bit32Only = false,
323+
bool bit64Only = false) const;
323324

324325
void outputSourceFiles(string& projectTemplate, string& filterTemplate);
325326

source/projectGenerator.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ bool ProjectGenerator::outputProject()
248248
if (!writeToFile(outFiltersFile, filtersFile, true)) {
249249
return false;
250250
}
251-
const bool winrtEnabled = m_configHelper.isConfigOptionEnabled("winrt") || m_configHelper.isConfigOptionEnabled("uwp");
251+
const bool winrtEnabled =
252+
m_configHelper.isConfigOptionEnabled("winrt") || m_configHelper.isConfigOptionEnabled("uwp");
252253
if (winrtEnabled) {
253254
outFiltersFile = m_configHelper.m_solutionDirectory + m_projectName + "_winrt.vcxproj.filters";
254255
if (!writeToFile(outFiltersFile, filtersFile, true)) {
@@ -620,8 +621,7 @@ bool ProjectGenerator::outputSolution()
620621
"ReleaseDLLStaticDeps", "ReleaseDLLWinRT", "ReleaseDLLWinRTStaticDeps", "ReleaseWinRT"};
621622
vector<string> buildConfigsNoWinRT = {"Debug", "DebugDLL", "DebugDLL", "Debug", "Release", "ReleaseDLL",
622623
"ReleaseDLLStaticDeps", "ReleaseDLL", "ReleaseDLLStaticDeps", "Release"};
623-
vector<string> buildConfigsWinRT = {"DebugWinRT", "DebugDLLWinRT", "DebugDLLWinRT", "DebugWinRT",
624-
"ReleaseWinRT",
624+
vector<string> buildConfigsWinRT = {"DebugWinRT", "DebugDLLWinRT", "DebugDLLWinRT", "DebugWinRT", "ReleaseWinRT",
625625
"ReleaseDLLWinRT", "ReleaseDLLWinRTStaticDeps", "ReleaseDLLWinRT", "ReleaseDLLWinRTStaticDeps", "ReleaseWinRT"};
626626
if (!winrtEnabled) {
627627
buildConfigs = {"Debug", "DebugDLL", "Release", "ReleaseDLL", "ReleaseDLLStaticDeps"};
@@ -829,7 +829,7 @@ void ProjectGenerator::outputPropsTags(string& projectTemplate) const
829829

830830
void ProjectGenerator::outputSourceFileType(StaticList& fileList, const string& type, const string& filterType,
831831
string& projectTemplate, string& filterTemplate, StaticList& foundObjects, set<string>& foundFilters,
832-
bool checkExisting, bool staticOnly, bool sharedOnly) const
832+
bool checkExisting, bool staticOnly, bool sharedOnly, bool bit32Only, bool bit64Only) const
833833
{
834834
// Declare constant strings used in output files
835835
const string itemGroup = "\r\n <ItemGroup>";
@@ -844,6 +844,7 @@ void ProjectGenerator::outputSourceFileType(StaticList& fileList, const string&
844844
const string source = filterType + " Files";
845845
const string filterEnd = "</Filter>";
846846
const string excludeConfig = "\r\n <ExcludedFromBuild Condition=\"'$(Configuration)'=='";
847+
const string excludeConfigPlatform = "\r\n <ExcludedFromBuild Condition=\"'$(Platform)'=='";
847848
const string buildConfigsStatic[] = {"Release", "Debug", "ReleaseWinRT", "DebugWinRT"};
848849
const string buildConfigsShared[] = {"ReleaseDLL", "ReleaseDLLStaticDeps", "DebugDLL", "ReleaseDLLWinRT",
849850
"ReleaseDLLWinRTStaticDeps", "DebugDLLWinRT"};
@@ -908,6 +909,16 @@ void ProjectGenerator::outputSourceFileType(StaticList& fileList, const string&
908909
typeFilesTemp += buildConfig[j];
909910
typeFilesTemp += excludeConfigEnd;
910911
}
912+
} else if (bit32Only || bit64Only) {
913+
typeFilesTemp += includeClose;
914+
closed = true;
915+
typeFilesTemp += excludeConfigPlatform;
916+
if (bit32Only) {
917+
typeFilesTemp += "Win32";
918+
} else if (bit64Only) {
919+
typeFilesTemp += "x64";
920+
}
921+
typeFilesTemp += excludeConfigEnd;
911922
}
912923

913924
// Several input source files have the same name so we need to explicitly specify an output object file
@@ -980,7 +991,7 @@ void ProjectGenerator::outputSourceFiles(string& projectTemplate, string& filter
980991
}
981992
}
982993

983-
// Ouptut RC files
994+
// Output RC files
984995
outputSourceFileType(m_includesRC, "ResourceCompile", "Resource", projectTemplate, filterTemplate, foundObjects,
985996
foundFilters, false, false, true);
986997

0 commit comments

Comments
 (0)