Generate a GUID for each module processed. Later on this will be needed to support...
[reactos.git] / reactos / tools / rbuild / backend / msvc / msvc.cpp
index 4baaec1..7b0a5fe 100644 (file)
@@ -56,22 +56,24 @@ MSVCBackend::MSVCBackend(Project &project,
 \r
 void MSVCBackend::Process()\r
 {\r
-       bool exec = false;\r
-    const char rbuild_mingw[] = "output-i386\\tools\\rbuild\\rbuild.exe mingw"; \r
+       //bool exec = false;\r
+       //const char rbuild_mingw[] = "output-i386\\tools\\rbuild\\rbuild.exe mingw"; \r
 \r
-       string filename = ProjectNode.name + ".sln";\r
+       string filename = ProjectNode.name + ".dsw";\r
        \r
-       cout << "Creating MSVC project: " << filename << endl;\r
+       printf ( "Creating MSVC workspace: %s\n", filename.c_str() );\r
 \r
        ProcessModules();\r
 \r
-       m_devFile.open(filename.c_str());\r
+       m_dswFile = fopen ( filename.c_str(), "wb" );\r
 \r
-       if(!m_devFile.is_open())\r
+       if ( !m_dswFile )\r
        {\r
-               cout << "Could not open file." << endl;\r
+               printf ( "Could not create file '%s'.\n", filename.c_str() );\r
                return;\r
        }\r
+       _generate_wine_dsw ( m_dswFile );\r
+#if 0\r
        m_devFile << "Microsoft Visual Studio Solution File, Format Version 9.00" << endl;\r
        m_devFile << "# Visual C++ Express 2005" << endl;\r
 \r
@@ -91,24 +93,22 @@ void MSVCBackend::Process()
        m_devFile << "EndGlobal" << endl;\r
 \r
        m_devFile << endl << endl;\r
-\r
-       m_devFile.close();\r
-\r
-       gen_guid();\r
+#endif\r
+       fclose ( m_dswFile );\r
 \r
        // The MSVC build still needs the mingw backend.\r
-       ProcessModules();\r
+       //ProcessModules();\r
 \r
-       cout << "Done." << endl << endl;\r
+       printf ( "Done.\n" );\r
 \r
-       cout << "Don't expect the MSVC backend to work yet. "<< endl << endl;\r
+       /*cout << "Don't expect the MSVC backend to work yet. "<< endl << endl;\r
 \r
        if(get_key("yn","Would you like to configure for a Mingw build as well? (y/n)") == 'y')\r
        {\r
                exec = spawn_new(rbuild_mingw);\r
                        if (!exec)\r
                                printf("\nError invoking rbuild\n");\r
-       }\r
+       }*/\r
 }\r
 \r
 void MSVCBackend::ProcessModules()\r
@@ -117,12 +117,15 @@ void MSVCBackend::ProcessModules()
        {\r
                Module &module = *ProjectNode.modules[i];\r
 \r
-               for(size_t k = 0; k < module.non_if_data.files.size(); k++)\r
+               this->_generate_dsp ( module );\r
+               gen_guid();\r
+\r
+               /*for(size_t k = 0; k < module.non_if_data.files.size(); k++)\r
                {\r
                        File &file = *module.non_if_data.files[k];\r
                        \r
                        ProcessFile(file.name);\r
-               }\r
+               }*/\r
        }\r
 }\r
 \r
@@ -140,7 +143,8 @@ static bool FileExists(string &filename)
 void MSVCBackend::ProcessFile(string &filepath)\r
 {\r
        // Remove the .\ at the start of the filenames\r
-       filepath.erase(0, 2);\r
+       if ( filepath[0] == '.' && strchr ( "/\\", filepath[1] ) )\r
+               filepath.erase(0, 2);\r
 \r
        if(!FileExists(filepath))\r
                return;\r
@@ -205,6 +209,7 @@ void MSVCBackend::AddFolders(string &folder)
 \r
 void MSVCBackend::OutputFolders()\r
 {\r
+#if 0\r
        m_devFile << "Folders=";\r
 \r
        for(size_t i = 0; i < m_folders.size(); i++)\r
@@ -214,6 +219,7 @@ void MSVCBackend::OutputFolders()
 \r
                m_devFile << m_folders[i];\r
        }\r
+#endif\r
 }\r
 \r
 \r
@@ -244,3 +250,11 @@ bool spawn_new( const string& cmd )
        int exitcode = system ( command.c_str () );\r
        return (exitcode == 0);\r
 }\r
+\r
+std::string\r
+MSVCBackend::DspFileName ( const Module& module ) const\r
+{\r
+       return DosSeparator(\r
+               ReplaceExtension ( module.GetPath(), ".dsp" )\r
+               );\r
+}\r