From 1f660237a4c5b4e80af6515848e6cf0bcd7c74bc Mon Sep 17 00:00:00 2001 From: Littleboy Date: Fri, 22 Apr 2011 14:10:14 -0400 Subject: CREATE_PROJECT: Change build events to also be run in release builds Unofficial builds using MSVC in release mode will benefit from having a revision number available --- devtools/create_project/visualstudio.cpp | 34 ++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'devtools/create_project/visualstudio.cpp') diff --git a/devtools/create_project/visualstudio.cpp b/devtools/create_project/visualstudio.cpp index 2b7c8908cb..390d0fba1f 100644 --- a/devtools/create_project/visualstudio.cpp +++ b/devtools/create_project/visualstudio.cpp @@ -57,13 +57,24 @@ int VisualStudioProvider::getVisualStudioVersion() { error("Unsupported version passed to createScummVMSolution"); } -#define OUTPUT_CONFIGURATION_SCUMMVM(config, platform, props) { \ +#define OUTPUT_BUILD_EVENTS(isWin32) \ + if (setup.runBuildEvents) { \ + project << "\t\t\t\n" \ + "\t\t\t\n"; \ + } + +#define OUTPUT_CONFIGURATION_SCUMMVM(config, platform, props, isWin32) { \ project << "\t\t\n" \ "\t\t\t\n" \ "\t\t\t\n" \ - "\t\t\n"; \ + "\t\t\t/>\n"; \ + OUTPUT_BUILD_EVENTS(isWin32) \ + project << "\t\t\n"; \ } #define OUTPUT_CONFIGURATION_SCUMMVM_DEBUG(config, platform, props, isWin32) { \ @@ -72,14 +83,7 @@ int VisualStudioProvider::getVisualStudioVersion() { "\t\t\t\n"; \ - if (setup.runBuildEvents) { \ - project << "\t\t\t\n" \ - "\t\t\t\n"; \ - } \ + OUTPUT_BUILD_EVENTS(isWin32) \ project << "\t\t\n"; \ } @@ -127,15 +131,15 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std: // Win32 OUTPUT_CONFIGURATION_SCUMMVM_DEBUG("Debug", "Win32", "", true); OUTPUT_CONFIGURATION_SCUMMVM_DEBUG("Analysis", "Win32", "", true); - OUTPUT_CONFIGURATION_SCUMMVM("Release", "Win32", ""); + OUTPUT_CONFIGURATION_SCUMMVM("Release", "Win32", "", true); // 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! - OUTPUT_CONFIGURATION_SCUMMVM_DEBUG("Debug", "x64", "64", true); - OUTPUT_CONFIGURATION_SCUMMVM_DEBUG("Analysis", "x64", "64", true); - OUTPUT_CONFIGURATION_SCUMMVM("Release", "x64", "64"); + OUTPUT_CONFIGURATION_SCUMMVM_DEBUG("Debug", "x64", "64", false); + OUTPUT_CONFIGURATION_SCUMMVM_DEBUG("Analysis", "x64", "64", false); + OUTPUT_CONFIGURATION_SCUMMVM("Release", "x64", "64", false); } else { std::string warnings = ""; -- cgit v1.2.3 From 11b907ebf45f5a0707c2748b8f7413b2910976a8 Mon Sep 17 00:00:00 2001 From: Littleboy Date: Sun, 24 Apr 2011 12:34:57 -0400 Subject: 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) --- devtools/create_project/visualstudio.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'devtools/create_project/visualstudio.cpp') diff --git a/devtools/create_project/visualstudio.cpp b/devtools/create_project/visualstudio.cpp index 390d0fba1f..41693dcc3a 100644 --- a/devtools/create_project/visualstudio.cpp +++ b/devtools/create_project/visualstudio.cpp @@ -193,7 +193,7 @@ void VisualStudioProvider::writeReferences(std::ofstream &output) { output << "\tEndProjectSection\n"; } -void VisualStudioProvider::outputGlobalPropFile(std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix) { +void VisualStudioProvider::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) warnings += *i + ';'; @@ -205,6 +205,10 @@ void VisualStudioProvider::outputGlobalPropFile(std::ofstream &properties, int b definesList += *i; } + // Add define to include revision header + if (runBuildEvents) + definesList += "SCUMMVM_INTERNAL_REVISION;"; + properties << "\n" " - #include namespace CreateProjectTool { @@ -54,7 +54,7 @@ int VisualStudioProvider::getVisualStudioVersion() { if (_version == 8) return 2005; - error("Unsupported version passed to createScummVMSolution"); + error("Unsupported version passed to getVisualStudioVersion"); } #define OUTPUT_BUILD_EVENTS(isWin32) \ @@ -67,20 +67,20 @@ int VisualStudioProvider::getVisualStudioVersion() { "\t\t\t/>\n"; \ } -#define OUTPUT_CONFIGURATION_SCUMMVM(config, platform, props, isWin32) { \ - project << "\t\t\n" \ +#define OUTPUT_CONFIGURATION_MAIN(config, platform, props, isWin32) { \ + project << "\t\t\n" \ "\t\t\t\n" \ - "\t\t\t\n"; \ OUTPUT_BUILD_EVENTS(isWin32) \ project << "\t\t\n"; \ } -#define OUTPUT_CONFIGURATION_SCUMMVM_DEBUG(config, platform, props, isWin32) { \ - project << "\t\t\n" \ +#define OUTPUT_CONFIGURATION_DEBUG(config, platform, props, isWin32) { \ + project << "\t\t\n" \ "\t\t\t\n" \ - "\t\t\t\n"; \ OUTPUT_BUILD_EVENTS(isWin32) \ @@ -88,7 +88,7 @@ int VisualStudioProvider::getVisualStudioVersion() { } #define OUTPUT_CONFIGURATION(config, platform, props) { \ - project << "\t\t\n" \ + project << "\t\t\n" \ "\t\t\t\n" \ "\t\t\n"; \ } @@ -122,24 +122,24 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std: // Check for project-specific warnings: std::map< std::string, std::list >::iterator warningsIterator = _projectWarnings.find(name); - if (name == "scummvm") { + if (name == PROJECT_NAME) { std::string libraries; for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i) libraries += ' ' + *i + ".lib"; // Win32 - OUTPUT_CONFIGURATION_SCUMMVM_DEBUG("Debug", "Win32", "", true); - OUTPUT_CONFIGURATION_SCUMMVM_DEBUG("Analysis", "Win32", "", true); - OUTPUT_CONFIGURATION_SCUMMVM("Release", "Win32", "", true); + OUTPUT_CONFIGURATION_DEBUG("Debug", "Win32", "", true); + OUTPUT_CONFIGURATION_DEBUG("Analysis", "Win32", "", true); + OUTPUT_CONFIGURATION_MAIN("Release", "Win32", "", true); // 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! - OUTPUT_CONFIGURATION_SCUMMVM_DEBUG("Debug", "x64", "64", false); - OUTPUT_CONFIGURATION_SCUMMVM_DEBUG("Analysis", "x64", "64", false); - OUTPUT_CONFIGURATION_SCUMMVM("Release", "x64", "64", false); + OUTPUT_CONFIGURATION_DEBUG("Debug", "x64", "64", false); + OUTPUT_CONFIGURATION_DEBUG("Analysis", "x64", "64", false); + OUTPUT_CONFIGURATION_MAIN("Release", "x64", "64", false); } else { std::string warnings = ""; @@ -151,6 +151,7 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std: toolConfig = (!warnings.empty() ? "DisableSpecificWarnings=\"" + warnings + "\"" : ""); toolConfig += (name == "tinsel" ? "DebugInformationFormat=\"3\" " : ""); toolConfig += (name == "sword25" ? "DisableLanguageExtensions=\"false\" " : ""); + toolConfig += (name == "grim" ? "DisableLanguageExtensions=\"false\" " : ""); // Win32 OUTPUT_CONFIGURATION("Debug", "Win32", ""); @@ -184,7 +185,7 @@ void VisualStudioProvider::writeReferences(std::ofstream &output) { output << "\tProjectSection(ProjectDependencies) = postProject\n"; for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) { - if (i->first == "scummvm") + if (i->first == PROJECT_NAME) continue; output << "\t\t{" << i->second << "} = {" << i->second << "}\n"; @@ -207,13 +208,13 @@ void VisualStudioProvider::outputGlobalPropFile(std::ofstream &properties, int b // Add define to include revision header if (runBuildEvents) - definesList += "SCUMMVM_INTERNAL_REVISION;"; + definesList += REVISION_DEFINE ";"; properties << "\n" "\n" @@ -221,10 +222,17 @@ void VisualStudioProvider::outputGlobalPropFile(std::ofstream &properties, int b "\t\tName=\"VCCLCompilerTool\"\n" "\t\tDisableLanguageExtensions=\"true\"\n" "\t\tDisableSpecificWarnings=\"" << warnings << "\"\n" - "\t\tAdditionalIncludeDirectories=\"" << prefix << ";" << prefix << "\\engines;$(SCUMMVM_LIBS)\\include;$(TargetDir)\"\n" + "\t\tAdditionalIncludeDirectories=\"" << prefix << ";" << prefix << "\\engines;$(" << LIBS_DEFINE << ")\\include;$(TargetDir)\"\n" "\t\tPreprocessorDefinitions=\"" << definesList << "\"\n" - "\t\tExceptionHandling=\"0\"\n" - "\t\tRuntimeTypeInfo=\"false\"\n" + "\t\tExceptionHandling=\"0\"\n"; + +#if NEEDS_RTTI + properties << "\t\tRuntimeTypeInfo=\"true\"\n"; +#else + properties << "\t\tRuntimeTypeInfo=\"false\"\n"; +#endif + + properties << "\t\tRuntimeTypeInfo=\"false\"\n" "\t\tWarningLevel=\"4\"\n" "\t\tWarnAsError=\"false\"\n" "\t\tCompileAs=\"0\"\n" @@ -238,7 +246,7 @@ void VisualStudioProvider::outputGlobalPropFile(std::ofstream &properties, int b "\t\tIgnoreDefaultLibraryNames=\"\"\n" "\t\tSubSystem=\"1\"\n" "\t\tEntryPointSymbol=\"WinMainCRTStartup\"\n" - "\t\tAdditionalLibraryDirectories=\"$(SCUMMVM_LIBS)\\lib\\" << ((bits == 32) ? "x86" : "x64") << "\"\n" + "\t\tAdditionalLibraryDirectories=\"$(" << LIBS_DEFINE << ")\\lib\\" << ((bits == 32) ? "x86" : "x64") << "\"\n" "\t/>\n" "\t\n" "\n" "\t\n" \ "\t\t\t\n"; \ } -- cgit v1.2.3 From 1279264c373ad7f84a1a500ab9514e16847f1812 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 28 Apr 2011 17:44:17 +0200 Subject: CREATE_PROJECT: Replace macros by proper functions/methods. --- devtools/create_project/visualstudio.cpp | 89 ++++++++++++++------------------ 1 file changed, 40 insertions(+), 49 deletions(-) (limited to 'devtools/create_project/visualstudio.cpp') diff --git a/devtools/create_project/visualstudio.cpp b/devtools/create_project/visualstudio.cpp index 2997e3096a..77af8aeca1 100644 --- a/devtools/create_project/visualstudio.cpp +++ b/devtools/create_project/visualstudio.cpp @@ -57,42 +57,6 @@ int VisualStudioProvider::getVisualStudioVersion() { error("Unsupported version passed to getVisualStudioVersion"); } -#define OUTPUT_BUILD_EVENTS(isWin32) \ - if (setup.runBuildEvents) { \ - project << "\t\t\t\n" \ - "\t\t\t\n"; \ - } - -#define OUTPUT_CONFIGURATION_MAIN(config, platform, props, isWin32) { \ - project << "\t\t\n" \ - "\t\t\t\n" \ - "\t\t\t\n"; \ - OUTPUT_BUILD_EVENTS(isWin32) \ - project << "\t\t\n"; \ -} - -#define OUTPUT_CONFIGURATION_DEBUG(config, platform, props, isWin32) { \ - project << "\t\t\n" \ - "\t\t\t\n" \ - "\t\t\t\n"; \ - OUTPUT_BUILD_EVENTS(isWin32) \ - project << "\t\t\n"; \ -} - -#define OUTPUT_CONFIGURATION(config, platform, props) { \ - project << "\t\t\n" \ - "\t\t\t\n" \ - "\t\t\n"; \ -} - void VisualStudioProvider::createProjectFile(const std::string &name, const std::string &uuid, const BuildSetup &setup, const std::string &moduleDir, const StringList &includeList, const StringList &excludeList) { const std::string projectFile = setup.outputDir + '/' + name + getProjectExtension(); @@ -129,17 +93,17 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std: libraries += ' ' + *i + ".lib"; // Win32 - OUTPUT_CONFIGURATION_DEBUG("Debug", "Win32", "", true); - OUTPUT_CONFIGURATION_DEBUG("Analysis", "Win32", "", true); - OUTPUT_CONFIGURATION_MAIN("Release", "Win32", "", true); + outputConfiguration(project, setup, libraries, "Debug", "Win32", "", true); + outputConfiguration(project, setup, libraries, "Analysis", "Win32", "", true); + outputConfiguration(project, setup, libraries, "Release", "Win32", "", true); // 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! - OUTPUT_CONFIGURATION_DEBUG("Debug", "x64", "64", false); - OUTPUT_CONFIGURATION_DEBUG("Analysis", "x64", "64", false); - OUTPUT_CONFIGURATION_MAIN("Release", "x64", "64", false); + outputConfiguration(project, setup, libraries, "Debug", "x64", "64", false); + outputConfiguration(project, setup, libraries, "Analysis", "x64", "64", false); + outputConfiguration(project, setup, libraries, "Release", "x64", "64", false); } else { std::string warnings = ""; @@ -154,12 +118,12 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std: toolConfig += (name == "grim" ? "DisableLanguageExtensions=\"false\" " : ""); // Win32 - OUTPUT_CONFIGURATION("Debug", "Win32", ""); - OUTPUT_CONFIGURATION("Analysis", "Win32", ""); - OUTPUT_CONFIGURATION("Release", "Win32", ""); - OUTPUT_CONFIGURATION("Debug", "x64", "64"); - OUTPUT_CONFIGURATION("Analysis", "x64", "64"); - OUTPUT_CONFIGURATION("Release", "x64", "64"); + outputConfiguration(project, toolConfig, "Debug", "Win32", ""); + outputConfiguration(project, toolConfig, "Analysis", "Win32", ""); + outputConfiguration(project, toolConfig, "Release", "Win32", ""); + outputConfiguration(project, toolConfig, "Debug", "x64", "64"); + outputConfiguration(project, toolConfig, "Analysis", "x64", "64"); + outputConfiguration(project, toolConfig, "Release", "x64", "64"); } project << "\t\n" @@ -181,6 +145,33 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std: "\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) { + project << "\t\t\n" + "\t\t\t\n" + "\t\t\t\n"; + outputBuildEvents(project, setup, isWin32); + project << "\t\t\n"; +} + +void VisualStudioProvider::outputConfiguration(std::ostream &project, const std::string &toolConfig, const std::string &config, const std::string &platform, const std::string &props) { + project << "\t\t\n" + "\t\t\t\n" + "\t\t\n"; +} + +void VisualStudioProvider::outputBuildEvents(std::ostream &project, const BuildSetup &setup, const bool isWin32) { + if (setup.runBuildEvents) { + project << "\t\t\t\n" + "\t\t\t\n"; + } +} + void VisualStudioProvider::writeReferences(std::ofstream &output) { output << "\tProjectSection(ProjectDependencies) = postProject\n"; @@ -298,7 +289,7 @@ void VisualStudioProvider::createBuildProp(const BuildSetup &setup, bool isRelea "\t\tRuntimeLibrary=\"1\"\n" "\t\tEnableFunctionLevelLinking=\"true\"\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=\"" << (isWin32 ? "4" : "3") << "\"\n" // For x64 format "4" (Edit and continue) is not supported, thus we default to "3" "\t\tAdditionalOption=\"" << (enableAnalysis ? "/analyze" : "") << "\"\n" "\t/>\n" "\t\n" "\t\n" "\n"; -- cgit v1.2.3 From 3758dcbbcc6006aa2d16b90501fd0ea818a47d79 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 6 May 2011 19:39:12 +1000 Subject: DEVTOOLS: Bugfix for CREATE_PROJECT creating duplicate tag in Visual Studio projects --- devtools/create_project/visualstudio.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'devtools/create_project/visualstudio.cpp') diff --git a/devtools/create_project/visualstudio.cpp b/devtools/create_project/visualstudio.cpp index f0901907e2..3acb283652 100644 --- a/devtools/create_project/visualstudio.cpp +++ b/devtools/create_project/visualstudio.cpp @@ -223,8 +223,7 @@ void VisualStudioProvider::outputGlobalPropFile(std::ofstream &properties, int b properties << "\t\tRuntimeTypeInfo=\"false\"\n"; #endif - properties << "\t\tRuntimeTypeInfo=\"false\"\n" - "\t\tWarningLevel=\"4\"\n" + properties << "\t\tWarningLevel=\"4\"\n" "\t\tWarnAsError=\"false\"\n" "\t\tCompileAs=\"0\"\n" "\t\t/>\n" -- cgit v1.2.3 From c35ef00c4a10bcd4d1c8d8e57d8a368b879fb059 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 6 May 2011 21:09:44 +1000 Subject: DEVTOOLS: Fix linking failure in Visual Studio created project --- devtools/create_project/visualstudio.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'devtools/create_project/visualstudio.cpp') diff --git a/devtools/create_project/visualstudio.cpp b/devtools/create_project/visualstudio.cpp index 3acb283652..a7a6ac84a7 100644 --- a/devtools/create_project/visualstudio.cpp +++ b/devtools/create_project/visualstudio.cpp @@ -148,7 +148,7 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std: 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) { project << "\t\t\n" "\t\t\t\n" - "\t\t\t\n"; outputBuildEvents(project, setup, isWin32); -- cgit v1.2.3