CREATE_PROJECT: Update revision number support (fixes bug #3280881)

Replace existing environment variable based revision number support by a file-based method
 - Generate a special header file in the build output folder with the current revision number
 - Include the new header file from internal_version.h when a specific define is set
 - Update create_project to define SCUMMVM_INTERNAL_REVISION as needed and add the build output folder to the include path
 - Remove support for git-svn clones in the revision script (not useful anymore after the switch to git)
This commit is contained in:
Littleboy 2011-04-24 12:34:57 -04:00
parent 4f708b0212
commit 11b907ebf4
12 changed files with 86 additions and 53 deletions

View file

@ -283,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)
@ -293,6 +293,10 @@ 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 += "SCUMMVM_INTERNAL_REVISION;";
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"
@ -308,7 +312,7 @@ 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>$(SCUMMVM_LIBS)\\include;" << prefix << ";" << prefix << "\\engines;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n"
"\t\t\t<AdditionalIncludeDirectories>$(SCUMMVM_LIBS)\\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"
@ -436,9 +440,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'\">SCUMMVM_REVISION#&quot; $(SCUMMVM_REVISION_STRING)&quot;;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n";
projectFile << "\t\t</ClCompile>\n";
} else {
projectFile << "\t\t<ClCompile Include=\"" << (*entry).path << "\" />\n";