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).
This commit is contained in:
Littleboy 2011-04-24 13:33:23 -04:00
parent 11b907ebf4
commit 878d72b387
13 changed files with 209 additions and 127 deletions

View file

@ -23,10 +23,10 @@
*
*/
#include "config.h"
#include "msvc.h"
#include <fstream>
#include <algorithm>
namespace CreateProjectTool {
@ -39,23 +39,23 @@ MSVCProvider::MSVCProvider(StringList &global_warnings, std::map<std::string, St
}
void MSVCProvider::createWorkspace(const BuildSetup &setup) {
UUIDMap::const_iterator svmUUID = _uuidMap.find("scummvm");
UUIDMap::const_iterator svmUUID = _uuidMap.find(PROJECT_NAME);
if (svmUUID == _uuidMap.end())
error("No UUID for \"scummvm\" project created");
error("No UUID for \"" PROJECT_NAME "\" project created");
const std::string svmProjectUUID = svmUUID->second;
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";