From 6cf1de87acdb878e3a3e4ef7cc33d45adee4a592 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 9 Apr 2011 23:47:35 +0200 Subject: DEVTOOLS: Renamed 'tools' directory to 'devtools' --- devtools/create_project/msvc.cpp | 177 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 devtools/create_project/msvc.cpp (limited to 'devtools/create_project/msvc.cpp') diff --git a/devtools/create_project/msvc.cpp b/devtools/create_project/msvc.cpp new file mode 100644 index 0000000000..e2fff59c46 --- /dev/null +++ b/devtools/create_project/msvc.cpp @@ -0,0 +1,177 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "msvc.h" + +#include + +#include + +namespace CreateProjectTool { + +////////////////////////////////////////////////////////////////////////// +// MSVC Provider (Base class) +////////////////////////////////////////////////////////////////////////// +MSVCProvider::MSVCProvider(StringList &global_warnings, std::map &project_warnings, const int version) + : ProjectProvider(global_warnings, project_warnings, version) { +} + +void MSVCProvider::createWorkspace(const BuildSetup &setup) { + UUIDMap::const_iterator svmUUID = _uuidMap.find("scummvm"); + if (svmUUID == _uuidMap.end()) + error("No UUID for \"scummvm\" project created"); + + const std::string svmProjectUUID = svmUUID->second; + assert(!svmProjectUUID.empty()); + + std::string solutionUUID = createUUID(); + + std::ofstream solution((setup.outputDir + '/' + "scummvm.sln").c_str()); + if (!solution) + error("Could not open \"" + setup.outputDir + '/' + "scummvm.sln\" for writing"); + + solution << "Microsoft Visual Studio Solution File, Format Version " << _version + 1 << ".00\n"; + solution << "# Visual Studio " << getVisualStudioVersion() << "\n"; + + solution << "Project(\"{" << solutionUUID << "}\") = \"scummvm\", \"scummvm" << getProjectExtension() << "\", \"{" << svmProjectUUID << "}\"\n"; + + // Project dependencies are moved to vcxproj files in Visual Studio 2010 + if (_version < 10) + writeReferences(solution); + + solution << "EndProject\n"; + + // Note we assume that the UUID map only includes UUIDs for enabled engines! + for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) { + if (i->first == "scummvm") + continue; + + solution << "Project(\"{" << solutionUUID << "}\") = \"" << i->first << "\", \"" << i->first << getProjectExtension() << "\", \"{" << i->second << "}\"\n" + << "EndProject\n"; + } + + solution << "Global\n" + "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n" + "\t\tDebug|Win32 = Debug|Win32\n" + "\t\tAnalysis|Win32 = Analysis|Win32\n" + "\t\tRelease|Win32 = Release|Win32\n" + "\t\tDebug|x64 = Debug|x64\n" + "\t\tAnalysis|x64 = Analysis|x64\n" + "\t\tRelease|x64 = Release|x64\n" + "\tEndGlobalSection\n" + "\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n"; + + for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) { + solution << "\t\t{" << i->second << "}.Debug|Win32.ActiveCfg = Debug|Win32\n" + "\t\t{" << i->second << "}.Debug|Win32.Build.0 = Debug|Win32\n" + "\t\t{" << i->second << "}.Analysis|Win32.ActiveCfg = Analysis|Win32\n" + "\t\t{" << i->second << "}.Analysis|Win32.Build.0 = Analysis|Win32\n" + "\t\t{" << i->second << "}.Release|Win32.ActiveCfg = Release|Win32\n" + "\t\t{" << i->second << "}.Release|Win32.Build.0 = Release|Win32\n" + "\t\t{" << i->second << "}.Debug|x64.ActiveCfg = Debug|x64\n" + "\t\t{" << i->second << "}.Debug|x64.Build.0 = Debug|x64\n" + "\t\t{" << i->second << "}.Analysis|x64.ActiveCfg = Analysis|x64\n" + "\t\t{" << i->second << "}.Analysis|x64.Build.0 = Analysis|x64\n" + "\t\t{" << i->second << "}.Release|x64.ActiveCfg = Release|x64\n" + "\t\t{" << i->second << "}.Release|x64.Build.0 = Release|x64\n"; + } + + solution << "\tEndGlobalSection\n" + "\tGlobalSection(SolutionProperties) = preSolution\n" + "\t\tHideSolutionNode = FALSE\n" + "\tEndGlobalSection\n" + "EndGlobal\n"; +} + +void MSVCProvider::createOtherBuildFiles(const BuildSetup &setup) { + // Create the global property file + createGlobalProp(setup); + + // Create the configuration property files (for Debug and Release with 32 and 64bits versions) + // Note: we use the debug properties for the analysis configuration + createBuildProp(setup, true, false, false); + createBuildProp(setup, true, true, false); + createBuildProp(setup, false, false, false); + createBuildProp(setup, false, false, true); + createBuildProp(setup, false, true, false); + createBuildProp(setup, false, true, true); +} + +void MSVCProvider::createGlobalProp(const BuildSetup &setup) { + std::ofstream properties((setup.outputDir + '/' + "ScummVM_Global" + getPropertiesExtension()).c_str()); + if (!properties) + error("Could not open \"" + setup.outputDir + '/' + "ScummVM_Global" + getPropertiesExtension() + "\" for writing"); + + outputGlobalPropFile(properties, 32, setup.defines, convertPathToWin(setup.filePrefix)); + properties.close(); + + properties.open((setup.outputDir + '/' + "ScummVM_Global64" + getPropertiesExtension()).c_str()); + if (!properties) + error("Could not open \"" + setup.outputDir + '/' + "ScummVM_Global64" + getPropertiesExtension() + "\" for writing"); + + // HACK: We must disable the "nasm" feature for x64. To achieve that we must duplicate the feature list and + // recreate a define list. + FeatureList x64Features = setup.features; + setFeatureBuildState("nasm", x64Features, false); + StringList x64Defines = getFeatureDefines(x64Features); + StringList x64EngineDefines = getEngineDefines(setup.engines); + x64Defines.splice(x64Defines.end(), x64EngineDefines); + + // HACK: This definitly should not be here, but otherwise we would not define SDL_BACKEND for x64. + x64Defines.push_back("WIN32"); + x64Defines.push_back("SDL_BACKEND"); + + outputGlobalPropFile(properties, 64, x64Defines, convertPathToWin(setup.filePrefix)); +} + +std::string MSVCProvider::getPreBuildEvent() const { + std::string cmdLine = ""; + + cmdLine = "@echo off\n" + "echo Executing Pre-Build script...\n" + "echo.\n" + "@call "$(SolutionDir)../../devtools/create_project/scripts/prebuild.cmd" "$(SolutionDir)/../.."\n" + "EXIT /B0"; + + return cmdLine; +} + +std::string MSVCProvider::getPostBuildEvent(bool isWin32) const { + std::string cmdLine = ""; + + cmdLine = "@echo off\n" + "echo Executing Post-Build script...\n" + "echo.\n" + "@call "$(SolutionDir)../../devtools/create_project/scripts/postbuild.cmd" "$(SolutionDir)/../.." "$(OutDir)" "; + + cmdLine += (isWin32) ? "x86" : "x64"; + + cmdLine += "\n" + "EXIT /B0"; + + return cmdLine; +} + +} // End of CreateProjectTool namespace -- 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/msvc.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'devtools/create_project/msvc.cpp') diff --git a/devtools/create_project/msvc.cpp b/devtools/create_project/msvc.cpp index e2fff59c46..ccdf4ac82b 100644 --- a/devtools/create_project/msvc.cpp +++ b/devtools/create_project/msvc.cpp @@ -124,7 +124,7 @@ void MSVCProvider::createGlobalProp(const BuildSetup &setup) { if (!properties) error("Could not open \"" + setup.outputDir + '/' + "ScummVM_Global" + getPropertiesExtension() + "\" for writing"); - outputGlobalPropFile(properties, 32, setup.defines, convertPathToWin(setup.filePrefix)); + outputGlobalPropFile(properties, 32, setup.defines, convertPathToWin(setup.filePrefix), setup.runBuildEvents); properties.close(); properties.open((setup.outputDir + '/' + "ScummVM_Global64" + getPropertiesExtension()).c_str()); @@ -143,7 +143,7 @@ void MSVCProvider::createGlobalProp(const BuildSetup &setup) { x64Defines.push_back("WIN32"); x64Defines.push_back("SDL_BACKEND"); - outputGlobalPropFile(properties, 64, x64Defines, convertPathToWin(setup.filePrefix)); + outputGlobalPropFile(properties, 64, x64Defines, convertPathToWin(setup.filePrefix), setup.runBuildEvents); } std::string MSVCProvider::getPreBuildEvent() const { @@ -152,7 +152,7 @@ std::string MSVCProvider::getPreBuildEvent() const { cmdLine = "@echo off\n" "echo Executing Pre-Build script...\n" "echo.\n" - "@call "$(SolutionDir)../../devtools/create_project/scripts/prebuild.cmd" "$(SolutionDir)/../.."\n" + "@call "$(SolutionDir)../../devtools/create_project/scripts/prebuild.cmd" "$(SolutionDir)/../.." "$(TargetDir)"\n" "EXIT /B0"; return cmdLine; -- cgit v1.2.3 From 878d72b387d13bdb7713b142abae32bc28a51047 Mon Sep 17 00:00:00 2001 From: Littleboy Date: Sun, 24 Apr 2011 13:33:23 -0400 Subject: CREATE_PROJECT: Move project-specific information to configuration file User-visible output and project-specific names are now defined in a config header. This allows an easier usage of the create_project tools in other scummvm-derived projects (such as residual). --- devtools/create_project/msvc.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'devtools/create_project/msvc.cpp') diff --git a/devtools/create_project/msvc.cpp b/devtools/create_project/msvc.cpp index ccdf4ac82b..49998cd738 100644 --- a/devtools/create_project/msvc.cpp +++ b/devtools/create_project/msvc.cpp @@ -23,10 +23,10 @@ * */ +#include "config.h" #include "msvc.h" #include - #include namespace CreateProjectTool { @@ -39,23 +39,23 @@ MSVCProvider::MSVCProvider(StringList &global_warnings, std::mapsecond; assert(!svmProjectUUID.empty()); std::string solutionUUID = createUUID(); - std::ofstream solution((setup.outputDir + '/' + "scummvm.sln").c_str()); + std::ofstream solution((setup.outputDir + '/' + PROJECT_NAME ".sln").c_str()); if (!solution) - error("Could not open \"" + setup.outputDir + '/' + "scummvm.sln\" for writing"); + error("Could not open \"" + setup.outputDir + '/' + PROJECT_NAME ".sln\" for writing"); solution << "Microsoft Visual Studio Solution File, Format Version " << _version + 1 << ".00\n"; solution << "# Visual Studio " << getVisualStudioVersion() << "\n"; - solution << "Project(\"{" << solutionUUID << "}\") = \"scummvm\", \"scummvm" << getProjectExtension() << "\", \"{" << svmProjectUUID << "}\"\n"; + solution << "Project(\"{" << solutionUUID << "}\") = \"" << PROJECT_NAME << "\", \"" << PROJECT_NAME << getProjectExtension() << "\", \"{" << svmProjectUUID << "}\"\n"; // Project dependencies are moved to vcxproj files in Visual Studio 2010 if (_version < 10) @@ -65,7 +65,7 @@ void MSVCProvider::createWorkspace(const BuildSetup &setup) { // Note we assume that the UUID map only includes UUIDs for enabled engines! for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) { - if (i->first == "scummvm") + if (i->first == PROJECT_NAME) continue; solution << "Project(\"{" << solutionUUID << "}\") = \"" << i->first << "\", \"" << i->first << getProjectExtension() << "\", \"{" << i->second << "}\"\n" @@ -120,16 +120,16 @@ void MSVCProvider::createOtherBuildFiles(const BuildSetup &setup) { } void MSVCProvider::createGlobalProp(const BuildSetup &setup) { - std::ofstream properties((setup.outputDir + '/' + "ScummVM_Global" + getPropertiesExtension()).c_str()); + std::ofstream properties((setup.outputDir + '/' + PROJECT_DESCRIPTION "_Global" + getPropertiesExtension()).c_str()); if (!properties) - error("Could not open \"" + setup.outputDir + '/' + "ScummVM_Global" + getPropertiesExtension() + "\" for writing"); + error("Could not open \"" + setup.outputDir + '/' + PROJECT_DESCRIPTION "_Global" + getPropertiesExtension() + "\" for writing"); outputGlobalPropFile(properties, 32, setup.defines, convertPathToWin(setup.filePrefix), setup.runBuildEvents); properties.close(); - properties.open((setup.outputDir + '/' + "ScummVM_Global64" + getPropertiesExtension()).c_str()); + properties.open((setup.outputDir + '/' + PROJECT_DESCRIPTION "_Global64" + getPropertiesExtension()).c_str()); if (!properties) - error("Could not open \"" + setup.outputDir + '/' + "ScummVM_Global64" + getPropertiesExtension() + "\" for writing"); + error("Could not open \"" + setup.outputDir + '/' + PROJECT_DESCRIPTION "_Global64" + getPropertiesExtension() + "\" for writing"); // HACK: We must disable the "nasm" feature for x64. To achieve that we must duplicate the feature list and // recreate a define list. @@ -168,6 +168,8 @@ std::string MSVCProvider::getPostBuildEvent(bool isWin32) const { cmdLine += (isWin32) ? "x86" : "x64"; + cmdLine += " %SCUMMVM_LIBS%"; + cmdLine += "\n" "EXIT /B0"; -- cgit v1.2.3