CREATE_PROJECT: Merge with latest version of create_project from the ScummVM repository
- Add revision template to base/ folder - Add residual configuration file
This commit is contained in:
parent
c4cb940a0a
commit
e086321dfa
20 changed files with 285 additions and 194 deletions
|
@ -23,10 +23,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "msbuild.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace CreateProjectTool {
|
||||
|
@ -60,7 +60,7 @@ int MSBuildProvider::getVisualStudioVersion() {
|
|||
|
||||
#define OUTPUT_CONFIGURATION_TYPE_MSBUILD(config) \
|
||||
(project << "\t<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='" << config << "'\" Label=\"Configuration\">\n" \
|
||||
"\t\t<ConfigurationType>" << (name == "residual" ? "Application" : "StaticLibrary") << "</ConfigurationType>\n" \
|
||||
"\t\t<ConfigurationType>" << (name == PROJECT_NAME ? "Application" : "StaticLibrary") << "</ConfigurationType>\n" \
|
||||
"\t</PropertyGroup>\n")
|
||||
|
||||
#define OUTPUT_PROPERTIES_MSBUILD(config, properties) \
|
||||
|
@ -110,12 +110,12 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri
|
|||
"\t<ImportGroup Label=\"ExtensionSettings\">\n"
|
||||
"\t</ImportGroup>\n";
|
||||
|
||||
OUTPUT_PROPERTIES_MSBUILD("Release|Win32", "Residual_Release.props");
|
||||
OUTPUT_PROPERTIES_MSBUILD("Analysis|Win32", "Residual_Analysis.props");
|
||||
OUTPUT_PROPERTIES_MSBUILD("Debug|Win32", "Residual_Debug.props");
|
||||
OUTPUT_PROPERTIES_MSBUILD("Release|x64", "Residual_Release64.props");
|
||||
OUTPUT_PROPERTIES_MSBUILD("Analysis|x64", "Residual_Analysis64.props");
|
||||
OUTPUT_PROPERTIES_MSBUILD("Debug|x64", "Residual_Debug64.props");
|
||||
OUTPUT_PROPERTIES_MSBUILD("Release|Win32", PROJECT_DESCRIPTION "_Release.props");
|
||||
OUTPUT_PROPERTIES_MSBUILD("Analysis|Win32", PROJECT_DESCRIPTION "_Analysis.props");
|
||||
OUTPUT_PROPERTIES_MSBUILD("Debug|Win32", PROJECT_DESCRIPTION "_Debug.props");
|
||||
OUTPUT_PROPERTIES_MSBUILD("Release|x64", PROJECT_DESCRIPTION "_Release64.props");
|
||||
OUTPUT_PROPERTIES_MSBUILD("Analysis|x64", PROJECT_DESCRIPTION "_Analysis64.props");
|
||||
OUTPUT_PROPERTIES_MSBUILD("Debug|x64", PROJECT_DESCRIPTION "_Debug64.props");
|
||||
|
||||
project << "\t<PropertyGroup Label=\"UserMacros\" />\n";
|
||||
|
||||
|
@ -140,8 +140,8 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri
|
|||
else
|
||||
addFilesToProject(moduleDir, project, includeList, excludeList, setup.filePrefix);
|
||||
|
||||
// Output references for scummvm project
|
||||
if (name == "residual")
|
||||
// Output references for the main project
|
||||
if (name == PROJECT_NAME)
|
||||
writeReferences(project);
|
||||
|
||||
project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n"
|
||||
|
@ -212,7 +212,7 @@ void MSBuildProvider::writeReferences(std::ofstream &output) {
|
|||
output << "\t<ItemGroup>\n";
|
||||
|
||||
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
|
||||
if (i->first == "residual")
|
||||
if (i->first == PROJECT_NAME)
|
||||
continue;
|
||||
|
||||
output << "\t<ProjectReference Include=\"" << i->first << ".vcxproj\">\n"
|
||||
|
@ -230,7 +230,7 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
|
|||
std::map<std::string, StringList>::iterator warningsIterator = _projectWarnings.find(name);
|
||||
|
||||
// Nothing to add here, move along!
|
||||
if (name != "residual" && warningsIterator == _projectWarnings.end())
|
||||
if (name != PROJECT_NAME && name != "sword25" && name != "tinsel" && name != "grim" && warningsIterator == _projectWarnings.end())
|
||||
return;
|
||||
|
||||
std::string warnings = "";
|
||||
|
@ -242,7 +242,7 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
|
|||
"\t\t<ClCompile>\n";
|
||||
|
||||
// Compile configuration
|
||||
if (name == "residual") {
|
||||
if (name == PROJECT_NAME || name == "sword25" || name == "grim") {
|
||||
project << "\t\t\t<DisableLanguageExtensions>false</DisableLanguageExtensions>\n";
|
||||
} else {
|
||||
if (name == "tinsel" && !isRelease)
|
||||
|
@ -254,26 +254,23 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
|
|||
|
||||
project << "\t\t</ClCompile>\n";
|
||||
|
||||
// Link configuration for scummvm project
|
||||
if (name == "residual") {
|
||||
// Link configuration for main project
|
||||
if (name == PROJECT_NAME) {
|
||||
std::string libraries;
|
||||
|
||||
for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i)
|
||||
libraries += *i + ".lib;";
|
||||
|
||||
project << "\t\t<Link>\n"
|
||||
"\t\t\t<OutputFile>$(OutDir)residual.exe</OutputFile>\n"
|
||||
"\t\t\t<OutputFile>$(OutDir)" << PROJECT_NAME << ".exe</OutputFile>\n"
|
||||
"\t\t\t<AdditionalDependencies>" << libraries << "%(AdditionalDependencies)</AdditionalDependencies>\n"
|
||||
"\t\t</Link>\n";
|
||||
|
||||
if (setup.runBuildEvents) {
|
||||
// Only generate revision number in debug builds
|
||||
if (!isRelease) {
|
||||
project << "\t\t<PreBuildEvent>\n"
|
||||
"\t\t\t<Message>Generate internal_version.h</Message>\n"
|
||||
"\t\t\t<Command>" << getPreBuildEvent() << "</Command>\n"
|
||||
"\t\t</PreBuildEvent>\n";
|
||||
}
|
||||
project << "\t\t<PreBuildEvent>\n"
|
||||
"\t\t\t<Message>Generate revision</Message>\n"
|
||||
"\t\t\t<Command>" << getPreBuildEvent() << "</Command>\n"
|
||||
"\t\t</PreBuildEvent>\n";
|
||||
|
||||
// Copy data files to the build folder
|
||||
project << "\t\t<PostBuildEvent>\n"
|
||||
|
@ -286,7 +283,7 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
|
|||
project << "\t</ItemDefinitionGroup>\n";
|
||||
}
|
||||
|
||||
void MSBuildProvider::outputGlobalPropFile(std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix) {
|
||||
void MSBuildProvider::outputGlobalPropFile(std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents) {
|
||||
|
||||
std::string warnings;
|
||||
for (StringList::const_iterator i = _globalWarnings.begin(); i != _globalWarnings.end(); ++i)
|
||||
|
@ -296,14 +293,18 @@ void MSBuildProvider::outputGlobalPropFile(std::ofstream &properties, int bits,
|
|||
for (StringList::const_iterator i = defines.begin(); i != defines.end(); ++i)
|
||||
definesList += *i + ';';
|
||||
|
||||
// Add define to include revision header
|
||||
if (runBuildEvents)
|
||||
definesList += REVISION_DEFINE ";";
|
||||
|
||||
properties << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
||||
"<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
|
||||
"\t<PropertyGroup>\n"
|
||||
"\t\t<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>\n"
|
||||
"\t\t<_PropertySheetDisplayName>Residual_Global</_PropertySheetDisplayName>\n"
|
||||
"\t\t<ExecutablePath>$(RESIDUAL_LIBS)\\bin;$(ExecutablePath)</ExecutablePath>\n"
|
||||
"\t\t<LibraryPath>$(RESIDUAL_LIBS)\\lib\\" << (bits == 32 ? "x86" : "x64") << ";$(LibraryPath)</LibraryPath>\n"
|
||||
"\t\t<IncludePath>$(RESIDUAL_LIBS)\\include;$(IncludePath)</IncludePath>\n"
|
||||
"\t\t<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>\n"
|
||||
"\t\t<_PropertySheetDisplayName>" << PROJECT_DESCRIPTION << "_Global</_PropertySheetDisplayName>\n"
|
||||
"\t\t<ExecutablePath>$(" << LIBS_DEFINE << ")\\bin;$(ExecutablePath)</ExecutablePath>\n"
|
||||
"\t\t<LibraryPath>$(" << LIBS_DEFINE << ")\\lib\\" << (bits == 32 ? "x86" : "x64") << ";$(LibraryPath)</LibraryPath>\n"
|
||||
"\t\t<IncludePath>$(" << LIBS_DEFINE << ")\\include;$(IncludePath)</IncludePath>\n"
|
||||
"\t\t<OutDir>$(Configuration)" << bits << "\\</OutDir>\n"
|
||||
"\t\t<IntDir>$(Configuration)" << bits << "/$(ProjectName)\\</IntDir>\n"
|
||||
"\t</PropertyGroup>\n"
|
||||
|
@ -311,11 +312,17 @@ void MSBuildProvider::outputGlobalPropFile(std::ofstream &properties, int bits,
|
|||
"\t\t<ClCompile>\n"
|
||||
"\t\t\t<DisableLanguageExtensions>true</DisableLanguageExtensions>\n"
|
||||
"\t\t\t<DisableSpecificWarnings>" << warnings << ";%(DisableSpecificWarnings)</DisableSpecificWarnings>\n"
|
||||
"\t\t\t<AdditionalIncludeDirectories>$(RESIDUAL_LIBS)\\include;" << prefix << ";" << prefix << "\\engines;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n"
|
||||
"\t\t\t<AdditionalIncludeDirectories>$(" << LIBS_DEFINE << ")\\include;" << prefix << ";" << prefix << "\\engines;$(TargetDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n"
|
||||
"\t\t\t<PreprocessorDefinitions>" << definesList << "%(PreprocessorDefinitions)</PreprocessorDefinitions>\n"
|
||||
"\t\t\t<ExceptionHandling></ExceptionHandling>\n"
|
||||
"\t\t\t<RuntimeTypeInfo>false</RuntimeTypeInfo>\n"
|
||||
"\t\t\t<WarningLevel>Level4</WarningLevel>\n"
|
||||
"\t\t\t<ExceptionHandling></ExceptionHandling>\n";
|
||||
|
||||
#if NEEDS_RTTI
|
||||
properties << "\t\t\t<RuntimeTypeInfo>true</RuntimeTypeInfo>\n";
|
||||
#else
|
||||
properties << "\t\t\t<RuntimeTypeInfo>false</RuntimeTypeInfo>\n";
|
||||
#endif
|
||||
|
||||
properties << "\t\t\t<WarningLevel>Level4</WarningLevel>\n"
|
||||
"\t\t\t<TreatWarningAsError>false</TreatWarningAsError>\n"
|
||||
"\t\t\t<CompileAs>Default</CompileAs>\n"
|
||||
"\t\t</ClCompile>\n"
|
||||
|
@ -338,18 +345,18 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b
|
|||
const std::string outputType = (enableAnalysis ? "Analysis" : (isRelease ? "Release" : "Debug"));
|
||||
const std::string outputBitness = (isWin32 ? "32" : "64");
|
||||
|
||||
std::ofstream properties((setup.outputDir + '/' + "Residual_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension()).c_str());
|
||||
std::ofstream properties((setup.outputDir + '/' + PROJECT_DESCRIPTION "_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension()).c_str());
|
||||
if (!properties)
|
||||
error("Could not open \"" + setup.outputDir + '/' + "Residual_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension() + "\" for writing");
|
||||
error("Could not open \"" + setup.outputDir + '/' + PROJECT_DESCRIPTION "_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension() + "\" for writing");
|
||||
|
||||
properties << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
||||
"<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
|
||||
"\t<ImportGroup Label=\"PropertySheets\">\n"
|
||||
"\t\t<Import Project=\"Residual_Global" << (isWin32 ? "" : "64") << ".props\" />\n"
|
||||
"\t\t<Import Project=\"" << PROJECT_DESCRIPTION << "_Global" << (isWin32 ? "" : "64") << ".props\" />\n"
|
||||
"\t</ImportGroup>\n"
|
||||
"\t<PropertyGroup>\n"
|
||||
"\t\t<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>\n"
|
||||
"\t\t<_PropertySheetDisplayName>Residual_" << outputType << outputBitness << "</_PropertySheetDisplayName>\n"
|
||||
"\t\t<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>\n"
|
||||
"\t\t<_PropertySheetDisplayName>" << PROJECT_DESCRIPTION << "_" << outputType << outputBitness << "</_PropertySheetDisplayName>\n"
|
||||
"\t\t<LinkIncremental>" << (isRelease ? "false" : "true") << "</LinkIncremental>\n"
|
||||
"\t</PropertyGroup>\n"
|
||||
"\t<ItemDefinitionGroup>\n"
|
||||
|
@ -439,9 +446,6 @@ void MSBuildProvider::writeFileListToProject(const FileNode &dir, std::ofstream
|
|||
projectFile << "\t\t<ClCompile Include=\"" << (*entry).path << "\">\n"
|
||||
"\t\t\t<ObjectFileName>$(IntDir)" << (*entry).prefix << "%(Filename).obj</ObjectFileName>\n";
|
||||
|
||||
if (hasEnding((*entry).path, "base\\version.cpp"))
|
||||
projectFile << "\t\t\t<PreprocessorDefinitions Condition=\"'$(Configuration)'=='Debug'\">RESIDUAL_REVISION#" $(RESIDUAL_REVISION_STRING)";%(PreprocessorDefinitions)</PreprocessorDefinitions>\n";
|
||||
|
||||
projectFile << "\t\t</ClCompile>\n";
|
||||
} else {
|
||||
projectFile << "\t\t<ClCompile Include=\"" << (*entry).path << "\" />\n";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue