diff options
author | Julien Templier | 2010-11-23 11:14:17 +0000 |
---|---|---|
committer | Julien Templier | 2010-11-23 11:14:17 +0000 |
commit | 569ad6caba1287810ff09b76133a0dae675da1f9 (patch) | |
tree | cc611d7820f9fdb9c63003a2046911544c8d8e30 /tools/create_project/msvc.cpp | |
parent | 7711cc57d6777efa8591ea794912b1400faa250e (diff) | |
download | scummvm-rg350-569ad6caba1287810ff09b76133a0dae675da1f9.tar.gz scummvm-rg350-569ad6caba1287810ff09b76133a0dae675da1f9.tar.bz2 scummvm-rg350-569ad6caba1287810ff09b76133a0dae675da1f9.zip |
TOOLS: Extract revision from svn/hg/git at build time in Visual Studio
- Simplify custom file output (for VS2010)
- Fix postbuild.cmd error output
svn-id: r54423
Diffstat (limited to 'tools/create_project/msvc.cpp')
-rw-r--r-- | tools/create_project/msvc.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/tools/create_project/msvc.cpp b/tools/create_project/msvc.cpp index c6174f7bd4..3d537b989d 100644 --- a/tools/create_project/msvc.cpp +++ b/tools/create_project/msvc.cpp @@ -873,10 +873,6 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b projectFile << "\t\t\t<Command Condition=\"'$(Configuration)|$(Platform)'=='" << config << "|Win32'\">nasm.exe -f win32 -g -o \"$(IntDir)" << (isDuplicate ? (*entry).prefix : "") << "%(Filename).obj\" \"%(FullPath)\"</Command>\n" \ "\t\t\t<Outputs Condition=\"'$(Configuration)|$(Platform)'=='" << config << "|Win32'\">$(IntDir)" << (isDuplicate ? (*entry).prefix : "") << "%(Filename).obj;%(Outputs)</Outputs>\n"; -#define OUPUT_OBJECT_FILENAME_MSBUILD(config, platform, prefix) \ - projectFile << "\t\t<ObjectFileName Condition=\"'$(Configuration)|$(Platform)'=='" << config << "|" << platform << "'\">$(IntDir)" << prefix << "%(Filename).obj</ObjectFileName>\n" \ - "\t\t<XMLDocumentationFileName Condition=\"'$(Configuration)|$(Platform)'=='" << config << "|" << platform << "'\">$(IntDir)" << prefix << "%(Filename).xdc</XMLDocumentationFileName>\n"; - #define OUPUT_FILES_MSBUILD(files, action) \ if (!files.empty()) { \ projectFile << "\t<ItemGroup>\n"; \ @@ -886,6 +882,15 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b projectFile << "\t</ItemGroup>\n"; \ } +bool hasEnding(std::string const &fullString, std::string const &ending) { + if (fullString.length() > ending.length()) { + return (0 == fullString.compare (fullString.length() - ending.length(), ending.length(), ending)); + } else { + return false; + } +} + + void MSBuildProvider::writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int, const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix) { // Reset lists @@ -909,13 +914,12 @@ void MSBuildProvider::writeFileListToProject(const FileNode &dir, std::ofstream // Deal with duplicated file names if (isDuplicate) { - projectFile << "\t\t<ClCompile Include=\"" << (*entry).path << "\">\n"; - OUPUT_OBJECT_FILENAME_MSBUILD("Debug", "Win32", (*entry).prefix) - OUPUT_OBJECT_FILENAME_MSBUILD("Debug", "x64", (*entry).prefix) - OUPUT_OBJECT_FILENAME_MSBUILD("Analysis", "Win32", (*entry).prefix) - OUPUT_OBJECT_FILENAME_MSBUILD("Analysis", "x64", (*entry).prefix) - OUPUT_OBJECT_FILENAME_MSBUILD("Release", "Win32", (*entry).prefix) - OUPUT_OBJECT_FILENAME_MSBUILD("Release", "x64", (*entry).prefix) + 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_SVN_REVISION#" $(SCUMMVM_REVISION_STRING)";%(PreprocessorDefinitions)</PreprocessorDefinitions>\n"; + projectFile << "\t\t</ClCompile>\n"; } else { projectFile << "\t\t<ClCompile Include=\"" << (*entry).path << "\" />\n"; |