CREATE_PROJECT: Make MSVC project understand more architectures
This commit is contained in:
parent
a23b1789db
commit
3d3b0124ad
8 changed files with 191 additions and 113 deletions
|
@ -1137,8 +1137,28 @@ const std::map<std::string, std::string> s_canonical_lib_name_map = {
|
||||||
{ "SDL_net", "SDL2_net" }, // Only support SDL2
|
{ "SDL_net", "SDL2_net" }, // Only support SDL2
|
||||||
{ "win_utf8_io_static", "FLAC" }, // This is some FLAC-specific library not needed with vcpkg, but as there's '.lib' appended to each library, we can't set it to empty, so set it to FLAC again instead
|
{ "win_utf8_io_static", "FLAC" }, // This is some FLAC-specific library not needed with vcpkg, but as there's '.lib' appended to each library, we can't set it to empty, so set it to FLAC again instead
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const std::map<MSVC_Architecture, std::string> s_msvc_arch_names = {
|
||||||
|
{ MSVC_Architecture::ARCH_ARM64, "arm64" },
|
||||||
|
{ MSVC_Architecture::ARCH_X86, "x86" },
|
||||||
|
{ MSVC_Architecture::ARCH_AMD64, "x64" },
|
||||||
|
};
|
||||||
|
|
||||||
|
const std::map<MSVC_Architecture, std::string> s_msvc_config_names = {
|
||||||
|
{ MSVC_Architecture::ARCH_ARM64, "arm64" },
|
||||||
|
{ MSVC_Architecture::ARCH_X86, "Win32" },
|
||||||
|
{ MSVC_Architecture::ARCH_AMD64, "x64" },
|
||||||
|
};
|
||||||
} // End of anonymous namespace
|
} // End of anonymous namespace
|
||||||
|
|
||||||
|
std::string getMSVCArchName(MSVC_Architecture arch) {
|
||||||
|
return s_msvc_arch_names.at(arch);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string getMSVCConfigName(MSVC_Architecture arch) {
|
||||||
|
return s_msvc_config_names.at(arch);
|
||||||
|
}
|
||||||
|
|
||||||
std::string getCanonicalLibName(std::string lib) {
|
std::string getCanonicalLibName(std::string lib) {
|
||||||
auto it = s_canonical_lib_name_map.find(lib);
|
auto it = s_canonical_lib_name_map.find(lib);
|
||||||
if (it != s_canonical_lib_name_map.end()) {
|
if (it != s_canonical_lib_name_map.end()) {
|
||||||
|
|
|
@ -304,6 +304,15 @@ struct MSVCVersion {
|
||||||
};
|
};
|
||||||
typedef std::list<MSVCVersion> MSVCList;
|
typedef std::list<MSVCVersion> MSVCList;
|
||||||
|
|
||||||
|
enum class MSVC_Architecture {
|
||||||
|
ARCH_ARM64,
|
||||||
|
ARCH_X86,
|
||||||
|
ARCH_AMD64
|
||||||
|
};
|
||||||
|
|
||||||
|
std::string getMSVCArchName(MSVC_Architecture arch);
|
||||||
|
std::string getMSVCConfigName(MSVC_Architecture arch);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a list of all supported versions of Visual Studio.
|
* Creates a list of all supported versions of Visual Studio.
|
||||||
*
|
*
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
namespace CreateProjectTool {
|
namespace CreateProjectTool {
|
||||||
|
|
||||||
|
@ -80,15 +81,15 @@ 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"
|
"<Project DefaultTargets=\"Build\" ToolsVersion=\"" << _msvcVersion.project << "\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
|
||||||
"\t<ItemGroup Label=\"ProjectConfigurations\">\n";
|
"\t<ItemGroup Label=\"ProjectConfigurations\">\n";
|
||||||
|
|
||||||
outputConfiguration(project, "Debug", "Win32");
|
std::array<MSVC_Architecture, 3> archs{ MSVC_Architecture::ARCH_X86, MSVC_Architecture::ARCH_AMD64, MSVC_Architecture::ARCH_ARM64 };
|
||||||
outputConfiguration(project, "Debug", "x64");
|
|
||||||
outputConfiguration(project, "Analysis", "Win32");
|
|
||||||
outputConfiguration(project, "Analysis", "x64");
|
|
||||||
outputConfiguration(project, "LLVM", "Win32");
|
|
||||||
outputConfiguration(project, "LLVM", "x64");
|
|
||||||
outputConfiguration(project, "Release", "Win32");
|
|
||||||
outputConfiguration(project, "Release", "x64");
|
|
||||||
|
|
||||||
|
for (const auto& arch : archs) {
|
||||||
|
// NOTE: different order
|
||||||
|
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 << "\t</ItemGroup>\n";
|
||||||
|
|
||||||
// Project name & Guid
|
// Project name & Guid
|
||||||
|
@ -96,45 +97,51 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri
|
||||||
"\t\t<ProjectGuid>{" << uuid << "}</ProjectGuid>\n"
|
"\t\t<ProjectGuid>{" << uuid << "}</ProjectGuid>\n"
|
||||||
"\t\t<RootNamespace>" << name << "</RootNamespace>\n"
|
"\t\t<RootNamespace>" << name << "</RootNamespace>\n"
|
||||||
"\t\t<Keyword>Win32Proj</Keyword>\n"
|
"\t\t<Keyword>Win32Proj</Keyword>\n"
|
||||||
"\t\t<VCTargetsPath Condition=\"'$(VCTargetsPath" << _version << ")' != '' and '$(VSVersion)' == '' and $(VisualStudioVersion) == ''\">$(VCTargetsPath" << _version << ")</VCTargetsPath>\n"
|
"\t\t<VCTargetsPath Condition=\"'$(VCTargetsPath" << _version << ")' != '' and '$(VSVersion)' == '' and $(VisualStudioVersion) == ''\">$(VCTargetsPath" << _version << ")</VCTargetsPath>\n";
|
||||||
"\t</PropertyGroup>\n";
|
|
||||||
|
for (const auto& arch : archs) {
|
||||||
|
project << "\t\t<VcpkgTriplet Condition=\"'$(Platform)' == '" << getMSVCConfigName(arch) << "'\">" << getMSVCArchName(arch) << "-windows</VcpkgTriplet>";
|
||||||
|
}
|
||||||
|
|
||||||
|
project << "\t</PropertyGroup>\n";
|
||||||
|
|
||||||
// Shared configuration
|
// Shared configuration
|
||||||
project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n";
|
project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n";
|
||||||
|
|
||||||
outputConfigurationType(setup, project, name, "Release|Win32", _msvcVersion.toolsetMSVC);
|
for (const auto& arch : archs) {
|
||||||
outputConfigurationType(setup, project, name, "Analysis|Win32", _msvcVersion.toolsetMSVC);
|
outputConfigurationType(setup, project, name, "Release|" + getMSVCConfigName(arch), _msvcVersion.toolsetMSVC);
|
||||||
outputConfigurationType(setup, project, name, "LLVM|Win32", _msvcVersion.toolsetLLVM);
|
outputConfigurationType(setup, project, name, "Analysis" + getMSVCConfigName(arch), _msvcVersion.toolsetMSVC);
|
||||||
outputConfigurationType(setup, project, name, "Debug|Win32", _msvcVersion.toolsetMSVC);
|
outputConfigurationType(setup, project, name, "LLVM|" + getMSVCConfigName(arch), _msvcVersion.toolsetLLVM);
|
||||||
outputConfigurationType(setup, project, name, "Release|x64", _msvcVersion.toolsetMSVC);
|
outputConfigurationType(setup, project, name, "Debug|" + getMSVCConfigName(arch), _msvcVersion.toolsetMSVC);
|
||||||
outputConfigurationType(setup, project, name, "LLVM|x64", _msvcVersion.toolsetLLVM);
|
}
|
||||||
outputConfigurationType(setup, project, name, "Analysis|x64", _msvcVersion.toolsetMSVC);
|
|
||||||
outputConfigurationType(setup, project, name, "Debug|x64", _msvcVersion.toolsetMSVC);
|
|
||||||
|
|
||||||
project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n"
|
project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n"
|
||||||
"\t<ImportGroup Label=\"ExtensionSettings\">\n"
|
"\t<ImportGroup Label=\"ExtensionSettings\">\n"
|
||||||
"\t</ImportGroup>\n";
|
"\t</ImportGroup>\n";
|
||||||
|
|
||||||
outputProperties(project, "Release|Win32", setup.projectDescription + "_Release.props");
|
for (const auto& arch : archs) {
|
||||||
outputProperties(project, "Analysis|Win32", setup.projectDescription + "_Analysis.props");
|
outputProperties(project, "Release|" + getMSVCConfigName(arch), setup.projectDescription + "_Release" + getMSVCArchName(arch) + ".props");
|
||||||
outputProperties(project, "LLVM|Win32", setup.projectDescription + "_LLVM.props");
|
outputProperties(project, "Analysis|" + getMSVCConfigName(arch), setup.projectDescription + "_Analysis" + getMSVCArchName(arch) + ".props");
|
||||||
outputProperties(project, "Debug|Win32", setup.projectDescription + "_Debug.props");
|
outputProperties(project, "LLVM|" + getMSVCConfigName(arch), setup.projectDescription + "_LLVM" + getMSVCArchName(arch) + ".props");
|
||||||
outputProperties(project, "Release|x64", setup.projectDescription + "_Release64.props");
|
outputProperties(project, "Debug|" + getMSVCConfigName(arch), setup.projectDescription + "_Debug" + getMSVCArchName(arch) + ".props");
|
||||||
outputProperties(project, "Analysis|x64", setup.projectDescription + "_Analysis64.props");
|
}
|
||||||
outputProperties(project, "LLVM|x64", setup.projectDescription + "_LLVM64.props");
|
|
||||||
outputProperties(project, "Debug|x64", setup.projectDescription + "_Debug64.props");
|
|
||||||
|
|
||||||
project << "\t<PropertyGroup Label=\"UserMacros\" />\n";
|
project << "\t<PropertyGroup Label=\"UserMacros\" />\n";
|
||||||
|
|
||||||
// Project-specific settings (analysis uses debug properties)
|
// Project-specific settings (analysis uses debug properties)
|
||||||
outputProjectSettings(project, name, setup, false, true, "Debug");
|
for (const auto &arch : archs) {
|
||||||
outputProjectSettings(project, name, setup, false, true, "Analysis");
|
BuildSetup archsetup = setup;
|
||||||
outputProjectSettings(project, name, setup, false, true, "LLVM");
|
auto disabled_features_it = s_arch_disabled_features.find(arch);
|
||||||
outputProjectSettings(project, name, setup, true, true, "Release");
|
if (disabled_features_it != s_arch_disabled_features.end()) {
|
||||||
outputProjectSettings(project, name, setup, false, false, "Debug");
|
for (auto feature : disabled_features_it->second) {
|
||||||
outputProjectSettings(project, name, setup, false, false, "Analysis");
|
archsetup = removeFeatureFromSetup(archsetup, feature);
|
||||||
outputProjectSettings(project, name, setup, false, false, "LLVM");
|
}
|
||||||
outputProjectSettings(project, name, setup, true, false, "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
|
// Files
|
||||||
std::string modulePath;
|
std::string modulePath;
|
||||||
|
@ -256,7 +263,7 @@ void MSBuildProvider::writeReferences(const BuildSetup &setup, std::ofstream &ou
|
||||||
output << "\t</ItemGroup>\n";
|
output << "\t</ItemGroup>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::string &name, const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration) {
|
void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::string &name, const BuildSetup &setup, bool isRelease, MSVC_Architecture arch, const std::string &configuration) {
|
||||||
// Check for project-specific warnings:
|
// Check for project-specific warnings:
|
||||||
std::map<std::string, StringList>::iterator warningsIterator = _projectWarnings.find(name);
|
std::map<std::string, StringList>::iterator warningsIterator = _projectWarnings.find(name);
|
||||||
bool enableLanguageExtensions = find(_enableLanguageExtensions.begin(), _enableLanguageExtensions.end(), name) != _enableLanguageExtensions.end();
|
bool enableLanguageExtensions = find(_enableLanguageExtensions.begin(), _enableLanguageExtensions.end(), name) != _enableLanguageExtensions.end();
|
||||||
|
@ -271,7 +278,7 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
|
||||||
for (StringList::const_iterator i = warningsIterator->second.begin(); i != warningsIterator->second.end(); ++i)
|
for (StringList::const_iterator i = warningsIterator->second.begin(); i != warningsIterator->second.end(); ++i)
|
||||||
warnings += *i + ';';
|
warnings += *i + ';';
|
||||||
|
|
||||||
project << "\t<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='" << configuration << "|" << (isWin32 ? "Win32" : "x64") << "'\">\n"
|
project << "\t<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='" << configuration << "|" << getMSVCConfigName(arch) << "'\">\n"
|
||||||
"\t\t<ClCompile>\n";
|
"\t\t<ClCompile>\n";
|
||||||
|
|
||||||
// Language Extensions
|
// Language Extensions
|
||||||
|
@ -311,7 +318,7 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
|
||||||
// Copy data files to the build folder
|
// Copy data files to the build folder
|
||||||
project << "\t\t<PostBuildEvent>\n"
|
project << "\t\t<PostBuildEvent>\n"
|
||||||
"\t\t\t<Message>Copy data files to the build folder</Message>\n"
|
"\t\t\t<Message>Copy data files to the build folder</Message>\n"
|
||||||
"\t\t\t<Command>" << getPostBuildEvent(isWin32, setup) << "</Command>\n"
|
"\t\t\t<Command>" << getPostBuildEvent(arch, setup) << "</Command>\n"
|
||||||
"\t\t</PostBuildEvent>\n";
|
"\t\t</PostBuildEvent>\n";
|
||||||
} else if (setup.tests) {
|
} else if (setup.tests) {
|
||||||
project << "\t\t<PreBuildEvent>\n"
|
project << "\t\t<PreBuildEvent>\n"
|
||||||
|
@ -324,7 +331,7 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
|
||||||
project << "\t</ItemDefinitionGroup>\n";
|
project << "\t</ItemDefinitionGroup>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents) {
|
void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, MSVC_Architecture arch, const StringList &defines, const std::string &prefix, bool runBuildEvents) {
|
||||||
|
|
||||||
std::string warnings;
|
std::string warnings;
|
||||||
for (StringList::const_iterator i = _globalWarnings.begin(); i != _globalWarnings.end(); ++i)
|
for (StringList::const_iterator i = _globalWarnings.begin(); i != _globalWarnings.end(); ++i)
|
||||||
|
@ -342,11 +349,11 @@ void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstrea
|
||||||
"<Project DefaultTargets=\"Build\" ToolsVersion=\"" << _msvcVersion.project << "\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
|
"<Project DefaultTargets=\"Build\" ToolsVersion=\"" << _msvcVersion.project << "\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
|
||||||
"\t<PropertyGroup>\n"
|
"\t<PropertyGroup>\n"
|
||||||
"\t\t<_PropertySheetDisplayName>" << setup.projectDescription << "_Global</_PropertySheetDisplayName>\n"
|
"\t\t<_PropertySheetDisplayName>" << setup.projectDescription << "_Global</_PropertySheetDisplayName>\n"
|
||||||
"\t\t<ExecutablePath>$(" << LIBS_DEFINE << ")\\bin;$(" << LIBS_DEFINE << ")\\bin\\" << (bits == 32 ? "x86" : "x64") << ";$(ExecutablePath)</ExecutablePath>\n"
|
"\t\t<ExecutablePath>$(" << LIBS_DEFINE << ")\\bin;$(" << LIBS_DEFINE << ")\\bin\\" << getMSVCArchName(arch) << ";$(" << LIBS_DEFINE << ")\\$(Configuration)\\bin;$(ExecutablePath)</ExecutablePath>\n"
|
||||||
"\t\t<LibraryPath>$(" << LIBS_DEFINE << ")\\lib\\" << (bits == 32 ? "x86" : "x64") << ";$(" << LIBS_DEFINE << ")\\lib\\" << (bits == 32 ? "x86" : "x64") << "\\$(Configuration);$(LibraryPath)</LibraryPath>\n"
|
"\t\t<LibraryPath>$(" << LIBS_DEFINE << ")\\lib\\" << getMSVCArchName(arch) << ";$(" << LIBS_DEFINE << ")\\lib\\" << getMSVCArchName(arch) << "\\$(Configuration);$(" << LIBS_DEFINE << ")\\lib;$(" << LIBS_DEFINE << ")\\$(Configuration)\\lib;$(LibraryPath)</LibraryPath>\n"
|
||||||
"\t\t<IncludePath>$(" << LIBS_DEFINE << ")\\include;$(" << LIBS_DEFINE << ")\\include\\" << (setup.useSDL2 ? "SDL2" : "SDL") << ";$(IncludePath)</IncludePath>\n"
|
"\t\t<IncludePath>$(" << LIBS_DEFINE << ")\\include;$(" << LIBS_DEFINE << ")\\include\\" << (setup.useSDL2 ? "SDL2" : "SDL") << ";$(IncludePath)</IncludePath>\n"
|
||||||
"\t\t<OutDir>$(Configuration)" << bits << "\\</OutDir>\n"
|
"\t\t<OutDir>$(Configuration)" << getMSVCArchName(arch) << "\\</OutDir>\n"
|
||||||
"\t\t<IntDir>$(Configuration)" << bits << "\\$(ProjectName)\\</IntDir>\n"
|
"\t\t<IntDir>$(Configuration)" << getMSVCArchName(arch) << "\\$(ProjectName)\\</IntDir>\n"
|
||||||
"\t</PropertyGroup>\n"
|
"\t</PropertyGroup>\n"
|
||||||
"\t<ItemDefinitionGroup>\n"
|
"\t<ItemDefinitionGroup>\n"
|
||||||
"\t\t<ClCompile>\n"
|
"\t\t<ClCompile>\n"
|
||||||
|
@ -387,20 +394,20 @@ void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstrea
|
||||||
properties.flush();
|
properties.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration) {
|
void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, MSVC_Architecture arch, const std::string &configuration) {
|
||||||
const std::string outputBitness = (isWin32 ? "32" : "64");
|
const std::string outputBitness = (arch == MSVC_Architecture::ARCH_X86 ? "32" : "64");
|
||||||
|
|
||||||
std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_" + configuration + (isWin32 ? "" : "64") + getPropertiesExtension()).c_str());
|
std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_" + configuration + getMSVCArchName(arch) + getPropertiesExtension()).c_str());
|
||||||
if (!properties)
|
if (!properties)
|
||||||
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_" + configuration + (isWin32 ? "" : "64") + getPropertiesExtension() + "\" for writing");
|
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_" + configuration + getMSVCArchName(arch) + getPropertiesExtension() + "\" for writing");
|
||||||
|
|
||||||
properties << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
properties << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
||||||
"<Project DefaultTargets=\"Build\" ToolsVersion=\"" << _msvcVersion.project << "\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
|
"<Project DefaultTargets=\"Build\" ToolsVersion=\"" << _msvcVersion.project << "\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
|
||||||
"\t<ImportGroup Label=\"PropertySheets\">\n"
|
"\t<ImportGroup Label=\"PropertySheets\">\n"
|
||||||
"\t\t<Import Project=\"" << setup.projectDescription << "_Global" << (isWin32 ? "" : "64") << ".props\" />\n"
|
"\t\t<Import Project=\"" << setup.projectDescription << "_Global" << getMSVCArchName(arch) << ".props\" />\n"
|
||||||
"\t</ImportGroup>\n"
|
"\t</ImportGroup>\n"
|
||||||
"\t<PropertyGroup>\n"
|
"\t<PropertyGroup>\n"
|
||||||
"\t\t<_PropertySheetDisplayName>" << setup.projectDescription << "_" << configuration << outputBitness << "</_PropertySheetDisplayName>\n"
|
"\t\t<_PropertySheetDisplayName>" << setup.projectDescription << "_" << configuration << getMSVCArchName(arch) << "</_PropertySheetDisplayName>\n"
|
||||||
"\t\t<LinkIncremental>" << (isRelease ? "false" : "true") << "</LinkIncremental>\n"
|
"\t\t<LinkIncremental>" << (isRelease ? "false" : "true") << "</LinkIncremental>\n"
|
||||||
"\t\t<GenerateManifest>false</GenerateManifest>\n"
|
"\t\t<GenerateManifest>false</GenerateManifest>\n"
|
||||||
"\t</PropertyGroup>\n"
|
"\t</PropertyGroup>\n"
|
||||||
|
@ -432,11 +439,11 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b
|
||||||
"\t\t\t<FunctionLevelLinking>true</FunctionLevelLinking>\n"
|
"\t\t\t<FunctionLevelLinking>true</FunctionLevelLinking>\n"
|
||||||
"\t\t\t<TreatWarningAsError>false</TreatWarningAsError>\n";
|
"\t\t\t<TreatWarningAsError>false</TreatWarningAsError>\n";
|
||||||
if (_version >= 14) {
|
if (_version >= 14) {
|
||||||
// Since MSVC 2015 Edit and Continue is support for x64 too.
|
// Since MSVC 2015 Edit and Continue is supported for x86 and x86-64, but not for ARM.
|
||||||
properties << "\t\t\t<DebugInformationFormat>" << "EditAndContinue" << "</DebugInformationFormat>\n";
|
properties << "\t\t\t<DebugInformationFormat>" << (arch != MSVC_Architecture::ARCH_ARM64 ? "EditAndContinue" : "ProgramDatabase") << "</DebugInformationFormat>\n";
|
||||||
} else {
|
} else {
|
||||||
// Older MSVC versions did not support Edit and Continue for x64, thus we do not use it.
|
// Older MSVC versions did not support Edit and Continue for x64, thus we do not use it.
|
||||||
properties << "\t\t\t<DebugInformationFormat>" << (isWin32 ? "EditAndContinue" : "ProgramDatabase") << "</DebugInformationFormat>\n";
|
properties << "\t\t\t<DebugInformationFormat>" << (arch == MSVC_Architecture::ARCH_X86 ? "EditAndContinue" : "ProgramDatabase") << "</DebugInformationFormat>\n";
|
||||||
}
|
}
|
||||||
properties << "\t\t\t<EnablePREfast>" << (configuration == "Analysis" ? "true" : "false") << "</EnablePREfast>\n";
|
properties << "\t\t\t<EnablePREfast>" << (configuration == "Analysis" ? "true" : "false") << "</EnablePREfast>\n";
|
||||||
|
|
||||||
|
|
|
@ -35,16 +35,16 @@ protected:
|
||||||
void createProjectFile(const std::string &name, const std::string &uuid, const BuildSetup &setup, const std::string &moduleDir,
|
void createProjectFile(const std::string &name, const std::string &uuid, const BuildSetup &setup, const std::string &moduleDir,
|
||||||
const StringList &includeList, const StringList &excludeList);
|
const StringList &includeList, const StringList &excludeList);
|
||||||
|
|
||||||
void outputProjectSettings(std::ofstream &project, const std::string &name, const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration);
|
void outputProjectSettings(std::ofstream &project, const std::string &name, const BuildSetup &setup, bool isRelease, MSVC_Architecture arch, const std::string &configuration);
|
||||||
|
|
||||||
void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation,
|
void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation,
|
||||||
const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix);
|
const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix);
|
||||||
|
|
||||||
void writeReferences(const BuildSetup &setup, std::ofstream &output);
|
void writeReferences(const BuildSetup &setup, std::ofstream &output);
|
||||||
|
|
||||||
void outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents);
|
void outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, MSVC_Architecture arch, const StringList &defines, const std::string &prefix, bool runBuildEvents) override;
|
||||||
|
|
||||||
void createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration);
|
void createBuildProp(const BuildSetup &setup, bool isRelease, MSVC_Architecture arch, const std::string &configuration) override;
|
||||||
|
|
||||||
const char *getProjectExtension();
|
const char *getProjectExtension();
|
||||||
const char *getPropertiesExtension();
|
const char *getPropertiesExtension();
|
||||||
|
|
|
@ -27,6 +27,17 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
|
||||||
|
std::map<MSVC_Architecture, StringList> s_arch_disabled_features{
|
||||||
|
// NASM not supported for Windows on AMD64 target
|
||||||
|
{ MSVC_Architecture::ARCH_AMD64, { "nasm" } },
|
||||||
|
|
||||||
|
// NASM not supported for WoA target
|
||||||
|
// No OpenGL, OpenGL ES on Windows on ARM
|
||||||
|
// https://github.com/microsoft/vcpkg/issues/11248 [fribidi] Fribidi doesn't cross-compile on x86-64 to target arm/arm64
|
||||||
|
{ MSVC_Architecture::ARCH_ARM64, { "nasm", "opengl", "opengles", "fribidi" } },
|
||||||
|
};
|
||||||
|
|
||||||
namespace CreateProjectTool {
|
namespace CreateProjectTool {
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -86,6 +97,10 @@ void MSVCProvider::createWorkspace(const BuildSetup &setup) {
|
||||||
"\t\tAnalysis|x64 = Analysis|x64\n"
|
"\t\tAnalysis|x64 = Analysis|x64\n"
|
||||||
"\t\tLLVM|x64 = LLVM|x64\n"
|
"\t\tLLVM|x64 = LLVM|x64\n"
|
||||||
"\t\tRelease|x64 = Release|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"
|
"\tEndGlobalSection\n"
|
||||||
"\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n";
|
"\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n";
|
||||||
|
|
||||||
|
@ -105,7 +120,15 @@ void MSVCProvider::createWorkspace(const BuildSetup &setup) {
|
||||||
"\t\t{" << i->second << "}.LLVM|x64.ActiveCfg = LLVM|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 << "}.LLVM|x64.Build.0 = LLVM|x64\n"
|
||||||
"\t\t{" << i->second << "}.Release|x64.ActiveCfg = Release|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 << "}.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";
|
||||||
}
|
}
|
||||||
|
|
||||||
solution << "\tEndGlobalSection\n"
|
solution << "\tEndGlobalSection\n"
|
||||||
|
@ -121,14 +144,18 @@ void MSVCProvider::createOtherBuildFiles(const BuildSetup &setup) {
|
||||||
|
|
||||||
// Create the configuration property files (for Debug and Release with 32 and 64bits versions)
|
// Create the configuration property files (for Debug and Release with 32 and 64bits versions)
|
||||||
// Note: we use the debug properties for the analysis configuration
|
// Note: we use the debug properties for the analysis configuration
|
||||||
createBuildProp(setup, true, false, "Release");
|
createBuildProp(setup, true, MSVC_Architecture::ARCH_AMD64, "Release");
|
||||||
createBuildProp(setup, true, true, "Release");
|
createBuildProp(setup, true, MSVC_Architecture::ARCH_X86, "Release");
|
||||||
createBuildProp(setup, false, false, "Debug");
|
createBuildProp(setup, true, MSVC_Architecture::ARCH_ARM64, "Release");
|
||||||
createBuildProp(setup, false, true, "Debug");
|
createBuildProp(setup, false, MSVC_Architecture::ARCH_AMD64, "Debug");
|
||||||
createBuildProp(setup, false, false, "Analysis");
|
createBuildProp(setup, false, MSVC_Architecture::ARCH_X86, "Debug");
|
||||||
createBuildProp(setup, false, true, "Analysis");
|
createBuildProp(setup, false, MSVC_Architecture::ARCH_ARM64, "Debug");
|
||||||
createBuildProp(setup, false, false, "LLVM");
|
createBuildProp(setup, false, MSVC_Architecture::ARCH_AMD64, "Analysis");
|
||||||
createBuildProp(setup, false, true, "LLVM");
|
createBuildProp(setup, false, MSVC_Architecture::ARCH_X86, "Analysis");
|
||||||
|
createBuildProp(setup, false, MSVC_Architecture::ARCH_ARM64, "Analysis");
|
||||||
|
createBuildProp(setup, false, MSVC_Architecture::ARCH_AMD64, "LLVM");
|
||||||
|
createBuildProp(setup, false, MSVC_Architecture::ARCH_X86, "LLVM");
|
||||||
|
createBuildProp(setup, false, MSVC_Architecture::ARCH_ARM64, "LLVM");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSVCProvider::addResourceFiles(const BuildSetup &setup, StringList &includeList, StringList &excludeList) {
|
void MSVCProvider::addResourceFiles(const BuildSetup &setup, StringList &includeList, StringList &excludeList) {
|
||||||
|
@ -137,27 +164,41 @@ void MSVCProvider::addResourceFiles(const BuildSetup &setup, StringList &include
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSVCProvider::createGlobalProp(const BuildSetup &setup) {
|
void MSVCProvider::createGlobalProp(const BuildSetup &setup) {
|
||||||
std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_Global" + getPropertiesExtension()).c_str());
|
std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_Global" + getMSVCArchName(MSVC_Architecture::ARCH_X86) + getPropertiesExtension()).c_str());
|
||||||
if (!properties)
|
if (!properties)
|
||||||
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_Global" + getPropertiesExtension() + "\" for writing");
|
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_Global" + getMSVCArchName(MSVC_Architecture::ARCH_X86) + getPropertiesExtension() + "\" for writing");
|
||||||
|
|
||||||
outputGlobalPropFile(setup, properties, 32, setup.defines, convertPathToWin(setup.filePrefix), setup.runBuildEvents);
|
outputGlobalPropFile(setup, properties, MSVC_Architecture::ARCH_X86, setup.defines, convertPathToWin(setup.filePrefix), setup.runBuildEvents);
|
||||||
properties.close();
|
properties.close();
|
||||||
|
|
||||||
properties.open((setup.outputDir + '/' + setup.projectDescription + "_Global64" + getPropertiesExtension()).c_str());
|
properties.open((setup.outputDir + '/' + setup.projectDescription + "_Global" + getMSVCArchName(MSVC_Architecture::ARCH_AMD64) + getPropertiesExtension()).c_str());
|
||||||
if (!properties)
|
if (!properties)
|
||||||
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_Global64" + getPropertiesExtension() + "\" for writing");
|
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_Global" + getMSVCArchName(MSVC_Architecture::ARCH_AMD64) + getPropertiesExtension() + "\" for writing");
|
||||||
|
|
||||||
// HACK: We must disable the "nasm" feature for x64. To achieve that we must recreate the define list.
|
BuildSetup amd64setup = setup;
|
||||||
StringList x64Defines = setup.defines;
|
auto amd64_disabled_features_it = s_arch_disabled_features.find(MSVC_Architecture::ARCH_AMD64);
|
||||||
for (FeatureList::const_iterator i = setup.features.begin(); i != setup.features.end(); ++i) {
|
if (amd64_disabled_features_it != s_arch_disabled_features.end()) {
|
||||||
if (i->enable && i->define && i->define[0] && !strcmp(i->name, "nasm")) {
|
for (auto feature : amd64_disabled_features_it->second) {
|
||||||
x64Defines.remove(i->define);
|
amd64setup = removeFeatureFromSetup(amd64setup, feature);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
outputGlobalPropFile(setup, properties, 64, x64Defines, convertPathToWin(setup.filePrefix), setup.runBuildEvents);
|
outputGlobalPropFile(amd64setup, properties, MSVC_Architecture::ARCH_AMD64, amd64setup.defines, convertPathToWin(amd64setup.filePrefix), amd64setup.runBuildEvents);
|
||||||
|
properties.close();
|
||||||
|
|
||||||
|
properties.open((setup.outputDir + '/' + setup.projectDescription + "_Global" + getMSVCArchName(MSVC_Architecture::ARCH_ARM64) + getPropertiesExtension()).c_str());
|
||||||
|
if (!properties)
|
||||||
|
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_Global" + getMSVCArchName(MSVC_Architecture::ARCH_ARM64) + getPropertiesExtension() + "\" for writing");
|
||||||
|
|
||||||
|
BuildSetup arm64setup = setup;
|
||||||
|
auto arm64_disabled_features_it = s_arch_disabled_features.find(MSVC_Architecture::ARCH_ARM64);
|
||||||
|
if (arm64_disabled_features_it != s_arch_disabled_features.end()) {
|
||||||
|
for (auto feature : arm64_disabled_features_it->second) {
|
||||||
|
arm64setup = removeFeatureFromSetup(arm64setup, feature);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
outputGlobalPropFile(arm64setup, properties, MSVC_Architecture::ARCH_ARM64, arm64setup.defines, convertPathToWin(setup.filePrefix), setup.runBuildEvents);
|
||||||
|
properties.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MSVCProvider::getPreBuildEvent() const {
|
std::string MSVCProvider::getPreBuildEvent() const {
|
||||||
|
@ -182,7 +223,7 @@ std::string MSVCProvider::getTestPreBuildEvent(const BuildSetup &setup) const {
|
||||||
return ""$(SolutionDir)../../test/cxxtest/cxxtestgen.py" --runner=ParenPrinter --no-std --no-eh -o "$(SolutionDir)test_runner.cpp"" + target;
|
return ""$(SolutionDir)../../test/cxxtest/cxxtestgen.py" --runner=ParenPrinter --no-std --no-eh -o "$(SolutionDir)test_runner.cpp"" + target;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MSVCProvider::getPostBuildEvent(bool isWin32, const BuildSetup &setup) const {
|
std::string MSVCProvider::getPostBuildEvent(MSVC_Architecture arch, const BuildSetup &setup) const {
|
||||||
std::string cmdLine = "";
|
std::string cmdLine = "";
|
||||||
|
|
||||||
cmdLine = "@echo off\n"
|
cmdLine = "@echo off\n"
|
||||||
|
@ -193,7 +234,7 @@ std::string MSVCProvider::getPostBuildEvent(bool isWin32, const BuildSetup &setu
|
||||||
cmdLine += (setup.useSDL2) ? "SDL2" : "SDL";
|
cmdLine += (setup.useSDL2) ? "SDL2" : "SDL";
|
||||||
|
|
||||||
cmdLine += " "%" LIBS_DEFINE "%/lib/";
|
cmdLine += " "%" LIBS_DEFINE "%/lib/";
|
||||||
cmdLine += (isWin32) ? "x86" : "x64";
|
cmdLine += getMSVCArchName(arch);
|
||||||
cmdLine += "/$(Configuration)" ";
|
cmdLine += "/$(Configuration)" ";
|
||||||
|
|
||||||
// Specify if installer needs to be built or not
|
// Specify if installer needs to be built or not
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
#include "create_project.h"
|
#include "create_project.h"
|
||||||
|
|
||||||
|
extern std::map<MSVC_Architecture, StringList> s_arch_disabled_features;
|
||||||
|
|
||||||
namespace CreateProjectTool {
|
namespace CreateProjectTool {
|
||||||
|
|
||||||
class MSVCProvider : public ProjectProvider {
|
class MSVCProvider : public ProjectProvider {
|
||||||
|
@ -64,17 +66,17 @@ protected:
|
||||||
* @param prefix File prefix, used to add additional include paths.
|
* @param prefix File prefix, used to add additional include paths.
|
||||||
* @param runBuildEvents true if generating a revision number, false otherwise
|
* @param runBuildEvents true if generating a revision number, false otherwise
|
||||||
*/
|
*/
|
||||||
virtual void outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents) = 0;
|
virtual void outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, MSVC_Architecture arch, const StringList &defines, const std::string &prefix, bool runBuildEvents) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates the project properties for debug and release settings.
|
* Generates the project properties for debug and release settings.
|
||||||
*
|
*
|
||||||
* @param setup Description of the desired build setup.
|
* @param setup Description of the desired build setup.
|
||||||
* @param isRelease Type of property file
|
* @param isRelease Type of property file
|
||||||
* @param isWin32 Bitness of property file
|
* @param arch Target architecture
|
||||||
* @param configuration Name of property file
|
* @param configuration Name of property file
|
||||||
*/
|
*/
|
||||||
virtual void createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration) = 0;
|
virtual void createBuildProp(const BuildSetup &setup, bool isRelease, MSVC_Architecture arch, const std::string &configuration) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the file extension for property files
|
* Get the file extension for property files
|
||||||
|
@ -96,12 +98,12 @@ protected:
|
||||||
/**
|
/**
|
||||||
* Get the command line for copying data files to the build directory.
|
* Get the command line for copying data files to the build directory.
|
||||||
*
|
*
|
||||||
* @param isWin32 Bitness of property file.
|
* @param arch Target architecture
|
||||||
* @param setup Description of the desired build setup.
|
* @param setup Description of the desired build setup.
|
||||||
*
|
*
|
||||||
* @return The post build event.
|
* @return The post build event.
|
||||||
*/
|
*/
|
||||||
std::string getPostBuildEvent(bool isWin32, const BuildSetup &setup) const;
|
std::string getPostBuildEvent(MSVC_Architecture arch, const BuildSetup &setup) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End of CreateProjectTool namespace
|
} // End of CreateProjectTool namespace
|
||||||
|
|
|
@ -79,19 +79,19 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std:
|
||||||
libraries += ' ' + *i + ".lib";
|
libraries += ' ' + *i + ".lib";
|
||||||
|
|
||||||
// Win32
|
// Win32
|
||||||
outputConfiguration(project, setup, libraries, "Debug", "Win32", "", true);
|
outputConfiguration(project, setup, libraries, "Debug", MSVC_Architecture::ARCH_X86);
|
||||||
outputConfiguration(project, setup, libraries, "Analysis", "Win32", "", true);
|
outputConfiguration(project, setup, libraries, "Analysis", MSVC_Architecture::ARCH_X86);
|
||||||
outputConfiguration(project, setup, libraries, "LLVM", "Win32", "", true);
|
outputConfiguration(project, setup, libraries, "LLVM", MSVC_Architecture::ARCH_X86);
|
||||||
outputConfiguration(project, setup, libraries, "Release", "Win32", "", true);
|
outputConfiguration(project, setup, libraries, "Release", MSVC_Architecture::ARCH_X86);
|
||||||
|
|
||||||
// x64
|
// x64
|
||||||
// For 'x64' we must disable NASM support. Usually we would need to disable the "nasm" feature for that and
|
// 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
|
// 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!
|
// libraries list created for IA-32. If that changes in the future, we need to adjust this part!
|
||||||
outputConfiguration(project, setup, libraries, "Debug", "x64", "64", false);
|
outputConfiguration(project, setup, libraries, "Debug", MSVC_Architecture::ARCH_AMD64);
|
||||||
outputConfiguration(project, setup, libraries, "Analysis", "x64", "64", false);
|
outputConfiguration(project, setup, libraries, "Analysis", MSVC_Architecture::ARCH_AMD64);
|
||||||
outputConfiguration(project, setup, libraries, "LLVM", "Win32", "64", false);
|
outputConfiguration(project, setup, libraries, "LLVM", MSVC_Architecture::ARCH_AMD64); // NOTE: it was win32-x64 here
|
||||||
outputConfiguration(project, setup, libraries, "Release", "x64", "64", false);
|
outputConfiguration(project, setup, libraries, "Release", MSVC_Architecture::ARCH_AMD64);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
bool enableLanguageExtensions = find(_enableLanguageExtensions.begin(), _enableLanguageExtensions.end(), name) != _enableLanguageExtensions.end();
|
bool enableLanguageExtensions = find(_enableLanguageExtensions.begin(), _enableLanguageExtensions.end(), name) != _enableLanguageExtensions.end();
|
||||||
|
@ -142,13 +142,13 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std:
|
||||||
"</VisualStudioProject>\n";
|
"</VisualStudioProject>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualStudioProvider::outputConfiguration(std::ostream &project, const BuildSetup &setup, const std::string &libraries, const std::string &config, const std::string &platform, const std::string &props, const bool isWin32) {
|
void VisualStudioProvider::outputConfiguration(std::ostream &project, const BuildSetup &setup, const std::string &libraries, const std::string &config, const MSVC_Architecture arch) {
|
||||||
project << "\t\t<Configuration Name=\"" << config << "|" << platform << "\" ConfigurationType=\"1\" InheritedPropertySheets=\".\\" << setup.projectDescription << "_" << config << props << ".vsprops\">\n"
|
project << "\t\t<Configuration Name=\"" << config << "|" << getMSVCConfigName(arch) << "\" ConfigurationType=\"1\" InheritedPropertySheets=\".\\" << setup.projectDescription << "_" << config << getMSVCArchName(arch) << ".vsprops\">\n"
|
||||||
"\t\t\t<Tool\tName=\"VCCLCompilerTool\" DisableLanguageExtensions=\"false\" DebugInformationFormat=\"3\" />\n"
|
"\t\t\t<Tool\tName=\"VCCLCompilerTool\" DisableLanguageExtensions=\"false\" DebugInformationFormat=\"3\" />\n"
|
||||||
"\t\t\t<Tool\tName=\"VCLinkerTool\" OutputFile=\"$(OutDir)/" << setup.projectName << ".exe\"\n"
|
"\t\t\t<Tool\tName=\"VCLinkerTool\" OutputFile=\"$(OutDir)/" << setup.projectName << ".exe\"\n"
|
||||||
"\t\t\t\tAdditionalDependencies=\"" << libraries << "\"\n"
|
"\t\t\t\tAdditionalDependencies=\"" << libraries << "\"\n"
|
||||||
"\t\t\t/>\n";
|
"\t\t\t/>\n";
|
||||||
outputBuildEvents(project, setup, isWin32);
|
outputBuildEvents(project, setup, arch);
|
||||||
project << "\t\t</Configuration>\n";
|
project << "\t\t</Configuration>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,13 +158,13 @@ void VisualStudioProvider::outputConfiguration(const BuildSetup &setup, std::ost
|
||||||
"\t\t</Configuration>\n";
|
"\t\t</Configuration>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualStudioProvider::outputBuildEvents(std::ostream &project, const BuildSetup &setup, const bool isWin32) {
|
void VisualStudioProvider::outputBuildEvents(std::ostream &project, const BuildSetup &setup, const MSVC_Architecture arch) {
|
||||||
if (!setup.devTools && !setup.tests && setup.runBuildEvents) {
|
if (!setup.devTools && !setup.tests && setup.runBuildEvents) {
|
||||||
project << "\t\t\t<Tool\tName=\"VCPreBuildEventTool\"\n"
|
project << "\t\t\t<Tool\tName=\"VCPreBuildEventTool\"\n"
|
||||||
"\t\t\t\tCommandLine=\"" << getPreBuildEvent() << "\"\n"
|
"\t\t\t\tCommandLine=\"" << getPreBuildEvent() << "\"\n"
|
||||||
"\t\t\t/>\n"
|
"\t\t\t/>\n"
|
||||||
"\t\t\t<Tool\tName=\"VCPostBuildEventTool\"\n"
|
"\t\t\t<Tool\tName=\"VCPostBuildEventTool\"\n"
|
||||||
"\t\t\t\tCommandLine=\"" << getPostBuildEvent(isWin32, setup) << "\"\n"
|
"\t\t\t\tCommandLine=\"" << getPostBuildEvent(arch, setup) << "\"\n"
|
||||||
"\t\t\t/>\n";
|
"\t\t\t/>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ void VisualStudioProvider::writeReferences(const BuildSetup &setup, std::ofstrea
|
||||||
output << "\tEndProjectSection\n";
|
output << "\tEndProjectSection\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualStudioProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents) {
|
void VisualStudioProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, MSVC_Architecture arch, const StringList &defines, const std::string &prefix, bool runBuildEvents) {
|
||||||
std::string warnings;
|
std::string warnings;
|
||||||
for (StringList::const_iterator i = _globalWarnings.begin(); i != _globalWarnings.end(); ++i)
|
for (StringList::const_iterator i = _globalWarnings.begin(); i != _globalWarnings.end(); ++i)
|
||||||
warnings += *i + ';';
|
warnings += *i + ';';
|
||||||
|
@ -214,8 +214,8 @@ void VisualStudioProvider::outputGlobalPropFile(const BuildSetup &setup, std::of
|
||||||
"\tProjectType=\"Visual C++\"\n"
|
"\tProjectType=\"Visual C++\"\n"
|
||||||
"\tVersion=\"8.00\"\n"
|
"\tVersion=\"8.00\"\n"
|
||||||
"\tName=\"" << setup.projectDescription << "_Global\"\n"
|
"\tName=\"" << setup.projectDescription << "_Global\"\n"
|
||||||
"\tOutputDirectory=\"$(ConfigurationName)" << bits << "\"\n"
|
"\tOutputDirectory=\"$(ConfigurationName)" << getMSVCArchName(arch) << "\"\n"
|
||||||
"\tIntermediateDirectory=\"$(ConfigurationName)" << bits << "/$(ProjectName)\"\n"
|
"\tIntermediateDirectory=\"$(ConfigurationName)" << getMSVCArchName(arch) << "/$(ProjectName)\"\n"
|
||||||
"\t>\n"
|
"\t>\n"
|
||||||
"\t<Tool\n"
|
"\t<Tool\n"
|
||||||
"\t\tName=\"VCCLCompilerTool\"\n"
|
"\t\tName=\"VCCLCompilerTool\"\n"
|
||||||
|
@ -247,7 +247,7 @@ void VisualStudioProvider::outputGlobalPropFile(const BuildSetup &setup, std::of
|
||||||
if (!setup.devTools && !setup.tests)
|
if (!setup.devTools && !setup.tests)
|
||||||
properties << "\t\tEntryPointSymbol=\"WinMainCRTStartup\"\n";
|
properties << "\t\tEntryPointSymbol=\"WinMainCRTStartup\"\n";
|
||||||
|
|
||||||
properties << "\t\tAdditionalLibraryDirectories=\"$(" << LIBS_DEFINE << ")\\lib\\" << ((bits == 32) ? "x86" : "x64") << "\"\n"
|
properties << "\t\tAdditionalLibraryDirectories=\"$(" << LIBS_DEFINE << ")\\lib\\" << getMSVCArchName(arch) << "\"\n"
|
||||||
"\t/>\n"
|
"\t/>\n"
|
||||||
"\t<Tool\n"
|
"\t<Tool\n"
|
||||||
"\t\tName=\"VCResourceCompilerTool\"\n"
|
"\t\tName=\"VCResourceCompilerTool\"\n"
|
||||||
|
@ -259,19 +259,18 @@ void VisualStudioProvider::outputGlobalPropFile(const BuildSetup &setup, std::of
|
||||||
properties.flush();
|
properties.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualStudioProvider::createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration) {
|
void VisualStudioProvider::createBuildProp(const BuildSetup &setup, bool isRelease, MSVC_Architecture arch, const std::string &configuration) {
|
||||||
const std::string outputBitness = (isWin32 ? "32" : "64");
|
|
||||||
|
|
||||||
std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_" + configuration + (isWin32 ? "" : "64") + getPropertiesExtension()).c_str());
|
std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_" + configuration + getMSVCConfigName(arch) + getPropertiesExtension()).c_str());
|
||||||
if (!properties)
|
if (!properties)
|
||||||
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_" + configuration + (isWin32 ? "" : "64") + getPropertiesExtension() + "\" for writing");
|
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_" + configuration + getMSVCConfigName(arch) + getPropertiesExtension() + "\" for writing");
|
||||||
|
|
||||||
properties << "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n"
|
properties << "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n"
|
||||||
"<VisualStudioPropertySheet\n"
|
"<VisualStudioPropertySheet\n"
|
||||||
"\tProjectType=\"Visual C++\"\n"
|
"\tProjectType=\"Visual C++\"\n"
|
||||||
"\tVersion=\"8.00\"\n"
|
"\tVersion=\"8.00\"\n"
|
||||||
"\tName=\"" << setup.projectDescription << "_" << configuration << outputBitness << "\"\n"
|
"\tName=\"" << setup.projectDescription << "_" << configuration << getMSVCConfigName(arch) << "\"\n"
|
||||||
"\tInheritedPropertySheets=\".\\" << setup.projectDescription << "_Global" << (isWin32 ? "" : "64") << ".vsprops\"\n"
|
"\tInheritedPropertySheets=\".\\" << setup.projectDescription << "_Global" << getMSVCConfigName(arch) << ".vsprops\"\n"
|
||||||
"\t>\n"
|
"\t>\n"
|
||||||
"\t<Tool\n"
|
"\t<Tool\n"
|
||||||
"\t\tName=\"VCCLCompilerTool\"\n";
|
"\t\tName=\"VCCLCompilerTool\"\n";
|
||||||
|
@ -300,7 +299,7 @@ void VisualStudioProvider::createBuildProp(const BuildSetup &setup, bool isRelea
|
||||||
"\t\tRuntimeLibrary=\"1\"\n"
|
"\t\tRuntimeLibrary=\"1\"\n"
|
||||||
"\t\tEnableFunctionLevelLinking=\"true\"\n"
|
"\t\tEnableFunctionLevelLinking=\"true\"\n"
|
||||||
"\t\tWarnAsError=\"false\"\n"
|
"\t\tWarnAsError=\"false\"\n"
|
||||||
"\t\tDebugInformationFormat=\"" << (isWin32 ? "4" : "3") << "\"\n" // For x64 format "4" (Edit and continue) is not supported, thus we default to "3"
|
"\t\tDebugInformationFormat=\"" << (arch == MSVC_Architecture::ARCH_X86 ? "3" : "4") << "\"\n" // For x64 format "4" (Edit and continue) is not supported, thus we default to "3"
|
||||||
"\t\tAdditionalOption=\"" << (configuration == "Analysis" ? "/analyze" : "") << "\"\n"
|
"\t\tAdditionalOption=\"" << (configuration == "Analysis" ? "/analyze" : "") << "\"\n"
|
||||||
"\t/>\n"
|
"\t/>\n"
|
||||||
"\t<Tool\n"
|
"\t<Tool\n"
|
||||||
|
|
|
@ -40,16 +40,16 @@ protected:
|
||||||
|
|
||||||
void writeReferences(const BuildSetup &setup, std::ofstream &output);
|
void writeReferences(const BuildSetup &setup, std::ofstream &output);
|
||||||
|
|
||||||
void outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents);
|
void outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, MSVC_Architecture arch, const StringList &defines, const std::string &prefix, bool runBuildEvents);
|
||||||
|
|
||||||
void createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration);
|
void createBuildProp(const BuildSetup &setup, bool isRelease, MSVC_Architecture arch, const std::string &configuration);
|
||||||
|
|
||||||
const char *getProjectExtension();
|
const char *getProjectExtension();
|
||||||
const char *getPropertiesExtension();
|
const char *getPropertiesExtension();
|
||||||
|
|
||||||
void outputConfiguration(std::ostream &project, const BuildSetup &setup, const std::string &libraries, const std::string &config, const std::string &platform, const std::string &props, const bool isWin32);
|
void outputConfiguration(std::ostream &project, const BuildSetup &setup, const std::string &libraries, const std::string &config, const MSVC_Architecture arch);
|
||||||
void outputConfiguration(const BuildSetup &setup, std::ostream &project, const std::string &toolConfig, const std::string &config, const std::string &platform, const std::string &props);
|
void outputConfiguration(const BuildSetup &setup, std::ostream &project, const std::string &toolConfig, const std::string &config, const std::string &platform, const std::string &props);
|
||||||
void outputBuildEvents(std::ostream &project, const BuildSetup &setup, const bool isWin32);
|
void outputBuildEvents(std::ostream &project, const BuildSetup &setup, const MSVC_Architecture arch);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End of CreateProjectTool namespace
|
} // End of CreateProjectTool namespace
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue