CREATE_PROJECT: Old Visual Studio doesn't support ARM64

This commit is contained in:
SupSuper 2020-07-13 06:30:06 +01:00 committed by Eugene Sandulenko
parent 7a5c4e6121
commit ef803ee080
4 changed files with 113 additions and 165 deletions

View File

@ -35,7 +35,6 @@ namespace CreateProjectTool {
MSBuildProvider::MSBuildProvider(StringList &global_warnings, std::map<std::string, StringList> &project_warnings, const int version, const MSVCVersion& msvc)
: MSVCProvider(global_warnings, project_warnings, version, msvc) {
// NOTE: different order
_archs.push_back(ARCH_X86);
_archs.push_back(ARCH_AMD64);
_archs.push_back(ARCH_ARM64);
@ -85,23 +84,23 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri
"<Project DefaultTargets=\"Build\" ToolsVersion=\"" << _msvcVersion.project << "\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
"\t<ItemGroup Label=\"ProjectConfigurations\">\n";
for (std::list<MSVC_Architecture>::const_iterator i = _archs.begin(); i != _archs.end(); ++i) {
outputConfiguration(project, "Debug", getMSVCConfigName(*i));
outputConfiguration(project, "Analysis", getMSVCConfigName(*i));
outputConfiguration(project, "LLVM", getMSVCConfigName(*i));
outputConfiguration(project, "Release", getMSVCConfigName(*i));
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
outputConfiguration(project, "Debug", getMSVCConfigName(*arch));
outputConfiguration(project, "Analysis", getMSVCConfigName(*arch));
outputConfiguration(project, "LLVM", getMSVCConfigName(*arch));
outputConfiguration(project, "Release", getMSVCConfigName(*arch));
}
project << "\t</ItemGroup>\n";
// Project name & Guid
project << "\t<PropertyGroup Label=\"Globals\">\n"
"\t\t<ProjectGuid>{" << uuid << "}</ProjectGuid>\n"
"\t\t<RootNamespace>" << name << "</RootNamespace>\n"
"\t\t<Keyword>Win32Proj</Keyword>\n"
"\t\t<VCTargetsPath Condition=\"'$(VCTargetsPath" << _version << ")' != '' and '$(VSVersion)' == '' and $(VisualStudioVersion) == ''\">$(VCTargetsPath" << _version << ")</VCTargetsPath>\n";
"\t\t<ProjectGuid>{" << uuid << "}</ProjectGuid>\n"
"\t\t<RootNamespace>" << name << "</RootNamespace>\n"
"\t\t<Keyword>Win32Proj</Keyword>\n"
"\t\t<VCTargetsPath Condition=\"'$(VCTargetsPath" << _version << ")' != '' and '$(VSVersion)' == '' and $(VisualStudioVersion) == ''\">$(VCTargetsPath" << _version << ")</VCTargetsPath>\n";
for (std::list<MSVC_Architecture>::const_iterator i = _archs.begin(); i != _archs.end(); ++i) {
project << "\t\t<VcpkgTriplet Condition=\"'$(Platform)' == '" << getMSVCConfigName(*i) << "'\">" << getMSVCArchName(*i) << "-windows</VcpkgTriplet>";
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
project << "\t\t<VcpkgTriplet Condition=\"'$(Platform)' == '" << getMSVCConfigName(*arch) << "'\">" << getMSVCArchName(*arch) << "-windows</VcpkgTriplet>";
}
project << "\t</PropertyGroup>\n";
@ -109,39 +108,39 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri
// Shared configuration
project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n";
for (std::list<MSVC_Architecture>::const_iterator i = _archs.begin(); i != _archs.end(); ++i) {
outputConfigurationType(setup, project, name, "Release|" + getMSVCConfigName(*i), _msvcVersion.toolsetMSVC);
outputConfigurationType(setup, project, name, "Analysis" + getMSVCConfigName(*i), _msvcVersion.toolsetMSVC);
outputConfigurationType(setup, project, name, "LLVM|" + getMSVCConfigName(*i), _msvcVersion.toolsetLLVM);
outputConfigurationType(setup, project, name, "Debug|" + getMSVCConfigName(*i), _msvcVersion.toolsetMSVC);
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
outputConfigurationType(setup, project, name, "Release|" + getMSVCConfigName(*arch), _msvcVersion.toolsetMSVC);
outputConfigurationType(setup, project, name, "Analysis" + getMSVCConfigName(*arch), _msvcVersion.toolsetMSVC);
outputConfigurationType(setup, project, name, "LLVM|" + getMSVCConfigName(*arch), _msvcVersion.toolsetLLVM);
outputConfigurationType(setup, project, name, "Debug|" + getMSVCConfigName(*arch), _msvcVersion.toolsetMSVC);
}
project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n"
"\t<ImportGroup Label=\"ExtensionSettings\">\n"
"\t</ImportGroup>\n";
for (std::list<MSVC_Architecture>::const_iterator i = _archs.begin(); i != _archs.end(); ++i) {
outputProperties(project, "Release|" + getMSVCConfigName(*i), setup.projectDescription + "_Release" + getMSVCArchName(*i) + ".props");
outputProperties(project, "Analysis|" + getMSVCConfigName(*i), setup.projectDescription + "_Analysis" + getMSVCArchName(*i) + ".props");
outputProperties(project, "LLVM|" + getMSVCConfigName(*i), setup.projectDescription + "_LLVM" + getMSVCArchName(*i) + ".props");
outputProperties(project, "Debug|" + getMSVCConfigName(*i), setup.projectDescription + "_Debug" + getMSVCArchName(*i) + ".props");
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
outputProperties(project, "Release|" + getMSVCConfigName(*arch), setup.projectDescription + "_Release" + getMSVCArchName(*arch) + ".props");
outputProperties(project, "Analysis|" + getMSVCConfigName(*arch), setup.projectDescription + "_Analysis" + getMSVCArchName(*arch) + ".props");
outputProperties(project, "LLVM|" + getMSVCConfigName(*arch), setup.projectDescription + "_LLVM" + getMSVCArchName(*arch) + ".props");
outputProperties(project, "Debug|" + getMSVCConfigName(*arch), setup.projectDescription + "_Debug" + getMSVCArchName(*arch) + ".props");
}
project << "\t<PropertyGroup Label=\"UserMacros\" />\n";
// Project-specific settings (analysis uses debug properties)
for (std::list<MSVC_Architecture>::const_iterator i = _archs.begin(); i != _archs.end(); ++i) {
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
BuildSetup archsetup = setup;
std::map<MSVC_Architecture, StringList>::const_iterator disabled_features_it = _arch_disabled_features.find(*i);
std::map<MSVC_Architecture, StringList>::const_iterator disabled_features_it = _arch_disabled_features.find(*arch);
if (disabled_features_it != _arch_disabled_features.end()) {
for (StringList::const_iterator j = disabled_features_it->second.begin(); j != disabled_features_it->second.end(); ++j) {
archsetup = removeFeatureFromSetup(archsetup, *j);
}
}
outputProjectSettings(project, name, archsetup, false, *i, "Debug");
outputProjectSettings(project, name, archsetup, false, *i, "Analysis");
outputProjectSettings(project, name, archsetup, false, *i, "LLVM");
outputProjectSettings(project, name, archsetup, true, *i, "Release");
outputProjectSettings(project, name, archsetup, false, *arch, "Debug");
outputProjectSettings(project, name, archsetup, false, *arch, "Analysis");
outputProjectSettings(project, name, archsetup, false, *arch, "LLVM");
outputProjectSettings(project, name, archsetup, true, *arch, "Release");
}
// Files

View File

@ -85,47 +85,29 @@ void MSVCProvider::createWorkspace(const BuildSetup &setup) {
}
solution << "Global\n"
"\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n"
"\t\tDebug|Win32 = Debug|Win32\n"
"\t\tAnalysis|Win32 = Analysis|Win32\n"
"\t\tLLVM|Win32 = LLVM|Win32\n"
"\t\tRelease|Win32 = Release|Win32\n"
"\t\tDebug|x64 = Debug|x64\n"
"\t\tAnalysis|x64 = Analysis|x64\n"
"\t\tLLVM|x64 = LLVM|x64\n"
"\t\tRelease|x64 = Release|x64\n"
"\t\tDebug|arm64 = Debug|arm64\n"
"\t\tAnalysis|arm64 = Analysis|arm64\n"
"\t\tLLVM|arm64 = LLVM|arm64\n"
"\t\tRelease|arm64 = Release|arm64\n"
"\tEndGlobalSection\n"
"\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n";
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
solution << "\t\tDebug|" << getMSVCConfigName(*arch) << " = Debug|" << getMSVCConfigName(*arch) << "\n"
"\t\tAnalysis|" << getMSVCConfigName(*arch) << " = Analysis|" << getMSVCConfigName(*arch) << "\n"
"\t\tLLVM|" << getMSVCConfigName(*arch) << " = LLVM|" << getMSVCConfigName(*arch) << "\n"
"\t\tRelease|" << getMSVCConfigName(*arch) << " = Release|" << getMSVCConfigName(*arch) << "\n";
}
solution << "\tEndGlobalSection\n"
"\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n";
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
solution << "\t\t{" << i->second << "}.Debug|Win32.ActiveCfg = Debug|Win32\n"
"\t\t{" << i->second << "}.Debug|Win32.Build.0 = Debug|Win32\n"
"\t\t{" << i->second << "}.Analysis|Win32.ActiveCfg = Analysis|Win32\n"
"\t\t{" << i->second << "}.Analysis|Win32.Build.0 = Analysis|Win32\n"
"\t\t{" << i->second << "}.LLVM|Win32.ActiveCfg = LLVM|Win32\n"
"\t\t{" << i->second << "}.LLVM|Win32.Build.0 = LLVM|Win32\n"
"\t\t{" << i->second << "}.Release|Win32.ActiveCfg = Release|Win32\n"
"\t\t{" << i->second << "}.Release|Win32.Build.0 = Release|Win32\n"
"\t\t{" << i->second << "}.Debug|x64.ActiveCfg = Debug|x64\n"
"\t\t{" << i->second << "}.Debug|x64.Build.0 = Debug|x64\n"
"\t\t{" << i->second << "}.Analysis|x64.ActiveCfg = Analysis|x64\n"
"\t\t{" << i->second << "}.Analysis|x64.Build.0 = Analysis|x64\n"
"\t\t{" << i->second << "}.LLVM|x64.ActiveCfg = LLVM|x64\n"
"\t\t{" << i->second << "}.LLVM|x64.Build.0 = LLVM|x64\n"
"\t\t{" << i->second << "}.Release|x64.ActiveCfg = Release|x64\n"
"\t\t{" << i->second << "}.Release|x64.Build.0 = Release|x64\n"
"\t\t{" << i->second << "}.Debug|arm64.ActiveCfg = Debug|arm64\n"
"\t\t{" << i->second << "}.Debug|arm64.Build.0 = Debug|arm64\n"
"\t\t{" << i->second << "}.Analysis|arm64.ActiveCfg = Analysis|arm64\n"
"\t\t{" << i->second << "}.Analysis|arm64.Build.0 = Analysis|arm64\n"
"\t\t{" << i->second << "}.LLVM|arm64.ActiveCfg = LLVM|arm64\n"
"\t\t{" << i->second << "}.LLVM|arm64.Build.0 = LLVM|arm64\n"
"\t\t{" << i->second << "}.Release|arm64.ActiveCfg = Release|arm64\n"
"\t\t{" << i->second << "}.Release|arm64.Build.0 = Release|arm64\n";
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
solution << "\t\t{" << i->second << "}.Debug|" << getMSVCConfigName(*arch) << ".ActiveCfg = Debug|" << getMSVCConfigName(*arch) << "\n"
"\t\t{" << i->second << "}.Debug|" << getMSVCConfigName(*arch) << ".Build.0 = Debug|" << getMSVCConfigName(*arch) << "\n"
"\t\t{" << i->second << "}.Analysis|" << getMSVCConfigName(*arch) << ".ActiveCfg = Analysis|" << getMSVCConfigName(*arch) << "\n"
"\t\t{" << i->second << "}.Analysis|" << getMSVCConfigName(*arch) << ".Build.0 = Analysis|" << getMSVCConfigName(*arch) << "\n"
"\t\t{" << i->second << "}.LLVM|" << getMSVCConfigName(*arch) << ".ActiveCfg = LLVM|" << getMSVCConfigName(*arch) << "\n"
"\t\t{" << i->second << "}.LLVM|" << getMSVCConfigName(*arch) << ".Build.0 = LLVM|" << getMSVCConfigName(*arch) << "\n"
"\t\t{" << i->second << "}.Release|" << getMSVCConfigName(*arch) << ".ActiveCfg = Release|" << getMSVCConfigName(*arch) << "\n"
"\t\t{" << i->second << "}.Release|" << getMSVCConfigName(*arch) << ".Build.0 = Release|" << getMSVCConfigName(*arch) << "\n";
}
}
solution << "\tEndGlobalSection\n"
@ -141,18 +123,12 @@ void MSVCProvider::createOtherBuildFiles(const BuildSetup &setup) {
// Create the configuration property files (for Debug and Release with 32 and 64bits versions)
// Note: we use the debug properties for the analysis configuration
createBuildProp(setup, true, ARCH_AMD64, "Release");
createBuildProp(setup, true, ARCH_X86, "Release");
createBuildProp(setup, true, ARCH_ARM64, "Release");
createBuildProp(setup, false, ARCH_AMD64, "Debug");
createBuildProp(setup, false, ARCH_X86, "Debug");
createBuildProp(setup, false, ARCH_ARM64, "Debug");
createBuildProp(setup, false, ARCH_AMD64, "Analysis");
createBuildProp(setup, false, ARCH_X86, "Analysis");
createBuildProp(setup, false, ARCH_ARM64, "Analysis");
createBuildProp(setup, false, ARCH_AMD64, "LLVM");
createBuildProp(setup, false, ARCH_X86, "LLVM");
createBuildProp(setup, false, ARCH_ARM64, "LLVM");
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
createBuildProp(setup, true, *arch, "Release");
createBuildProp(setup, false, *arch, "Debug");
createBuildProp(setup, false, *arch, "Analysis");
createBuildProp(setup, false, *arch, "LLVM");
}
}
void MSVCProvider::addResourceFiles(const BuildSetup &setup, StringList &includeList, StringList &excludeList) {
@ -161,41 +137,22 @@ void MSVCProvider::addResourceFiles(const BuildSetup &setup, StringList &include
}
void MSVCProvider::createGlobalProp(const BuildSetup &setup) {
std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_Global" + getMSVCArchName(ARCH_X86) + getPropertiesExtension()).c_str());
if (!properties)
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_Global" + getMSVCArchName(ARCH_X86) + getPropertiesExtension() + "\" for writing");
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_Global" + getMSVCArchName(*arch) + getPropertiesExtension()).c_str());
if (!properties)
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_Global" + getMSVCArchName(*arch) + getPropertiesExtension() + "\" for writing");
outputGlobalPropFile(setup, properties, ARCH_X86, setup.defines, convertPathToWin(setup.filePrefix), setup.runBuildEvents);
properties.close();
properties.open((setup.outputDir + '/' + setup.projectDescription + "_Global" + getMSVCArchName(ARCH_AMD64) + getPropertiesExtension()).c_str());
if (!properties)
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_Global" + getMSVCArchName(ARCH_AMD64) + getPropertiesExtension() + "\" for writing");
BuildSetup amd64setup = setup;
std::map<MSVC_Architecture, StringList>::const_iterator amd64_disabled_features_it = _arch_disabled_features.find(ARCH_AMD64);
if (amd64_disabled_features_it != _arch_disabled_features.end()) {
for (StringList::const_iterator feature = amd64_disabled_features_it->second.begin(); feature != amd64_disabled_features_it->second.end(); ++feature) {
amd64setup = removeFeatureFromSetup(amd64setup, *feature);
BuildSetup archSetup = setup;
std::map<MSVC_Architecture, StringList>::const_iterator arch_disabled_features_it = _arch_disabled_features.find(*arch);
if (arch_disabled_features_it != _arch_disabled_features.end()) {
for (StringList::const_iterator feature = arch_disabled_features_it->second.begin(); feature != arch_disabled_features_it->second.end(); ++feature) {
archSetup = removeFeatureFromSetup(archSetup, *feature);
}
}
outputGlobalPropFile(archSetup, properties, *arch, archSetup.defines, convertPathToWin(archSetup.filePrefix), archSetup.runBuildEvents);
properties.close();
}
outputGlobalPropFile(amd64setup, properties, ARCH_AMD64, amd64setup.defines, convertPathToWin(amd64setup.filePrefix), amd64setup.runBuildEvents);
properties.close();
properties.open((setup.outputDir + '/' + setup.projectDescription + "_Global" + getMSVCArchName(ARCH_ARM64) + getPropertiesExtension()).c_str());
if (!properties)
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_Global" + getMSVCArchName(ARCH_ARM64) + getPropertiesExtension() + "\" for writing");
BuildSetup arm64setup = setup;
std::map<MSVC_Architecture, StringList>::const_iterator arm64_disabled_features_it = _arch_disabled_features.find(ARCH_ARM64);
if (arm64_disabled_features_it != _arch_disabled_features.end()) {
for (StringList::const_iterator feature = arm64_disabled_features_it->second.begin(); feature != arm64_disabled_features_it->second.end(); ++feature) {
arm64setup = removeFeatureFromSetup(arm64setup, *feature);
}
}
outputGlobalPropFile(arm64setup, properties, ARCH_ARM64, arm64setup.defines, convertPathToWin(setup.filePrefix), setup.runBuildEvents);
properties.close();
}
std::string MSVCProvider::getPreBuildEvent() const {

View File

@ -34,6 +34,9 @@ namespace CreateProjectTool {
VisualStudioProvider::VisualStudioProvider(StringList &global_warnings, std::map<std::string, StringList> &project_warnings, const int version, const MSVCVersion& msvc)
: MSVCProvider(global_warnings, project_warnings, version, msvc) {
_archs.push_back(ARCH_X86);
_archs.push_back(ARCH_AMD64);
}
const char *VisualStudioProvider::getProjectExtension() {
@ -63,10 +66,11 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std:
project << "\tTargetFrameworkVersion=\"131072\"\n";
project << "\t>\n"
"\t<Platforms>\n"
"\t\t<Platform Name=\"Win32\" />\n"
"\t\t<Platform Name=\"x64\" />\n"
"\t</Platforms>\n"
"\t<Platforms>\n";
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
project << "\t\t<Platform Name=\"" << getMSVCConfigName(*arch) << "\" />\n";
}
project << "\t</Platforms>\n"
"\t<Configurations>\n";
// Check for project-specific warnings:
@ -78,20 +82,15 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std:
for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i)
libraries += ' ' + *i + ".lib";
// Win32
outputConfiguration(project, setup, libraries, "Debug", ARCH_X86);
outputConfiguration(project, setup, libraries, "Analysis", ARCH_X86);
outputConfiguration(project, setup, libraries, "LLVM", ARCH_X86);
outputConfiguration(project, setup, libraries, "Release", ARCH_X86);
// x64
// For 'x64' we must disable NASM support. Usually we would need to disable the "nasm" feature for that and
// re-create the library list, BUT since NASM doesn't link any additional libraries, we can just use the
// libraries list created for IA-32. If that changes in the future, we need to adjust this part!
outputConfiguration(project, setup, libraries, "Debug", ARCH_AMD64);
outputConfiguration(project, setup, libraries, "Analysis", ARCH_AMD64);
outputConfiguration(project, setup, libraries, "LLVM", ARCH_AMD64); // NOTE: it was win32-x64 here
outputConfiguration(project, setup, libraries, "Release", ARCH_AMD64);
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
outputConfiguration(project, setup, libraries, "Debug", *arch);
outputConfiguration(project, setup, libraries, "Analysis", *arch);
outputConfiguration(project, setup, libraries, "LLVM", *arch);
outputConfiguration(project, setup, libraries, "Release", *arch);
}
} else {
bool enableLanguageExtensions = find(_enableLanguageExtensions.begin(), _enableLanguageExtensions.end(), name) != _enableLanguageExtensions.end();
@ -107,15 +106,13 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std:
toolConfig += (disableEditAndContinue ? "DebugInformationFormat=\"3\" " : "");
toolConfig += (enableLanguageExtensions ? "DisableLanguageExtensions=\"false\" " : "");
// Win32
outputConfiguration(setup, project, toolConfig, "Debug", "Win32", "");
outputConfiguration(setup, project, toolConfig, "Analysis", "Win32", "");
outputConfiguration(setup, project, toolConfig, "LLVM", "Win32", "");
outputConfiguration(setup, project, toolConfig, "Release", "Win32", "");
outputConfiguration(setup, project, toolConfig, "Debug", "x64", "64");
outputConfiguration(setup, project, toolConfig, "Analysis", "x64", "64");
outputConfiguration(setup, project, toolConfig, "LLVM", "x64", "64");
outputConfiguration(setup, project, toolConfig, "Release", "x64", "64");
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
const std::string outputBitness = (*arch == ARCH_X86 ? "" : "64");
outputConfiguration(setup, project, toolConfig, "Debug", getMSVCConfigName(*arch), outputBitness);
outputConfiguration(setup, project, toolConfig, "Analysis", getMSVCConfigName(*arch), outputBitness);
outputConfiguration(setup, project, toolConfig, "LLVM", getMSVCConfigName(*arch), outputBitness);
outputConfiguration(setup, project, toolConfig, "Release", getMSVCConfigName(*arch), outputBitness);
}
}
project << "\t</Configurations>\n"
@ -336,6 +333,7 @@ void VisualStudioProvider::writeFileListToProject(const FileNode &dir, std::ofst
name += ".o";
std::transform(name.begin(), name.end(), name.begin(), tolower);
const bool isDuplicate = (std::find(duplicate.begin(), duplicate.end(), name) != duplicate.end());
std::string filePath = convertPathToWin(filePrefix + node->name);
if (ext == "asm") {
std::string objFileName = "$(IntDir)\\";
@ -346,41 +344,14 @@ void VisualStudioProvider::writeFileListToProject(const FileNode &dir, std::ofst
const std::string toolLine = indentString + "\t\t<Tool Name=\"VCCustomBuildTool\" CommandLine=\"nasm.exe -f win32 -g -o &quot;" + objFileName + "&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;\" Outputs=\"" + objFileName + "\" />\n";
// NASM is not supported for x64, thus we do not need to add additional entries here :-).
projectFile << indentString << "<File RelativePath=\"" << convertPathToWin(filePrefix + node->name) << "\">\n"
<< indentString << "\t<FileConfiguration Name=\"Debug|Win32\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "\t<FileConfiguration Name=\"Analysis|Win32\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "\t<FileConfiguration Name=\"Release|Win32\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "</File>\n";
writeFileToProject(projectFile, filePath, ARCH_X86, indentString, toolLine);
} else {
if (isDuplicate) {
const std::string toolLine = indentString + "\t\t<Tool Name=\"VCCLCompilerTool\" ObjectFile=\"$(IntDir)\\" + objPrefix + "$(InputName).obj\" XMLDocumentationFileName=\"$(IntDir)\\" + objPrefix + "$(InputName).xdc\" />\n";
projectFile << indentString << "<File RelativePath=\"" << convertPathToWin(filePrefix + node->name) << "\">\n"
<< indentString << "\t<FileConfiguration Name=\"Debug|Win32\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "\t<FileConfiguration Name=\"Analysis|Win32\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "\t<FileConfiguration Name=\"Release|Win32\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "\t<FileConfiguration Name=\"Debug|x64\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "\t<FileConfiguration Name=\"Analysis|x64\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "\t<FileConfiguration Name=\"Release|x64\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "</File>\n";
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
writeFileToProject(projectFile, filePath, *arch, indentString, toolLine);
}
} else {
projectFile << indentString << "<File RelativePath=\"" << convertPathToWin(filePrefix + node->name) << "\" />\n";
}
@ -395,4 +366,22 @@ void VisualStudioProvider::writeFileListToProject(const FileNode &dir, std::ofst
projectFile << getIndent(indentation + 1) << "</Filter>\n";
}
void VisualStudioProvider::writeFileToProject(std::ofstream &projectFile, const std::string &filePath, MSVC_Architecture arch,
const std::string &indentString, const std::string &toolLine) {
projectFile << indentString << "<File RelativePath=\"" << filePath << "\">\n"
<< indentString << "\t<FileConfiguration Name=\"Debug|" << getMSVCConfigName(arch) << "\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "\t<FileConfiguration Name=\"Analysis|" << getMSVCConfigName(arch) << "\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "\t<FileConfiguration Name=\"LLVM|" << getMSVCConfigName(arch) << "\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "\t<FileConfiguration Name=\"Release|" << getMSVCConfigName(arch) << "\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "</File>\n";
}
} // End of CreateProjectTool namespace

View File

@ -38,6 +38,9 @@ protected:
void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation,
const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix);
void writeFileToProject(std::ofstream &projectFile, const std::string &filePath, MSVC_Architecture arch,
const std::string &indentString, const std::string &toolLine);
void writeReferences(const BuildSetup &setup, std::ofstream &output);
void outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, MSVC_Architecture arch, const StringList &defines, const std::string &prefix, bool runBuildEvents);