Ticket #7741: 0001-create_msvc-Extract-version-specific-code.patch

File 0001-create_msvc-Extract-version-specific-code.patch, 63.7 KB (added by Templier, 14 years ago)

1 - Extract version specific code

  • tools/create_msvc/create_msvc.cpp

     
    8989 */
    9090void displayHelp(const char *exe);
    9191
    92 // Map containing a project-specific list of warnings
    93 // TODO: Remove the use of global variables
    94 std::map<std::string, std::string> g_projectWarnings;
    95 std::string g_globalWarnings;
     92/**
     93 * Structure representing a file tree. This contains two
     94 * members: name and children. "name" holds the name of
     95 * the node. "children" does contain all the node's children.
     96 * When the list "children" is empty, the node is a file entry,
     97 * otherwise it's a directory.
     98 */
     99struct FileNode {
     100        typedef std::list<FileNode *> NodeList;
     101
     102        FileNode(const std::string &n) : name(n), children() {}
     103
     104        ~FileNode() {
     105                for (NodeList::iterator i = children.begin(); i != children.end(); ++i)
     106                        delete *i;
     107        }
     108
     109        std::string name;  ///< Name of the node
     110        NodeList children; ///< List of children for the node
     111};
     112
     113/**
     114 * Structure for describing an FSNode. This is a very minimalistic
     115 * description, which includes everything we need.
     116 * It only contains the name of the node and whether it is a directory
     117 * or not.
     118 */
     119struct FSNode {
     120        FSNode() : name(), isDirectory(false) {}
     121        FSNode(const std::string &n, bool iD) : name(n), isDirectory(iD) {}
     122
     123        std::string name; ///< Name of the file system node
     124        bool isDirectory; ///< Whether it is a directory or not
     125};
     126
     127typedef std::list<FSNode> FileList;
     128
     129class ProjectProvider {
     130public:
     131        typedef std::map<std::string, std::string> UUIDMap;
     132
     133protected:
     134        const int _version;                                      ///< Target MSVC version
     135        std::string _globalWarnings;                             ///< Global warnings
     136        std::map<std::string, std::string> _projectWarnings;     ///< Per-project warnings
     137
     138        UUIDMap _uuidMap;                                        ///< List of (project name, UUID) pairs
     139
     140public:
     141        /**
     142         * Instantiate new ProjectProvider class
     143         *
     144         * @param version Target MSVC version.
     145         */
     146        ProjectProvider(const int version, std::string global_warnings, std::map<std::string, std::string> project_warnings);
     147        virtual ~ProjectProvider() {}
     148
     149        /**
     150         * Creates all MSVC build files: the solution
     151         * for all projects, all projects itself and the
     152         * global config files.
     153         *
     154         * @param setup Description of the desired build setup.
     155         */
     156        void createMSVCProject(const BuildSetup &setup);
     157
     158        /**
     159         * Creates the main solution file "scummvm.sln" for a specific
     160         * build setup.
     161         *
     162         * @param setup Description of the desired build.
     163         */
     164        void createScummVMSolution(const BuildSetup &setup);
     165
     166        /**
     167         * Create a project file for the specified list of files.
     168         *
     169         * @param name Name of the project file.
     170         * @param uuid UUID of the project file.
     171         * @param setup Description of the desired build.
     172         * @param moduleDir Path to the module.
     173         * @param includeList Files to include (must have "moduleDir" as prefix).
     174         * @param excludeList Files to exclude (must have "moduleDir" as prefix).
     175         */
     176        virtual void createProjectFile(const std::string &name, const std::string &uuid, const BuildSetup &setup, const std::string &moduleDir,
     177                                       const StringList &includeList, const StringList &excludeList) = 0;
     178
     179        /**
     180         * Writes file entries for the specified directory node into
     181         * the given project file. It will also take care of duplicate
     182         * object files.
     183         *
     184         * @param dir Directory node.
     185         * @param projectFile File stream to write to.
     186         * @param indentation Indentation level to use.
     187         * @param duplicate List of duplicate object file names.
     188         * @param objPrefix Prefix to use for object files, which would name clash.
     189         * @param filePrefix Generic prefix to all files of the node.
     190         */
     191        virtual void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation,
     192                                            const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix) = 0;
     193
     194        /**
     195         * Output a list of project references to the file stream
     196         *
     197         * @param output File stream to write to.
     198         */
     199        virtual void writeReferences(std::ofstream &output) = 0;
     200
     201        /**
     202         * Outputs a property file based on the input parameters.
     203         *
     204         * It can be easily used to create different global properties files
     205         * for a 64 bit and a 32 bit version. It will also take care that the
     206         * two platform configurations will output their files into different
     207         * directories.
     208         *
     209         * @param properties File stream in which to write the property settings.
     210         * @param bits Number of bits the platform supports.
     211         * @param defines Defines the platform needs to have set.
     212         * @param prefix File prefix, used to add additional include paths.
     213         */
     214        virtual void outputGlobalPropFile(std::ofstream &properties, int bits, const std::string &defines, const std::string &prefix) = 0;
     215
     216        /**
     217         * Generates the project properties for debug and release settings.
     218         *
     219         * @param setup Description of the desired build setup.
     220         */
     221        virtual void createBuildProp(const BuildSetup &setup) = 0;
     222
     223        /**
     224         * Get the file extension for project files
     225         */
     226        virtual const char *getProjectExtension() = 0;
     227
     228        /**
     229         * Get the file extension for property files
     230         */
     231        virtual const char *getPropertiesExtension() = 0;
     232
     233        /**
     234         * Get the Visual Studio version (used by the VS shell extension to launch the correct VS version)
     235         */
     236        virtual int getVisualStudioVersion() = 0;
     237
     238        /**
     239         * Create the global project properties.
     240         *
     241         * @param setup Description of the desired build setup.
     242         */
     243        void createGlobalProp(const BuildSetup &setup);
     244
     245        /**
     246         * Adds files of the specified directory recursively to given project file.
     247         *
     248         * @param dir Path to the directory.
     249         * @param projectFile Output stream object, where all data should be written to.
     250         * @param includeList Files to include (must have a relative directory as prefix).
     251         * @param excludeList Files to exclude (must have a relative directory as prefix).
     252         * @param filePrefix Prefix to use for relative path arguments.
     253         */
     254        void addFilesToProject(const std::string &dir, std::ofstream &projectFile,
     255                               const StringList &includeList, const StringList &excludeList,
     256                               const std::string &filePrefix);
     257
     258        /**
     259         * Creates a list of files of the specified module. This also
     260         * creates a list of files, which should not be included.
     261         * All filenames will have "moduleDir" as prefix.
     262         *
     263         * @param moduleDir Path to the module.
     264         * @param defines List of set defines.
     265         * @param includeList Reference to a list, where included files should be added.
     266         * @param excludeList Reference to a list, where excluded files should be added.
     267         */
     268        void createModuleList(const std::string &moduleDir, const StringList &defines, StringList &includeList, StringList &excludeList);
     269};
     270
     271class VisualStudioProvider : public ProjectProvider {
     272public:
     273        VisualStudioProvider(const int version, std::string global_warnings, std::map<std::string, std::string> project_warnings);
     274
     275        void createProjectFile(const std::string &name, const std::string &uuid, const BuildSetup &setup, const std::string &moduleDir,
     276                               const StringList &includeList, const StringList &excludeList);
     277
     278        void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation,
     279                                    const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix);
     280
     281        void writeReferences(std::ofstream &output);
     282
     283        void outputGlobalPropFile(std::ofstream &properties, int bits, const std::string &defines, const std::string &prefix);
     284
     285        void createBuildProp(const BuildSetup &setup);
     286
     287        const char *getProjectExtension();
     288        const char *getPropertiesExtension();
     289        int getVisualStudioVersion();
     290};
     291
    96292} // End of anonymous namespace
    97293
    98294int main(int argc, char *argv[]) {
     
    246442        setup.libraries.push_back("winmm.lib");
    247443        setup.libraries.push_back("sdl.lib");
    248444
     445
     446        // List of global warnings and a map for project-specific warnings
     447        std::string globalWarnings;
     448        std::map<std::string, std::string> projectWarnings;
     449
    249450        // Initialize global & project-specific warnings
    250         g_globalWarnings = "4068;4100;4103;4127;4244;4250;4310;4351;4512;4702;4706;4800;4996";
     451        globalWarnings = "4068;4100;4103;4127;4244;4250;4310;4351;4512;4702;4706;4800;4996";
    251452
    252         g_projectWarnings["agi"] = "4510;4610";
    253         g_projectWarnings["lure"] = "4189;4355";
    254         g_projectWarnings["kyra"] = "4355";
     453        projectWarnings["agi"] = "4510;4610";
     454        projectWarnings["lure"] = "4189;4355";
     455        projectWarnings["kyra"] = "4355";
    255456
    256         createMSVCProject(setup, msvcVersion);
     457        ProjectProvider *provider = new VisualStudioProvider(msvcVersion, globalWarnings, projectWarnings);
     458
     459        provider->createMSVCProject(setup);
     460
     461        delete provider;
    257462}
    258463
    259464namespace {
     
    582787 */
    583788std::string createUUID();
    584789
    585 /**
    586  * Creates the main solution file "scummvm.sln" for a specific
    587  * build setup.
    588  *
    589  * @param setup Description of the desired build.
    590  * @param uuids Map of all project file UUIDs.
    591  * @param version Target MSVC version.
    592  */
    593 void createScummVMSolution(const BuildSetup &setup, const UUIDMap &uuids, const int version);
     790UUIDMap createUUIDMap(const BuildSetup &setup) {
     791        UUIDMap result;
    594792
    595 /**
    596  * Create a project file for the specified list of files.
    597  *
    598  * @param name Name of the project file.
    599  * @param uuid UUID of the project file.
    600  * @param setup Description of the desired build.
    601  * @param moduleDir Path to the module.
    602  * @param includeList Files to include (must have "moduleDir" as prefix).
    603  * @param excludeList Files to exclude (must have "moduleDir" as prefix).
    604  * @param version Target MSVC version.
    605  */
    606 void createProjectFile(const std::string &name, const std::string &uuid, const BuildSetup &setup, const std::string &moduleDir,
    607                        const StringList &includeList, const StringList &excludeList, const int version);
     793        for (EngineDescList::const_iterator i = setup.engines.begin(); i != setup.engines.end(); ++i) {
     794                if (!i->enable || isSubEngine(i->name, setup.engines))
     795                        continue;
    608796
    609 /**
    610  * Adds files of the specified directory recursively to given project file.
    611  *
    612  * @param dir Path to the directory.
    613  * @param projectFile Output stream object, where all data should be written to.
    614  * @param includeList Files to include (must have a relative directory as prefix).
    615  * @param excludeList Files to exclude (must have a relative directory as prefix).
    616  * @param filePrefix Prefix to use for relativ path arguments.
    617  */
    618 void addFilesToProject(const std::string &dir, std::ofstream &projectFile,
    619                        const StringList &includeList, const StringList &excludeList,
    620                        const std::string &filePrefix);
     797                result[i->name] = createUUID();
     798        }
    621799
    622 /**
    623  * Create the global project properties.
    624  *
    625  * @param setup Description of the desired build setup.
    626  * @param version Target MSVC version.
    627  */
    628 void createGlobalProp(const BuildSetup &setup, const int version);
     800        return result;
     801}
    629802
    630 /**
    631  * Generates the project properties for debug and release settings.
    632  *
    633  * @param setup Description of the desired build setup.
    634  * @param version Target MSVC version.
    635  */
    636 void createBuildProp(const BuildSetup &setup, const int version);
     803std::string createUUID() {
     804#if defined(_WIN32) || defined(WIN32)
     805        UUID uuid;
     806        if (UuidCreate(&uuid) != RPC_S_OK)
     807                error("UuidCreate failed");
    637808
    638 /**
    639  * Creates a list of files of the specified module. This also
    640  * creates a list of files, which should not be included.
    641  * All filenames will have "moduleDir" as prefix.
    642  *
    643  * @param moduleDir Path to the module.
    644  * @param defines List of set defines.
    645  * @param includeList Reference to a list, where included files should be added.
    646  * @param excludeList Reference to a list, where excluded files should be added.
    647  */
    648 void createModuleList(const std::string &moduleDir, const StringList &defines, StringList &includeList, StringList &excludeList);
    649 } // End of anonymous namespace
     809        unsigned char *string = 0;
     810        if (UuidToStringA(&uuid, &string) != RPC_S_OK)
     811                error("UuidToStringA failed");
    650812
    651 void createMSVCProject(const BuildSetup &setup, const int version) {
    652         UUIDMap uuidMap = createUUIDMap(setup);
     813        std::string result = std::string((char *)string);
     814        std::transform(result.begin(), result.end(), result.begin(), toupper);
     815        RpcStringFreeA(&string);
     816        return result;
     817#else
     818        unsigned char uuid[16];
    653819
     820        for (int i = 0; i < 16; ++i)
     821                uuid[i] = (unsigned char)((std::rand() / (double)(RAND_MAX)) * 0xFF);
     822
     823        uuid[8] &= 0xBF; uuid[8] |= 0x80;
     824        uuid[6] &= 0x4F; uuid[6] |= 0x40;
     825
     826        std::stringstream uuidString;
     827        uuidString << std::hex << std::uppercase << std::setfill('0');
     828        for (int i = 0; i < 16; ++i) {
     829                uuidString << std::setw(2) << (int)uuid[i];
     830                if (i == 3 || i == 5 || i == 7 || i == 9) {
     831                        uuidString << std::setw(0) << '-';
     832                }
     833        }
     834
     835        return uuidString.str();
     836#endif
     837}
     838
     839//////////////////////////////////////////////////////////////////////////
     840// Project Provider methods
     841//////////////////////////////////////////////////////////////////////////
     842ProjectProvider::ProjectProvider(const int version, std::string global_warnings, std::map<std::string, std::string> project_warnings)
     843        : _version(version), _globalWarnings(global_warnings), _projectWarnings(project_warnings) {
     844}
     845
     846void ProjectProvider::createMSVCProject(const BuildSetup &setup) {
     847        _uuidMap = createUUIDMap(setup);
     848
    654849        // We also need to add the UUID of the main project file.
    655         const std::string svmUUID = uuidMap["scummvm"] = createUUID();
     850        const std::string svmUUID = _uuidMap["scummvm"] = createUUID();
    656851
    657         createScummVMSolution(setup, uuidMap, version);
     852        createScummVMSolution(setup);
    658853
    659854        StringList in, ex;
    660855
    661856        // Create engine project files
    662         for (UUIDMap::const_iterator i = uuidMap.begin(); i != uuidMap.end(); ++i) {
     857        for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
    663858                if (i->first == "scummvm")
    664859                        continue;
    665860
     
    667862                const std::string moduleDir = setup.srcDir + "/engines/" + i->first;
    668863
    669864                createModuleList(moduleDir, setup.defines, in, ex);
    670                 createProjectFile(i->first, i->second, setup, moduleDir, in, ex, version);
     865                createProjectFile(i->first, i->second, setup, moduleDir, in, ex);
    671866        }
    672867
    673868        // Last but not least create the main ScummVM project file.
     
    697892        in.push_back(setup.srcDir + "/README");
    698893        in.push_back(setup.srcDir + "/TODO");
    699894
    700         // Create the "scummvm.vcproj" file.
    701         createProjectFile("scummvm", svmUUID, setup, setup.srcDir, in, ex, version);
     895        // Create the scummvm project file.
     896        createProjectFile("scummvm", svmUUID, setup, setup.srcDir, in, ex);
    702897
    703898        // Create the global property file
    704         createGlobalProp(setup, version);
     899        createGlobalProp(setup);
    705900
    706901        // Create the configuration property files
    707         createBuildProp(setup, version);
     902        createBuildProp(setup);
    708903}
    709904
    710 namespace {
    711 UUIDMap createUUIDMap(const BuildSetup &setup) {
    712         UUIDMap result;
    713 
    714         for (EngineDescList::const_iterator i = setup.engines.begin(); i != setup.engines.end(); ++i) {
    715                 if (!i->enable || isSubEngine(i->name, setup.engines))
    716                         continue;
    717 
    718                 result[i->name] = createUUID();
    719         }
    720 
    721         return result;
    722 }
    723 
    724 std::string createUUID() {
    725 #if defined(_WIN32) || defined(WIN32)
    726         UUID uuid;
    727         if (UuidCreate(&uuid) != RPC_S_OK)
    728                 error("UuidCreate failed");
    729 
    730         unsigned char *string = 0;
    731         if (UuidToStringA(&uuid, &string) != RPC_S_OK)
    732                 error("UuidToStringA failed");
    733 
    734         std::string result = std::string((char *)string);
    735         std::transform(result.begin(), result.end(), result.begin(), toupper);
    736         RpcStringFreeA(&string);
    737         return result;
    738 #else
    739         unsigned char uuid[16];
    740 
    741         for (int i = 0; i < 16; ++i)
    742                 uuid[i] = (unsigned char)((std::rand() / (double)(RAND_MAX)) * 0xFF);
    743 
    744         uuid[8] &= 0xBF; uuid[8] |= 0x80;
    745         uuid[6] &= 0x4F; uuid[6] |= 0x40;
    746 
    747         std::stringstream uuidString;
    748         uuidString << std::hex << std::uppercase << std::setfill('0');
    749         for (int i = 0; i < 16; ++i) {
    750                 uuidString << std::setw(2) << (int)uuid[i];
    751                 if (i == 3 || i == 5 || i == 7 || i == 9) {
    752                         uuidString << std::setw(0) << '-';
    753                 }
    754         }
    755 
    756         return uuidString.str();
    757 #endif
    758 }
    759 
    760 void createScummVMSolution(const BuildSetup &setup, const UUIDMap &uuids, const int version) {
    761         UUIDMap::const_iterator svmUUID = uuids.find("scummvm");
    762         if (svmUUID == uuids.end())
     905void ProjectProvider::createScummVMSolution(const BuildSetup &setup) {
     906        UUIDMap::const_iterator svmUUID = _uuidMap.find("scummvm");
     907        if (svmUUID == _uuidMap.end())
    763908                error("No UUID for \"scummvm\" project created");
    764909
    765910        const std::string svmProjectUUID = svmUUID->second;
     
    771916        if (!solution)
    772917                error("Could not open \"" + setup.outputDir + '/' + "scummvm.sln\" for writing");
    773918
    774         solution << "Microsoft Visual Studio Solution File, Format Version " << version + 1 << ".00\n";
    775         if (version == 9)
    776                 solution << "# Visual Studio 2008\n";
    777         else if (version == 8)
    778                 solution << "# Visual Studio 2005\n";
    779         else
    780                 error("Unsupported version passed to createScummVMSolution");
     919        solution << "Microsoft Visual Studio Solution File, Format Version " << _version + 1 << ".00\n";
     920        solution << "# Visual Studio " << getVisualStudioVersion() << "\n";
    781921
    782         solution << "Project(\"{" << solutionUUID << "}\") = \"scummvm\", \"scummvm.vcproj\", \"{" << svmProjectUUID << "}\"\n"
    783                  << "\tProjectSection(ProjectDependencies) = postProject\n";
    784         for (UUIDMap::const_iterator i = uuids.begin(); i != uuids.end(); ++i) {
    785                 if (i->first == "scummvm")
    786                         continue;
     922        solution << "Project(\"{" << solutionUUID << "}\") = \"scummvm\", \"scummvm" << getProjectExtension() << "\", \"{" << svmProjectUUID << "}\"\n";
    787923
    788                 solution << "\t\t{" << i->second << "} = {" << i->second << "}\n";
    789         }
     924        writeReferences(solution);
    790925
    791         solution << "\tEndProjectSection\n"
    792                  << "EndProject\n";
     926        solution << "EndProject\n";
    793927
    794928        // Note we assume that the UUID map only includes UUIDs for enabled engines!
    795         for (UUIDMap::const_iterator i = uuids.begin(); i != uuids.end(); ++i) {
     929        for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
    796930                if (i->first == "scummvm")
    797931                        continue;
    798932
    799                 solution << "Project(\"{" << solutionUUID << "}\") = \"" << i->first << "\", \"" << i->first << ".vcproj\", \"{" << i->second << "}\"\n"
     933                solution << "Project(\"{" << solutionUUID << "}\") = \"" << i->first << "\", \"" << i->first << getProjectExtension() << "\", \"{" << i->second << "}\"\n"
    800934                         << "EndProject\n";
    801935        }
    802936
     
    809943                    "\tEndGlobalSection\n"
    810944                    "\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n";
    811945
    812         for (UUIDMap::const_iterator i = uuids.begin(); i != uuids.end(); ++i) {
     946        for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
    813947                solution << "\t\t{" << i->second << "}.Debug|Win32.ActiveCfg = Debug|Win32\n"
    814948                         << "\t\t{" << i->second << "}.Debug|Win32.Build.0 = Debug|Win32\n"
    815949                         << "\t\t{" << i->second << "}.Release|Win32.ActiveCfg = Release|Win32\n"
     
    827961                    "EndGlobal\n";
    828962}
    829963
    830 void createProjectFile(const std::string &name, const std::string &uuid, const BuildSetup &setup, const std::string &moduleDir,
    831                        const StringList &includeList, const StringList &excludeList, const int version) {
    832         const std::string projectFile = setup.outputDir + '/' + name + ".vcproj";
    833         std::ofstream project(projectFile.c_str());
    834         if (!project)
    835                 error("Could not open \"" + projectFile + "\" for writing");
    836 
    837         project << "<?xml version=\"1.0\" encoding=\"windows-1252\"?>\n"
    838                    "<VisualStudioProject\n"
    839                    "\tProjectType=\"Visual C++\"\n"
    840                    "\tVersion=\"" << version << ".00\"\n"
    841                    "\tName=\"" << name << "\"\n"
    842                    "\tProjectGUID=\"{" << uuid << "}\"\n"
    843                    "\tRootNamespace=\"" << name << "\"\n"
    844                    "\tKeyword=\"Win32Proj\"\n";
    845 
    846         if (version >= 9)
    847                 project << "\tTargetFrameworkVersion=\"131072\"\n";
    848 
    849         project << "\t>\n"
    850                    "\t<Platforms>\n"
    851                    "\t\t<Platform Name=\"Win32\" />\n"
    852                "\t\t<Platform Name=\"x64\" />\n"
    853                    "\t</Platforms>\n"
    854                    "\t<Configurations>\n";
    855 
    856         // Check for project-specific warnings:
    857         std::map<std::string, std::string>::iterator warnings = g_projectWarnings.find(name);
    858 
    859         if (name == "scummvm") {
    860                 std::string libraries;
    861 
    862                 for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i)
    863                         libraries += ' ' + *i;
    864 
    865                 // Win32
    866                 project << "\t\t<Configuration Name=\"Debug|Win32\" ConfigurationType=\"1\" InheritedPropertySheets=\".\\ScummVM_Debug.vsprops\">\n"
    867                            "\t\t\t<Tool\tName=\"VCCLCompilerTool\" DisableLanguageExtensions=\"false\" />\n"
    868                            "\t\t\t<Tool\tName=\"VCLinkerTool\" OutputFile=\"$(OutDir)/scummvm.exe\"\n"
    869                            "\t\t\t\tAdditionalDependencies=\"" << libraries << "\"\n"
    870                            "\t\t\t/>\n"
    871                            "\t\t</Configuration>\n"
    872                            "\t\t<Configuration Name=\"Release|Win32\" ConfigurationType=\"1\" InheritedPropertySheets=\".\\ScummVM_Release.vsprops\">\n"
    873                            "\t\t\t<Tool\tName=\"VCCLCompilerTool\" DisableLanguageExtensions=\"false\" />\n"
    874                            "\t\t\t<Tool\tName=\"VCLinkerTool\" OutputFile=\"$(OutDir)/scummvm.exe\"\n"
    875                            "\t\t\t\tAdditionalDependencies=\"" << libraries << "\"\n"
    876                            "\t\t\t/>\n"
    877                            "\t\t</Configuration>\n";
    878 
    879                 // x64
    880                 // For 'x64' we must disable NASM support. Usually we would need to disable the "nasm" feature for that and
    881                 // re-create the library list, BUT since NASM doesn't link any additional libraries, we can just use the
    882                 // libraries list created for IA-32. If that changes in the future, we need to adjust this part!
    883                 project << "\t\t<Configuration Name=\"Debug|x64\" ConfigurationType=\"1\" InheritedPropertySheets=\".\\ScummVM_Debug64.vsprops\">\n"
    884                            "\t\t\t<Tool\tName=\"VCCLCompilerTool\" DisableLanguageExtensions=\"false\" />\n"
    885                            "\t\t\t<Tool\tName=\"VCLinkerTool\" OutputFile=\"$(OutDir)/scummvm.exe\"\n"
    886                            "\t\t\t\tAdditionalDependencies=\"" << libraries << "\"\n"
    887                            "\t\t\t/>\n"
    888                            "\t\t</Configuration>\n"
    889                            "\t\t<Configuration Name=\"Release|x64\" ConfigurationType=\"1\" InheritedPropertySheets=\".\\ScummVM_Release64.vsprops\">\n"
    890                            "\t\t\t<Tool\tName=\"VCCLCompilerTool\" DisableLanguageExtensions=\"false\" />\n"
    891                            "\t\t\t<Tool\tName=\"VCLinkerTool\" OutputFile=\"$(OutDir)/scummvm.exe\"\n"
    892                            "\t\t\t\tAdditionalDependencies=\"" << libraries << "\"\n"
    893                            "\t\t\t/>\n"
    894                            "\t\t</Configuration>\n";
    895         } else if (warnings != g_projectWarnings.end()) {
    896                 // Win32
    897                 project << "\t\t<Configuration Name=\"Debug|Win32\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Debug.vsprops\">\n"
    898                            "\t\t\t<Tool Name=\"VCCLCompilerTool\" DisableSpecificWarnings=\"" << warnings->second << "\" />\n"
    899                            "\t\t</Configuration>\n"
    900                            "\t\t<Configuration Name=\"Release|Win32\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Release.vsprops\">\n"
    901                            "\t\t\t<Tool Name=\"VCCLCompilerTool\" DisableSpecificWarnings=\"" << warnings->second << "\" />\n"
    902                            "\t\t</Configuration>\n";
    903                 // x64
    904                 project << "\t\t<Configuration Name=\"Debug|x64\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Debug64.vsprops\">\n"
    905                            "\t\t\t<Tool Name=\"VCCLCompilerTool\" DisableSpecificWarnings=\"" << warnings->second << "\" />\n"
    906                            "\t\t</Configuration>\n"
    907                            "\t\t<Configuration Name=\"Release|x64\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Release64.vsprops\">\n"
    908                            "\t\t\t<Tool Name=\"VCCLCompilerTool\" DisableSpecificWarnings=\"" << warnings->second << "\" />\n"
    909                            "\t\t</Configuration>\n";
    910         } else if (name == "tinsel") {
    911                 // Win32
    912                 project << "\t\t<Configuration Name=\"Debug|Win32\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Debug.vsprops\">\n"
    913                            "\t\t\t<Tool Name=\"VCCLCompilerTool\" DebugInformationFormat=\"3\" />\n"
    914                            "\t\t</Configuration>\n"
    915                            "\t\t<Configuration Name=\"Release|Win32\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Release.vsprops\" />\n";
    916                 // x64
    917                 project << "\t\t<Configuration Name=\"Debug|x64\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Debug64.vsprops\">\n"
    918                            "\t\t\t<Tool Name=\"VCCLCompilerTool\" DebugInformationFormat=\"3\" />\n"
    919                            "\t\t</Configuration>\n"
    920                            "\t\t<Configuration Name=\"Release|x64\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Release64.vsprops\" />\n";
    921         } else {
    922                 // Win32
    923                 project << "\t\t<Configuration Name=\"Debug|Win32\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Debug.vsprops\" />\n"
    924                        "\t\t<Configuration Name=\"Release|Win32\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Release.vsprops\" />\n";
    925                 // x64
    926                 project << "\t\t<Configuration Name=\"Debug|x64\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Debug64.vsprops\" />\n"
    927                        "\t\t<Configuration Name=\"Release|x64\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Release64.vsprops\" />\n";
    928         }
    929         project << "\t</Configurations>\n"
    930                    "\t<Files>\n";
    931 
    932         std::string modulePath;
    933         if (!moduleDir.compare(0, setup.srcDir.size(), setup.srcDir)) {
    934                 modulePath = moduleDir.substr(setup.srcDir.size());
    935                 if (!modulePath.empty() && modulePath.at(0) == '/')
    936                         modulePath.erase(0, 1);
    937         }
    938 
    939         if (modulePath.size())
    940                 addFilesToProject(moduleDir, project, includeList, excludeList, setup.filePrefix + '/' + modulePath);
    941         else
    942                 addFilesToProject(moduleDir, project, includeList, excludeList, setup.filePrefix);
    943 
    944         project << "\t</Files>\n"
    945                    "</VisualStudioProject>\n";
    946 }
    947 
    948964/**
    949  * Outputs a property file based on the input parameters.
    950  *
    951  * It can be easily used to create different global properties files
    952  * for a 64 bit and a 32 bit version. It will also take care that the
    953  * two platform configurations will output their files into different
    954  * directories.
    955  *
    956  * @param properties File stream in which to write the property settings.
    957  * @param bits Number of bits the platform supports.
    958  * @param defines Defines the platform needs to have set.
    959  * @param prefix File prefix, used to add additional include paths.
    960  */
    961 void outputGlobalPropFile(std::ofstream &properties, int bits, const std::string &defines, const std::string &prefix) {
    962         properties << "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n"
    963                       "<VisualStudioPropertySheet\n"
    964                       "\tProjectType=\"Visual C++\"\n"
    965                       "\tVersion=\"8.00\"\n"
    966                       "\tName=\"ScummVM_Global\"\n"
    967                       "\tOutputDirectory=\"$(ConfigurationName)" << bits << "\"\n"
    968                       "\tIntermediateDirectory=\"$(ConfigurationName)" << bits << "/$(ProjectName)\"\n"
    969                       "\t>\n"
    970                       "\t<Tool\n"
    971                       "\t\tName=\"VCCLCompilerTool\"\n"
    972                       "\t\tDisableLanguageExtensions=\"true\"\n"
    973                       "\t\tDisableSpecificWarnings=\"" << g_globalWarnings << "\"\n"
    974                       "\t\tAdditionalIncludeDirectories=\"" << prefix << ";" << prefix << "\\engines\"\n"
    975                       "\t\tPreprocessorDefinitions=\"" << defines << "\"\n"
    976                       "\t\tExceptionHandling=\"0\"\n"
    977                       "\t\tRuntimeTypeInfo=\"false\"\n"
    978                       "\t\tWarningLevel=\"4\"\n"
    979                       "\t\tWarnAsError=\"false\"\n"
    980                       "\t\tCompileAs=\"0\"\n"
    981                       "\t\t/>\n"
    982                       "\t<Tool\n"
    983                       "\t\tName=\"VCLibrarianTool\"\n"
    984                       "\t\tIgnoreDefaultLibraryNames=\"\"\n"
    985                       "\t/>\n"
    986                       "\t<Tool\n"
    987                       "\t\tName=\"VCLinkerTool\"\n"
    988                       "\t\tIgnoreDefaultLibraryNames=\"\"\n"
    989                       "\t\tSubSystem=\"1\"\n"
    990                       "\t\tEntryPointSymbol=\"WinMainCRTStartup\"\n"
    991                       "\t/>\n"
    992                       "\t<Tool\n"
    993                       "\t\tName=\"VCResourceCompilerTool\"\n"
    994                       "\t\tPreprocessorDefinitions=\"HAS_INCLUDE_SET\"\n"
    995                       "\t\tAdditionalIncludeDirectories=\"" << prefix << "\"\n"
    996                       "\t/>\n"
    997                       "</VisualStudioPropertySheet>\n";
    998 
    999         properties.flush();
    1000 }
    1001 
    1002 void createGlobalProp(const BuildSetup &setup, const int /*version*/) {
    1003         std::ofstream properties((setup.outputDir + '/' + "ScummVM_Global.vsprops").c_str());
    1004         if (!properties)
    1005                 error("Could not open \"" + setup.outputDir + '/' + "ScummVM_Global.vsprops\" for writing");
    1006 
    1007         std::string defines;
    1008         for (StringList::const_iterator i = setup.defines.begin(); i != setup.defines.end(); ++i) {
    1009                 if (i != setup.defines.begin())
    1010                         defines += ';';
    1011                 defines += *i;
    1012         }
    1013 
    1014         outputGlobalPropFile(properties, 32, defines, convertPathToWin(setup.filePrefix));
    1015         properties.close();
    1016 
    1017         properties.open((setup.outputDir + '/' + "ScummVM_Global64.vsprops").c_str());
    1018         if (!properties)
    1019                 error("Could not open \"" + setup.outputDir + '/' + "ScummVM_Global64.vsprops\" for writing");
    1020 
    1021         // HACK: We must disable the "nasm" feature for x64. To achieve that we must duplicate the feature list and
    1022         // recreate a define list.
    1023         FeatureList x64Features = setup.features;
    1024         setFeatureBuildState("nasm", x64Features, false);
    1025         StringList x64Defines = getFeatureDefines(x64Features);
    1026         StringList x64EngineDefines = getEngineDefines(setup.engines);
    1027         x64Defines.splice(x64Defines.end(), x64EngineDefines);
    1028 
    1029         defines.clear();
    1030         for (StringList::const_iterator i = x64Defines.begin(); i != x64Defines.end(); ++i) {
    1031                 if (i != x64Defines.begin())
    1032                         defines += ';';
    1033                 defines += *i;
    1034         }
    1035 
    1036         outputGlobalPropFile(properties, 64, defines, convertPathToWin(setup.filePrefix));
    1037 }
    1038 
    1039 void createBuildProp(const BuildSetup &setup, const int /*version*/) {
    1040         std::ofstream properties((setup.outputDir + '/' + "ScummVM_Debug.vsprops").c_str());
    1041         if (!properties)
    1042                 error("Could not open \"" + setup.outputDir + '/' + "ScummVM_Debug.vsprops\" for writing");
    1043 
    1044         properties << "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n"
    1045                       "<VisualStudioPropertySheet\n"
    1046                       "\tProjectType=\"Visual C++\"\n"
    1047                       "\tVersion=\"8.00\"\n"
    1048                       "\tName=\"ScummVM_Debug32\"\n"
    1049                       "\tInheritedPropertySheets=\".\\ScummVM_Global.vsprops\"\n"
    1050                       "\t>\n"
    1051                       "\t<Tool\n"
    1052                       "\t\tName=\"VCCLCompilerTool\"\n"
    1053                       "\t\tOptimization=\"0\"\n"
    1054                       "\t\tPreprocessorDefinitions=\"WIN32\"\n"
    1055                       "\t\tMinimalRebuild=\"true\"\n"
    1056                       "\t\tBasicRuntimeChecks=\"3\"\n"
    1057                       "\t\tRuntimeLibrary=\"1\"\n"
    1058                       "\t\tEnableFunctionLevelLinking=\"true\"\n"
    1059                       "\t\tWarnAsError=\"false\"\n"
    1060                       "\t\tDebugInformationFormat=\"4\"\n"
    1061                       "\t/>\n"
    1062                       "\t<Tool\n"
    1063                       "\t\tName=\"VCLinkerTool\"\n"
    1064                       "\t\tLinkIncremental=\"2\"\n"
    1065                       "\t\tGenerateDebugInformation=\"true\"\n"
    1066                       "\t\tIgnoreDefaultLibraryNames=\"libcmt.lib\"\n"
    1067                       "\t/>\n"
    1068                       "</VisualStudioPropertySheet>\n";
    1069 
    1070         properties.flush();
    1071         properties.close();
    1072 
    1073         properties.open((setup.outputDir + '/' + "ScummVM_Debug64.vsprops").c_str());
    1074         if (!properties)
    1075                 error("Could not open \"" + setup.outputDir + '/' + "ScummVM_Debug64.vsprops\" for writing");
    1076 
    1077         properties << "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n"
    1078                       "<VisualStudioPropertySheet\n"
    1079                       "\tProjectType=\"Visual C++\"\n"
    1080                       "\tVersion=\"8.00\"\n"
    1081                       "\tName=\"ScummVM_Debug64\"\n"
    1082                       "\tInheritedPropertySheets=\".\\ScummVM_Global64.vsprops\"\n"
    1083                       "\t>\n"
    1084                       "\t<Tool\n"
    1085                       "\t\tName=\"VCCLCompilerTool\"\n"
    1086                       "\t\tOptimization=\"0\"\n"
    1087                       "\t\tPreprocessorDefinitions=\"WIN32\"\n"
    1088                       "\t\tMinimalRebuild=\"true\"\n"
    1089                       "\t\tBasicRuntimeChecks=\"3\"\n"
    1090                       "\t\tRuntimeLibrary=\"1\"\n"
    1091                       "\t\tEnableFunctionLevelLinking=\"true\"\n"
    1092                       "\t\tWarnAsError=\"false\"\n"
    1093                       "\t\tDebugInformationFormat=\"3\"\n"      // For x64 format "4" (Edit and continue) is not supported, thus we default to "3"
    1094                       "\t/>\n"
    1095                       "\t<Tool\n"
    1096                       "\t\tName=\"VCLinkerTool\"\n"
    1097                       "\t\tLinkIncremental=\"2\"\n"
    1098                       "\t\tGenerateDebugInformation=\"true\"\n"
    1099                       "\t\tIgnoreDefaultLibraryNames=\"libcmt.lib\"\n"
    1100                       "\t/>\n"
    1101                       "</VisualStudioPropertySheet>\n";
    1102 
    1103         properties.flush();
    1104         properties.close();
    1105 
    1106         properties.open((setup.outputDir + '/' + "ScummVM_Release.vsprops").c_str());
    1107         if (!properties)
    1108                 error("Could not open \"" + setup.outputDir + '/' + "ScummVM_Release.vsprops\" for writing");
    1109 
    1110         properties << "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n"
    1111                       "<VisualStudioPropertySheet\n"
    1112                       "\tProjectType=\"Visual C++\"\n"
    1113                       "\tVersion=\"8.00\"\n"
    1114                       "\tName=\"ScummVM_Release32\"\n"
    1115                       "\tInheritedPropertySheets=\".\\ScummVM_Global.vsprops\"\n"
    1116                       "\t>\n"
    1117                       "\t<Tool\n"
    1118                       "\t\tName=\"VCCLCompilerTool\"\n"
    1119                       "\t\tEnableIntrinsicFunctions=\"true\"\n"
    1120                       "\t\tWholeProgramOptimization=\"true\"\n"
    1121                       "\t\tPreprocessorDefinitions=\"WIN32\"\n"
    1122                       "\t\tStringPooling=\"true\"\n"
    1123                       "\t\tBufferSecurityCheck=\"false\"\n"
    1124                       "\t\tDebugInformationFormat=\"0\"\n"
    1125                       "\t/>\n"
    1126                       "\t<Tool\n"
    1127                       "\t\tName=\"VCLinkerTool\"\n"
    1128                       "\t\tLinkIncremental=\"1\"\n"
    1129                       "\t\tIgnoreDefaultLibraryNames=\"\"\n"
    1130                       "\t\tSetChecksum=\"true\"\n"
    1131                       "\t/>\n"
    1132                       "</VisualStudioPropertySheet>\n";
    1133 
    1134         properties.flush();
    1135         properties.close();
    1136 
    1137         properties.open((setup.outputDir + '/' + "ScummVM_Release64.vsprops").c_str());
    1138         if (!properties)
    1139                 error("Could not open \"" + setup.outputDir + '/' + "ScummVM_Release64.vsprops\" for writing");
    1140 
    1141         properties << "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n"
    1142                       "<VisualStudioPropertySheet\n"
    1143                       "\tProjectType=\"Visual C++\"\n"
    1144                       "\tVersion=\"8.00\"\n"
    1145                       "\tName=\"ScummVM_Release64\"\n"
    1146                       "\tInheritedPropertySheets=\".\\ScummVM_Global64.vsprops\"\n"
    1147                       "\t>\n"
    1148                       "\t<Tool\n"
    1149                       "\t\tName=\"VCCLCompilerTool\"\n"
    1150                       "\t\tEnableIntrinsicFunctions=\"true\"\n"
    1151                       "\t\tWholeProgramOptimization=\"true\"\n"
    1152                       "\t\tPreprocessorDefinitions=\"WIN32\"\n"
    1153                       "\t\tStringPooling=\"true\"\n"
    1154                       "\t\tBufferSecurityCheck=\"false\"\n"
    1155                       "\t\tDebugInformationFormat=\"0\"\n"
    1156                       "\t/>\n"
    1157                       "\t<Tool\n"
    1158                       "\t\tName=\"VCLinkerTool\"\n"
    1159                       "\t\tLinkIncremental=\"1\"\n"
    1160                       "\t\tIgnoreDefaultLibraryNames=\"\"\n"
    1161                       "\t\tSetChecksum=\"true\"\n"
    1162                       "\t/>\n"
    1163                       "</VisualStudioPropertySheet>\n";
    1164 
    1165         properties.flush();
    1166         properties.close();
    1167 }
    1168 
    1169 /**
    1170965 * Gets a proper sequence of \t characters for the given
    1171966 * indentation level.
    1172967 *
     
    12641059}
    12651060
    12661061/**
    1267  * Structure representing a file tree. This contains two
    1268  * members: name and children. "name" holds the name of
    1269  * the node. "children" does contain all the node's children.
    1270  * When the list "children" is empty, the node is a file entry,
    1271  * otherwise it's a directory.
    1272  */
    1273 struct FileNode {
    1274         typedef std::list<FileNode *> NodeList;
    1275 
    1276         FileNode(const std::string &n) : name(n), children() {}
    1277 
    1278         ~FileNode() {
    1279                 for (NodeList::iterator i = children.begin(); i != children.end(); ++i)
    1280                         delete *i;
    1281         }
    1282 
    1283         std::string name;  ///< Name of the node
    1284         NodeList children; ///< List of children for the node
    1285 };
    1286 
    1287 /**
    12881062 * A strict weak compare predicate for sorting a list of
    12891063 * "FileNode *" entries.
    12901064 *
     
    13111085}
    13121086
    13131087/**
    1314  * Structure for describing an FSNode. This is a very minimalistic
    1315  * description, which includes everything we need.
    1316  * It only contains the name of the node and whether it is a directory
    1317  * or not.
    1318  */
    1319 struct FSNode {
    1320         FSNode() : name(), isDirectory(false) {}
    1321         FSNode(const std::string &n, bool iD) : name(n), isDirectory(iD) {}
    1322 
    1323         std::string name; ///< Name of the file system node
    1324         bool isDirectory; ///< Whether it is a directory or not
    1325 };
    1326 
    1327 typedef std::list<FSNode> FileList;
    1328 
    1329 /**
    13301088 * Returns a list of all files and directories in the specified
    13311089 * path.
    13321090 *
     
    14291187        }
    14301188}
    14311189
    1432 /**
    1433  * Writes file entries for the specified directory node into
    1434  * the given project file. It will also take care of duplicate
    1435  * object files.
    1436  *
    1437  * @param dir Directory node.
    1438  * @param projectFile File stream to write to.
    1439  * @param indentation Indentation level to use.
    1440  * @param duplicate List of duplicate object file names.
    1441  * @param objPrefix Prefix to use for object files, which would name clash.
    1442  * @param filePrefix Generic prefix to all files of the node.
    1443  */
    1444 void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation,
    1445                             const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix) {
    1446         const std::string indentString = getIndent(indentation + 2);
     1190void ProjectProvider::createGlobalProp(const BuildSetup &setup) {
     1191        std::ofstream properties((setup.outputDir + '/' + "ScummVM_Global" + getPropertiesExtension()).c_str());
     1192        if (!properties)
     1193                error("Could not open \"" + setup.outputDir + '/' + "ScummVM_Global" + getPropertiesExtension() + "\" for writing");
    14471194
    1448         if (indentation)
    1449                 projectFile << getIndent(indentation + 1) << "<Filter\tName=\"" << dir.name << "\">\n";
     1195        std::string defines;
     1196        for (StringList::const_iterator i = setup.defines.begin(); i != setup.defines.end(); ++i) {
     1197                if (i != setup.defines.begin())
     1198                        defines += ';';
     1199                defines += *i;
     1200        }
    14501201
    1451         for (FileNode::NodeList::const_iterator i = dir.children.begin(); i != dir.children.end(); ++i) {
    1452                 const FileNode *node = *i;
     1202        outputGlobalPropFile(properties, 32, defines, convertPathToWin(setup.filePrefix));
     1203        properties.close();
    14531204
    1454                 if (!node->children.empty()) {
    1455                         writeFileListToProject(*node, projectFile, indentation + 1, duplicate, objPrefix + node->name + '_', filePrefix + node->name + '/');
    1456                 } else {
    1457                         if (producesObjectFile(node->name)) {
    1458                                 std::string name, ext;
    1459                                 splitFilename(node->name, name, ext);
    1460                                 const bool isDuplicate = (std::find(duplicate.begin(), duplicate.end(), name + ".o") != duplicate.end());
     1205        properties.open((setup.outputDir + '/' + "ScummVM_Global64" + getPropertiesExtension()).c_str());
     1206        if (!properties)
     1207                error("Could not open \"" + setup.outputDir + '/' + "ScummVM_Global64" + getPropertiesExtension() + "\" for writing");
    14611208
    1462                                 if (ext == "asm") {
    1463                                         std::string objFileName = "$(IntDir)\\";
    1464                                         if (isDuplicate)
    1465                                                 objFileName += objPrefix;
    1466                                         objFileName += "$(InputName).obj";
     1209        // HACK: We must disable the "nasm" feature for x64. To achieve that we must duplicate the feature list and
     1210        // recreate a define list.
     1211        FeatureList x64Features = setup.features;
     1212        setFeatureBuildState("nasm", x64Features, false);
     1213        StringList x64Defines = getFeatureDefines(x64Features);
     1214        StringList x64EngineDefines = getEngineDefines(setup.engines);
     1215        x64Defines.splice(x64Defines.end(), x64EngineDefines);
    14671216
    1468                                         const std::string toolLine = indentString + "\t\t<Tool Name=\"VCCustomBuildTool\" CommandLine=\"nasm.exe -f win32 -g -o &quot;" + objFileName + "&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;\" Outputs=\"" + objFileName + "\" />\n";
    1469 
    1470                                         // NASM is not supported for x64, thus we do not need to add additional entries here :-).
    1471                                         projectFile << indentString << "<File RelativePath=\"" << convertPathToWin(filePrefix + node->name) << "\">\n"
    1472                                                     << indentString << "\t<FileConfiguration Name=\"Debug|Win32\">\n"
    1473                                                     << toolLine
    1474                                                     << indentString << "\t</FileConfiguration>\n"
    1475                                                     << indentString << "\t<FileConfiguration Name=\"Release|Win32\">\n"
    1476                                                     << toolLine
    1477                                                     << indentString << "\t</FileConfiguration>\n"
    1478                                                     << indentString << "</File>\n";
    1479                                 } else {
    1480                                         if (isDuplicate) {
    1481                                                 const std::string toolLine = indentString + "\t\t<Tool Name=\"VCCLCompilerTool\" ObjectFile=\"$(IntDir)\\" + objPrefix + "$(InputName).obj\" XMLDocumentationFileName=\"$(IntDir)\\" + objPrefix + "$(InputName).xdc\" />\n";
    1482 
    1483                                                 projectFile << indentString << "<File RelativePath=\"" << convertPathToWin(filePrefix + node->name) << "\">\n"
    1484                                                             << indentString << "\t<FileConfiguration Name=\"Debug|Win32\">\n"
    1485                                                             << toolLine
    1486                                                             << indentString << "\t</FileConfiguration>\n"
    1487                                                             << indentString << "\t<FileConfiguration Name=\"Release|Win32\">\n"
    1488                                                             << toolLine
    1489                                                             << indentString << "\t</FileConfiguration>\n"
    1490                                                             << indentString << "\t<FileConfiguration Name=\"Debug|x64\">\n"
    1491                                                             << toolLine
    1492                                                             << indentString << "\t</FileConfiguration>\n"
    1493                                                             << indentString << "\t<FileConfiguration Name=\"Release|x64\">\n"
    1494                                                             << toolLine
    1495                                                             << indentString << "\t</FileConfiguration>\n"
    1496                                                             << indentString << "</File>\n";
    1497                                         } else {
    1498                                                 projectFile << indentString << "<File RelativePath=\"" << convertPathToWin(filePrefix + node->name) << "\" />\n";
    1499                                         }
    1500                                 }
    1501                         } else {
    1502                                 projectFile << indentString << "<File RelativePath=\"" << convertPathToWin(filePrefix + node->name) << "\" />\n";
    1503                         }
    1504                 }
     1217        defines.clear();
     1218        for (StringList::const_iterator i = x64Defines.begin(); i != x64Defines.end(); ++i) {
     1219                if (i != x64Defines.begin())
     1220                        defines += ';';
     1221                defines += *i;
    15051222        }
    15061223
    1507         if (indentation)
    1508                 projectFile << getIndent(indentation + 1) << "</Filter>\n";
     1224        outputGlobalPropFile(properties, 64, defines, convertPathToWin(setup.filePrefix));
    15091225}
    15101226
    1511 void addFilesToProject(const std::string &dir, std::ofstream &projectFile,
     1227void ProjectProvider::addFilesToProject(const std::string &dir, std::ofstream &projectFile,
    15121228                       const StringList &includeList, const StringList &excludeList,
    15131229                       const std::string &filePrefix) {
    15141230        // Check for duplicate object file names
     
    15161232
    15171233        for (StringList::const_iterator i = includeList.begin(); i != includeList.end(); ++i) {
    15181234                const std::string fileName = getLastPathComponent(*i);
    1519                
     1235
    15201236                // Leave out non object file names.
    15211237                if (fileName.size() < 2 || fileName.compare(fileName.size() - 2, 2, ".o"))
    15221238                        continue;
     
    15421258        delete files;
    15431259}
    15441260
    1545 void createModuleList(const std::string &moduleDir, const StringList &defines, StringList &includeList, StringList &excludeList) {
     1261void ProjectProvider::createModuleList(const std::string &moduleDir, const StringList &defines, StringList &includeList, StringList &excludeList) {
    15461262        const std::string moduleMkFile = moduleDir + "/module.mk";
    15471263        std::ifstream moduleMk(moduleMkFile.c_str());
    15481264        if (!moduleMk)
     
    16491365        if (shouldInclude.size() != 1)
    16501366                error("Malformed file " + moduleMkFile);
    16511367}
     1368
     1369//////////////////////////////////////////////////////////////////////////
     1370// Visual Studio Provider
     1371//////////////////////////////////////////////////////////////////////////
     1372
     1373VisualStudioProvider::VisualStudioProvider(const int version, std::string global_warnings, std::map<std::string, std::string> project_warnings)
     1374        : ProjectProvider(version, global_warnings, project_warnings) {
     1375}
     1376
     1377const char *VisualStudioProvider::getProjectExtension() {
     1378        return ".vcproj";
     1379}
     1380
     1381const char *VisualStudioProvider::getPropertiesExtension() {
     1382        return ".vsprops";
     1383}
     1384
     1385int VisualStudioProvider::getVisualStudioVersion() {
     1386        if (_version == 9)
     1387                return 2008;
     1388
     1389        if (_version == 8)
     1390                return 2005;
     1391
     1392        error("Unsupported version passed to createScummVMSolution");
     1393        return 0;
     1394}
     1395
     1396void VisualStudioProvider::createProjectFile(const std::string &name, const std::string &uuid, const BuildSetup &setup, const std::string &moduleDir,
     1397                                             const StringList &includeList, const StringList &excludeList) {
     1398        const std::string projectFile = setup.outputDir + '/' + name + getProjectExtension();
     1399        std::ofstream project(projectFile.c_str());
     1400        if (!project)
     1401                error("Could not open \"" + projectFile + "\" for writing");
     1402
     1403        project << "<?xml version=\"1.0\" encoding=\"windows-1252\"?>\n"
     1404                   "<VisualStudioProject\n"
     1405                   "\tProjectType=\"Visual C++\"\n"
     1406                   "\tVersion=\"" << _version << ".00\"\n"
     1407                   "\tName=\"" << name << "\"\n"
     1408                   "\tProjectGUID=\"{" << uuid << "}\"\n"
     1409                   "\tRootNamespace=\"" << name << "\"\n"
     1410                   "\tKeyword=\"Win32Proj\"\n";
     1411
     1412        if (_version >= 9)
     1413                project << "\tTargetFrameworkVersion=\"131072\"\n";
     1414
     1415        project << "\t>\n"
     1416                   "\t<Platforms>\n"
     1417                   "\t\t<Platform Name=\"Win32\" />\n"
     1418                   "\t\t<Platform Name=\"x64\" />\n"
     1419                   "\t</Platforms>\n"
     1420                   "\t<Configurations>\n";
     1421
     1422        // Check for project-specific warnings:
     1423        std::map<std::string, std::string>::iterator warnings = _projectWarnings.find(name);
     1424
     1425        if (name == "scummvm") {
     1426                std::string libraries;
     1427
     1428                for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i)
     1429                        libraries += ' ' + *i;
     1430
     1431                // Win32
     1432                project << "\t\t<Configuration Name=\"Debug|Win32\" ConfigurationType=\"1\" InheritedPropertySheets=\".\\ScummVM_Debug.vsprops\">\n"
     1433                           "\t\t\t<Tool\tName=\"VCCLCompilerTool\" DisableLanguageExtensions=\"false\" />\n"
     1434                           "\t\t\t<Tool\tName=\"VCLinkerTool\" OutputFile=\"$(OutDir)/scummvm.exe\"\n"
     1435                           "\t\t\t\tAdditionalDependencies=\"" << libraries << "\"\n"
     1436                           "\t\t\t/>\n"
     1437                           "\t\t</Configuration>\n"
     1438                           "\t\t<Configuration Name=\"Release|Win32\" ConfigurationType=\"1\" InheritedPropertySheets=\".\\ScummVM_Release.vsprops\">\n"
     1439                           "\t\t\t<Tool\tName=\"VCCLCompilerTool\" DisableLanguageExtensions=\"false\" />\n"
     1440                           "\t\t\t<Tool\tName=\"VCLinkerTool\" OutputFile=\"$(OutDir)/scummvm.exe\"\n"
     1441                           "\t\t\t\tAdditionalDependencies=\"" << libraries << "\"\n"
     1442                           "\t\t\t/>\n"
     1443                           "\t\t</Configuration>\n";
     1444
     1445                // x64
     1446                // For 'x64' we must disable NASM support. Usually we would need to disable the "nasm" feature for that and
     1447                // re-create the library list, BUT since NASM doesn't link any additional libraries, we can just use the
     1448                // libraries list created for IA-32. If that changes in the future, we need to adjust this part!
     1449                project << "\t\t<Configuration Name=\"Debug|x64\" ConfigurationType=\"1\" InheritedPropertySheets=\".\\ScummVM_Debug64.vsprops\">\n"
     1450                           "\t\t\t<Tool\tName=\"VCCLCompilerTool\" DisableLanguageExtensions=\"false\" />\n"
     1451                           "\t\t\t<Tool\tName=\"VCLinkerTool\" OutputFile=\"$(OutDir)/scummvm.exe\"\n"
     1452                           "\t\t\t\tAdditionalDependencies=\"" << libraries << "\"\n"
     1453                           "\t\t\t/>\n"
     1454                           "\t\t</Configuration>\n"
     1455                           "\t\t<Configuration Name=\"Release|x64\" ConfigurationType=\"1\" InheritedPropertySheets=\".\\ScummVM_Release64.vsprops\">\n"
     1456                           "\t\t\t<Tool\tName=\"VCCLCompilerTool\" DisableLanguageExtensions=\"false\" />\n"
     1457                           "\t\t\t<Tool\tName=\"VCLinkerTool\" OutputFile=\"$(OutDir)/scummvm.exe\"\n"
     1458                           "\t\t\t\tAdditionalDependencies=\"" << libraries << "\"\n"
     1459                           "\t\t\t/>\n"
     1460                           "\t\t</Configuration>\n";
     1461        } else if (warnings != _projectWarnings.end()) {
     1462                // Win32
     1463                project << "\t\t<Configuration Name=\"Debug|Win32\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Debug.vsprops\">\n"
     1464                           "\t\t\t<Tool Name=\"VCCLCompilerTool\" DisableSpecificWarnings=\"" << warnings->second << "\" />\n"
     1465                           "\t\t</Configuration>\n"
     1466                           "\t\t<Configuration Name=\"Release|Win32\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Release.vsprops\">\n"
     1467                           "\t\t\t<Tool Name=\"VCCLCompilerTool\" DisableSpecificWarnings=\"" << warnings->second << "\" />\n"
     1468                           "\t\t</Configuration>\n";
     1469                // x64
     1470                project << "\t\t<Configuration Name=\"Debug|x64\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Debug64.vsprops\">\n"
     1471                           "\t\t\t<Tool Name=\"VCCLCompilerTool\" DisableSpecificWarnings=\"" << warnings->second << "\" />\n"
     1472                           "\t\t</Configuration>\n"
     1473                           "\t\t<Configuration Name=\"Release|x64\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Release64.vsprops\">\n"
     1474                           "\t\t\t<Tool Name=\"VCCLCompilerTool\" DisableSpecificWarnings=\"" << warnings->second << "\" />\n"
     1475                           "\t\t</Configuration>\n";
     1476        } else if (name == "tinsel") {
     1477                // Win32
     1478                project << "\t\t<Configuration Name=\"Debug|Win32\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Debug.vsprops\">\n"
     1479                           "\t\t\t<Tool Name=\"VCCLCompilerTool\" DebugInformationFormat=\"3\" />\n"
     1480                           "\t\t</Configuration>\n"
     1481                           "\t\t<Configuration Name=\"Release|Win32\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Release.vsprops\" />\n";
     1482                // x64
     1483                project << "\t\t<Configuration Name=\"Debug|x64\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Debug64.vsprops\">\n"
     1484                           "\t\t\t<Tool Name=\"VCCLCompilerTool\" DebugInformationFormat=\"3\" />\n"
     1485                           "\t\t</Configuration>\n"
     1486                           "\t\t<Configuration Name=\"Release|x64\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Release64.vsprops\" />\n";
     1487        } else {
     1488                // Win32
     1489                project << "\t\t<Configuration Name=\"Debug|Win32\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Debug.vsprops\" />\n"
     1490                           "\t\t<Configuration Name=\"Release|Win32\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Release.vsprops\" />\n";
     1491                // x64
     1492                project << "\t\t<Configuration Name=\"Debug|x64\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Debug64.vsprops\" />\n"
     1493                           "\t\t<Configuration Name=\"Release|x64\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_Release64.vsprops\" />\n";
     1494        }
     1495        project << "\t</Configurations>\n"
     1496                   "\t<Files>\n";
     1497
     1498        std::string modulePath;
     1499        if (!moduleDir.compare(0, setup.srcDir.size(), setup.srcDir)) {
     1500                modulePath = moduleDir.substr(setup.srcDir.size());
     1501                if (!modulePath.empty() && modulePath.at(0) == '/')
     1502                        modulePath.erase(0, 1);
     1503        }
     1504
     1505        if (modulePath.size())
     1506                addFilesToProject(moduleDir, project, includeList, excludeList, setup.filePrefix + '/' + modulePath);
     1507        else
     1508                addFilesToProject(moduleDir, project, includeList, excludeList, setup.filePrefix);
     1509
     1510        project << "\t</Files>\n"
     1511                   "</VisualStudioProject>\n";
     1512}
     1513
     1514void VisualStudioProvider::writeReferences(std::ofstream &output) {
     1515        output << "\tProjectSection(ProjectDependencies) = postProject\n";
     1516
     1517        for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
     1518                if (i->first == "scummvm")
     1519                        continue;
     1520
     1521                output << "\t\t{" << i->second << "} = {" << i->second << "}\n";
     1522        }
     1523
     1524        output << "\tEndProjectSection\n";
     1525}
     1526
     1527void VisualStudioProvider::outputGlobalPropFile(std::ofstream &properties, int bits, const std::string &defines, const std::string &prefix) {
     1528        properties << "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n"
     1529                      "<VisualStudioPropertySheet\n"
     1530                      "\tProjectType=\"Visual C++\"\n"
     1531                      "\tVersion=\"8.00\"\n"
     1532                      "\tName=\"ScummVM_Global\"\n"
     1533                      "\tOutputDirectory=\"$(ConfigurationName)" << bits << "\"\n"
     1534                      "\tIntermediateDirectory=\"$(ConfigurationName)" << bits << "/$(ProjectName)\"\n"
     1535                      "\t>\n"
     1536                      "\t<Tool\n"
     1537                      "\t\tName=\"VCCLCompilerTool\"\n"
     1538                      "\t\tDisableLanguageExtensions=\"true\"\n"
     1539                      "\t\tDisableSpecificWarnings=\"" << _globalWarnings << "\"\n"
     1540                      "\t\tAdditionalIncludeDirectories=\"" << prefix << ";" << prefix << "\\engines\"\n"
     1541                      "\t\tPreprocessorDefinitions=\"" << defines << "\"\n"
     1542                      "\t\tExceptionHandling=\"0\"\n"
     1543                      "\t\tRuntimeTypeInfo=\"false\"\n"
     1544                      "\t\tWarningLevel=\"4\"\n"
     1545                      "\t\tWarnAsError=\"false\"\n"
     1546                      "\t\tCompileAs=\"0\"\n"
     1547                      "\t\t/>\n"
     1548                      "\t<Tool\n"
     1549                      "\t\tName=\"VCLibrarianTool\"\n"
     1550                      "\t\tIgnoreDefaultLibraryNames=\"\"\n"
     1551                      "\t/>\n"
     1552                      "\t<Tool\n"
     1553                      "\t\tName=\"VCLinkerTool\"\n"
     1554                      "\t\tIgnoreDefaultLibraryNames=\"\"\n"
     1555                      "\t\tSubSystem=\"1\"\n"
     1556                      "\t\tEntryPointSymbol=\"WinMainCRTStartup\"\n"
     1557                      "\t/>\n"
     1558                      "\t<Tool\n"
     1559                      "\t\tName=\"VCResourceCompilerTool\"\n"
     1560                      "\t\tPreprocessorDefinitions=\"HAS_INCLUDE_SET\"\n"
     1561                      "\t\tAdditionalIncludeDirectories=\"" << prefix << "\"\n"
     1562                      "\t/>\n"
     1563                      "</VisualStudioPropertySheet>\n";
     1564
     1565        properties.flush();
     1566}
     1567
     1568void VisualStudioProvider::createBuildProp(const BuildSetup &setup) {
     1569        std::ofstream properties((setup.outputDir + '/' + "ScummVM_Debug" + getPropertiesExtension()).c_str());
     1570        if (!properties)
     1571                error("Could not open \"" + setup.outputDir + '/' + "ScummVM_Debug" +  + getPropertiesExtension() + "\" for writing");
     1572
     1573        properties << "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n"
     1574                      "<VisualStudioPropertySheet\n"
     1575                      "\tProjectType=\"Visual C++\"\n"
     1576                      "\tVersion=\"8.00\"\n"
     1577                      "\tName=\"ScummVM_Debug32\"\n"
     1578                      "\tInheritedPropertySheets=\".\\ScummVM_Global.vsprops\"\n"
     1579                      "\t>\n"
     1580                      "\t<Tool\n"
     1581                      "\t\tName=\"VCCLCompilerTool\"\n"
     1582                      "\t\tOptimization=\"0\"\n"
     1583                      "\t\tPreprocessorDefinitions=\"WIN32\"\n"
     1584                      "\t\tMinimalRebuild=\"true\"\n"
     1585                      "\t\tBasicRuntimeChecks=\"3\"\n"
     1586                      "\t\tRuntimeLibrary=\"1\"\n"
     1587                      "\t\tEnableFunctionLevelLinking=\"true\"\n"
     1588                      "\t\tWarnAsError=\"false\"\n"
     1589                      "\t\tDebugInformationFormat=\"4\"\n"
     1590                      "\t/>\n"
     1591                      "\t<Tool\n"
     1592                      "\t\tName=\"VCLinkerTool\"\n"
     1593                      "\t\tLinkIncremental=\"2\"\n"
     1594                      "\t\tGenerateDebugInformation=\"true\"\n"
     1595                      "\t\tIgnoreDefaultLibraryNames=\"libcmt.lib\"\n"
     1596                      "\t/>\n"
     1597                      "</VisualStudioPropertySheet>\n";
     1598
     1599        properties.flush();
     1600        properties.close();
     1601
     1602        properties.open((setup.outputDir + '/' + "ScummVM_Debug64" + getPropertiesExtension()).c_str());
     1603        if (!properties)
     1604                error("Could not open \"" + setup.outputDir + '/' + "ScummVM_Debug64" + getPropertiesExtension() + "\" for writing");
     1605
     1606        properties << "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n"
     1607                      "<VisualStudioPropertySheet\n"
     1608                      "\tProjectType=\"Visual C++\"\n"
     1609                      "\tVersion=\"8.00\"\n"
     1610                      "\tName=\"ScummVM_Debug64\"\n"
     1611                      "\tInheritedPropertySheets=\".\\ScummVM_Global64.vsprops\"\n"
     1612                      "\t>\n"
     1613                      "\t<Tool\n"
     1614                      "\t\tName=\"VCCLCompilerTool\"\n"
     1615                      "\t\tOptimization=\"0\"\n"
     1616                      "\t\tPreprocessorDefinitions=\"WIN32\"\n"
     1617                      "\t\tMinimalRebuild=\"true\"\n"
     1618                      "\t\tBasicRuntimeChecks=\"3\"\n"
     1619                      "\t\tRuntimeLibrary=\"1\"\n"
     1620                      "\t\tEnableFunctionLevelLinking=\"true\"\n"
     1621                      "\t\tWarnAsError=\"false\"\n"
     1622                      "\t\tDebugInformationFormat=\"3\"\n"      // For x64 format "4" (Edit and continue) is not supported, thus we default to "3"
     1623                      "\t/>\n"
     1624                      "\t<Tool\n"
     1625                      "\t\tName=\"VCLinkerTool\"\n"
     1626                      "\t\tLinkIncremental=\"2\"\n"
     1627                      "\t\tGenerateDebugInformation=\"true\"\n"
     1628                      "\t\tIgnoreDefaultLibraryNames=\"libcmt.lib\"\n"
     1629                      "\t/>\n"
     1630                      "</VisualStudioPropertySheet>\n";
     1631
     1632        properties.flush();
     1633        properties.close();
     1634
     1635        properties.open((setup.outputDir + '/' + "ScummVM_Release" + getPropertiesExtension()).c_str());
     1636        if (!properties)
     1637                error("Could not open \"" + setup.outputDir + '/' + "ScummVM_Release" + getPropertiesExtension() + "\" for writing");
     1638
     1639        properties << "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n"
     1640                      "<VisualStudioPropertySheet\n"
     1641                      "\tProjectType=\"Visual C++\"\n"
     1642                      "\tVersion=\"8.00\"\n"
     1643                      "\tName=\"ScummVM_Release32\"\n"
     1644                      "\tInheritedPropertySheets=\".\\ScummVM_Global.vsprops\"\n"
     1645                      "\t>\n"
     1646                      "\t<Tool\n"
     1647                      "\t\tName=\"VCCLCompilerTool\"\n"
     1648                      "\t\tEnableIntrinsicFunctions=\"true\"\n"
     1649                      "\t\tWholeProgramOptimization=\"true\"\n"
     1650                      "\t\tPreprocessorDefinitions=\"WIN32\"\n"
     1651                      "\t\tStringPooling=\"true\"\n"
     1652                      "\t\tBufferSecurityCheck=\"false\"\n"
     1653                      "\t\tDebugInformationFormat=\"0\"\n"
     1654                      "\t/>\n"
     1655                      "\t<Tool\n"
     1656                      "\t\tName=\"VCLinkerTool\"\n"
     1657                      "\t\tLinkIncremental=\"1\"\n"
     1658                      "\t\tIgnoreDefaultLibraryNames=\"\"\n"
     1659                      "\t\tSetChecksum=\"true\"\n"
     1660                      "\t/>\n"
     1661                      "</VisualStudioPropertySheet>\n";
     1662
     1663        properties.flush();
     1664        properties.close();
     1665
     1666        properties.open((setup.outputDir + '/' + "ScummVM_Release64" + getPropertiesExtension()).c_str());
     1667        if (!properties)
     1668                error("Could not open \"" + setup.outputDir + '/' + "ScummVM_Release64" + getPropertiesExtension() + "\" for writing");
     1669
     1670        properties << "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n"
     1671                      "<VisualStudioPropertySheet\n"
     1672                      "\tProjectType=\"Visual C++\"\n"
     1673                      "\tVersion=\"8.00\"\n"
     1674                      "\tName=\"ScummVM_Release64\"\n"
     1675                      "\tInheritedPropertySheets=\".\\ScummVM_Global64.vsprops\"\n"
     1676                      "\t>\n"
     1677                      "\t<Tool\n"
     1678                      "\t\tName=\"VCCLCompilerTool\"\n"
     1679                      "\t\tEnableIntrinsicFunctions=\"true\"\n"
     1680                      "\t\tWholeProgramOptimization=\"true\"\n"
     1681                      "\t\tPreprocessorDefinitions=\"WIN32\"\n"
     1682                      "\t\tStringPooling=\"true\"\n"
     1683                      "\t\tBufferSecurityCheck=\"false\"\n"
     1684                      "\t\tDebugInformationFormat=\"0\"\n"
     1685                      "\t/>\n"
     1686                      "\t<Tool\n"
     1687                      "\t\tName=\"VCLinkerTool\"\n"
     1688                      "\t\tLinkIncremental=\"1\"\n"
     1689                      "\t\tIgnoreDefaultLibraryNames=\"\"\n"
     1690                      "\t\tSetChecksum=\"true\"\n"
     1691                      "\t/>\n"
     1692                      "</VisualStudioPropertySheet>\n";
     1693
     1694        properties.flush();
     1695        properties.close();
     1696}
     1697
     1698void VisualStudioProvider::writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation,
     1699                                                  const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix) {
     1700        const std::string indentString = getIndent(indentation + 2);
     1701
     1702        if (indentation)
     1703                projectFile << getIndent(indentation + 1) << "<Filter\tName=\"" << dir.name << "\">\n";
     1704
     1705        for (FileNode::NodeList::const_iterator i = dir.children.begin(); i != dir.children.end(); ++i) {
     1706                const FileNode *node = *i;
     1707
     1708                if (!node->children.empty()) {
     1709                        writeFileListToProject(*node, projectFile, indentation + 1, duplicate, objPrefix + node->name + '_', filePrefix + node->name + '/');
     1710                } else {
     1711                        if (producesObjectFile(node->name)) {
     1712                                std::string name, ext;
     1713                                splitFilename(node->name, name, ext);
     1714                                const bool isDuplicate = (std::find(duplicate.begin(), duplicate.end(), name + ".o") != duplicate.end());
     1715
     1716                                if (ext == "asm") {
     1717                                        std::string objFileName = "$(IntDir)\\";
     1718                                        if (isDuplicate)
     1719                                                objFileName += objPrefix;
     1720                                        objFileName += "$(InputName).obj";
     1721
     1722                                        const std::string toolLine = indentString + "\t\t<Tool Name=\"VCCustomBuildTool\" CommandLine=\"nasm.exe -f win32 -g -o &quot;" + objFileName + "&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;\" Outputs=\"" + objFileName + "\" />\n";
     1723
     1724                                        // NASM is not supported for x64, thus we do not need to add additional entries here :-).
     1725                                        projectFile << indentString << "<File RelativePath=\"" << convertPathToWin(filePrefix + node->name) << "\">\n"
     1726                                                    << indentString << "\t<FileConfiguration Name=\"Debug|Win32\">\n"
     1727                                                    << toolLine
     1728                                                    << indentString << "\t</FileConfiguration>\n"
     1729                                                    << indentString << "\t<FileConfiguration Name=\"Release|Win32\">\n"
     1730                                                    << toolLine
     1731                                                    << indentString << "\t</FileConfiguration>\n"
     1732                                                    << indentString << "</File>\n";
     1733                                } else {
     1734                                        if (isDuplicate) {
     1735                                                const std::string toolLine = indentString + "\t\t<Tool Name=\"VCCLCompilerTool\" ObjectFile=\"$(IntDir)\\" + objPrefix + "$(InputName).obj\" XMLDocumentationFileName=\"$(IntDir)\\" + objPrefix + "$(InputName).xdc\" />\n";
     1736
     1737                                                projectFile << indentString << "<File RelativePath=\"" << convertPathToWin(filePrefix + node->name) << "\">\n"
     1738                                                            << indentString << "\t<FileConfiguration Name=\"Debug|Win32\">\n"
     1739                                                            << toolLine
     1740                                                            << indentString << "\t</FileConfiguration>\n"
     1741                                                            << indentString << "\t<FileConfiguration Name=\"Release|Win32\">\n"
     1742                                                            << toolLine
     1743                                                            << indentString << "\t</FileConfiguration>\n"
     1744                                                            << indentString << "\t<FileConfiguration Name=\"Debug|x64\">\n"
     1745                                                            << toolLine
     1746                                                            << indentString << "\t</FileConfiguration>\n"
     1747                                                            << indentString << "\t<FileConfiguration Name=\"Release|x64\">\n"
     1748                                                            << toolLine
     1749                                                            << indentString << "\t</FileConfiguration>\n"
     1750                                                            << indentString << "</File>\n";
     1751                                        } else {
     1752                                                projectFile << indentString << "<File RelativePath=\"" << convertPathToWin(filePrefix + node->name) << "\" />\n";
     1753                                        }
     1754                                }
     1755                        } else {
     1756                                projectFile << indentString << "<File RelativePath=\"" << convertPathToWin(filePrefix + node->name) << "\" />\n";
     1757                        }
     1758                }
     1759        }
     1760
     1761        if (indentation)
     1762                projectFile << getIndent(indentation + 1) << "</Filter>\n";
     1763}
     1764
    16521765} // End of anonymous namespace
    16531766
    16541767void error(const std::string &message) {
  • tools/create_msvc/create_msvc.h

     
    4141 */
    4242struct EngineDesc {
    4343        /**
    44          * The name of the engine. We use this to determin the directory
     44         * The name of the engine. We use this to determine the directory
    4545         * the engine is in and to create the define, which needs to be
    4646         * set to enable the engine.
    4747         */
     
    8686EngineDescList parseConfigure(const std::string &srcDir);
    8787
    8888/**
    89  * Checks whether the specified engine is a sub engine. To dertermin this
     89 * Checks whether the specified engine is a sub engine. To determine this
    9090 * there is a fully setup engine list needed.
    9191 *
    9292 * @param name Name of the engine to check.
     
    191191};
    192192
    193193/**
    194  * Creates all MSVC build files: the solution
    195  * for all projects, all projects itself and the
    196  * global config files.
    197  *
    198  * @param setup Description of the desired build setup.
    199  * @param version Target MSVC version.
    200  */
    201 void createMSVCProject(const BuildSetup &setup, const int version);
    202 
    203 /**
    204194 * Quits the program with the specified error message.
    205195 *
    206196 * @param message The error message to print to stderr.