From 4b1a8c4d5f8506a78e7af0df4c1c3e9ca6074bbe Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 26 Oct 2009 22:32:55 +0000 Subject: - Add support for AMD64 (x64) builds in automatically generated MSVC project files. - Fixed some file prefix bug, introduced when allowing to overwrite the file prefix via command line. svn-id: r45424 --- tools/create_msvc/create_msvc.cpp | 184 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 178 insertions(+), 6 deletions(-) diff --git a/tools/create_msvc/create_msvc.cpp b/tools/create_msvc/create_msvc.cpp index 8cfed79ebf..1b4d2068e9 100644 --- a/tools/create_msvc/create_msvc.cpp +++ b/tools/create_msvc/create_msvc.cpp @@ -767,6 +767,8 @@ void createScummVMSolution(const BuildSetup &setup, const UUIDMap &uuids, const "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n" "\t\tDebug|Win32 = Debug|Win32\n" "\t\tRelease|Win32 = Release|Win32\n" + "\t\tDebug|x64 = Debug|x64\n" + "\t\tRelease|x64 = Release|x64\n" "\tEndGlobalSection\n" "\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n"; @@ -774,7 +776,11 @@ void createScummVMSolution(const BuildSetup &setup, const UUIDMap &uuids, const 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 << "}.Release|Win32.ActiveCfg = Release|Win32\n" - << "\t\t{" << i->second << "}.Release|Win32.Build.0 = 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 << "}.Release|x64.ActiveCfg = Release|x64\n" + << "\t\t{" << i->second << "}.Release|x64.Build.0 = Release|x64\n"; } solution << "\tEndGlobalSection\n" @@ -806,6 +812,7 @@ void createProjectFile(const std::string &name, const std::string &uuid, const B project << "\t>\n" "\t\n" "\t\t\n" + "\t\t\n" "\t\n" "\t\n"; @@ -815,6 +822,7 @@ void createProjectFile(const std::string &name, const std::string &uuid, const B for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i) libraries += ' ' + *i; + // Win32 project << "\t\t\n" "\t\t\t\n" "\t\t\n"; + + // 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! + project << "\t\t\n" + "\t\t\t\n" + "\t\t\n" + "\t\t\n" + "\t\t\t\n" + "\t\t\n"; } else if (name == "tinsel") { + // Win32 project << "\t\t\n" "\t\t\t\n" "\t\t\n" "\t\t\n"; + // x64 + project << "\t\t\n" + "\t\t\t\n" + "\t\t\n" + "\t\t\n"; } else { + // Win32 project << "\t\t\n" "\t\t\n"; + // x64 + project << "\t\t\n" + "\t\t\n"; } project << "\t\n" "\t\n"; - addFilesToProject(moduleDir, project, includeList, excludeList, setup.filePrefix); + std::string modulePath; + if (!moduleDir.compare(0, setup.srcDir.size(), setup.srcDir)) + modulePath = moduleDir.substr(setup.srcDir.size()); + + if (modulePath.size()) + addFilesToProject(moduleDir, project, includeList, excludeList, setup.filePrefix + '/' + modulePath); + else + addFilesToProject(moduleDir, project, includeList, excludeList, setup.filePrefix); project << "\t\n" "\n"; @@ -860,13 +900,71 @@ void createGlobalProp(const BuildSetup &setup, const int /*version*/) { "\tProjectType=\"Visual C++\"\n" "\tVersion=\"8.00\"\n" "\tName=\"ScummVM_Global\"\n" - "\tOutputDirectory=\"$(ConfigurationName)\"\n" - "\tIntermediateDirectory=\"$(ConfigurationName)/$(ProjectName)\"\n" + "\tOutputDirectory=\"$(ConfigurationName)32\"\n" + "\tIntermediateDirectory=\"$(ConfigurationName)32/$(ProjectName)\"\n" + "\t>\n" + "\t\n" + "\t\n" + "\t\n" + "\t\n" + "\n"; + + properties.flush(); + properties.close(); + + properties.open((setup.outputDir + '/' + "ScummVM_Global64.vsprops").c_str()); + if (!properties) + throw std::string("Could not open \"" + setup.outputDir + '/' + "ScummVM_Global64.vsprops\" 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); + + defines.clear(); + for (StringList::const_iterator i = x64Defines.begin(); i != x64Defines.end(); ++i) { + if (i != x64Defines.begin()) + defines += ';'; + defines += *i; + } + + properties << "\n" + "\n" "\t\n" "\n"; } @@ -926,6 +1024,39 @@ void createBuildProp(const BuildSetup &setup, const int /*version*/) { properties.flush(); properties.close(); + properties.open((setup.outputDir + '/' + "ScummVM_Debug64.vsprops").c_str()); + if (!properties) + throw std::string("Could not open \"" + setup.outputDir + '/' + "ScummVM_Debug64.vsprops\" for writing"); + + properties << "\n" + "\n" + "\t\n" + "\t\n" + "\n"; + + properties.flush(); + properties.close(); + properties.open((setup.outputDir + '/' + "ScummVM_Release.vsprops").c_str()); if (!properties) throw std::string("Could not open \"" + setup.outputDir + '/' + "ScummVM_Release.vsprops\" for writing"); @@ -953,6 +1084,40 @@ void createBuildProp(const BuildSetup &setup, const int /*version*/) { "\t\tSetChecksum=\"true\"\n" "\t/>\n" "\n"; + + properties.flush(); + properties.close(); + + properties.open((setup.outputDir + '/' + "ScummVM_Release64.vsprops").c_str()); + if (!properties) + throw std::string("Could not open \"" + setup.outputDir + '/' + "ScummVM_Release64.vsprops\" for writing"); + + properties << "\n" + "\n" + "\t\n" + "\t\n" + "\n"; + + properties.flush(); + properties.close(); } /** @@ -1198,6 +1363,7 @@ void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, con const std::string toolLine = indentString + "\t\t\n"; + // NASM is not supported for x64, thus we do not need to add additional entries here :-). projectFile << indentString << "name) << "\">\n" << indentString << "\t\n" << toolLine @@ -1217,6 +1383,12 @@ void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, con << indentString << "\t\n" << toolLine << indentString << "\t\n" + << indentString << "\t\n" + << toolLine + << indentString << "\t\n" + << indentString << "\t\n" + << toolLine + << indentString << "\t\n" << indentString << "\n"; } else { projectFile << indentString << "name) << "\" />\n"; -- cgit v1.2.3