Author: gedmurphy
Date: Thu Dec  3 17:09:09 2009
New Revision: 44377

URL: http://svn.reactos.org/svn/reactos?rev=44377&view=rev
Log:
- Initial re-architecture of the msvc backend.
- Split the MSVCBackend class into it's respective worker objects :
- * Use an abstract ProjMaker base class which we can now use to better 
implement support for future VS releases
- * Move sln creation into its own class
- Don't create the .user files anymore, they're not required for our use.
- Remove support for Visual Studio 6, Visual Studio 2002 and Visual Studio 2003
Although I haven't tested it, I'm 99.9% sure this breaks 'make msvc#' so DON'T 
RUN IT yet unless you want your vcproj files destroyed.

Added:
    trunk/reactos/tools/rbuild/backend/msvc/projmaker.cpp   (with props)
    trunk/reactos/tools/rbuild/backend/msvc/slnmaker.cpp   (with props)
Modified:
    trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp
    trunk/reactos/tools/rbuild/backend/msvc/msvc.h
    trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp
    trunk/reactos/tools/rbuild/backend/msvc/vcxprojmaker.cpp
    trunk/reactos/tools/rbuild/rbuild.h
    trunk/reactos/tools/rbuild/rbuild.mak
    trunk/reactos/tools/rbuild/rbuild.vcproj

Modified: trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp?rev=44377&r1=44376&r2=44377&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp [iso-8859-1] Thu Dec  3 
17:09:09 2009
@@ -4,6 +4,7 @@
  * Copyright (C) 2005 Steven Edwards
  * Copyright (C) 2005 Royce Mitchell
  * Copyright (C) 2006 Christoph von Wittich
+ * Copyright (C) 2009 Ged Murphy
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -48,6 +49,31 @@
 
 } factory;
 
+MSVCConfiguration::MSVCConfiguration ( const OptimizationType optimization, 
const HeadersType headers, const std::string &name )
+{
+       this->optimization = optimization;
+       this->headers = headers;
+       if ( name != "" )
+               this->name = name;
+       else
+       {
+               std::string headers_name;
+               if ( headers == MSVCHeaders )
+                       headers_name = "";
+               else
+                       headers_name = " - ReactOS headers";
+               if ( optimization == Debug )
+                       this->name = "Debug" + headers_name;
+               else if ( optimization == Release )
+                       this->name = "Release" + headers_name;
+               else if ( optimization == Speed )
+                       this->name = "Speed" + headers_name;
+               else if ( optimization == RosBuild )
+                       this->name = "RosBuild";
+               else
+                       this->name = "Unknown" + headers_name;
+       }
+}
 
 MSVCBackend::MSVCBackend(Project &project,
        Configuration& configuration) : Backend(project, configuration)
@@ -89,28 +115,16 @@
        }
        string filename_sln ( ProjectNode.name );
 
-       if ( configuration.VSProjectVersion == "6.00" )
-               filename_sln += "_auto.dsw";
-       else
-               filename_sln += "_auto.sln";
-
+       filename_sln += "_auto.sln";
        printf ( "Creating MSVC workspace: %s\n", filename_sln.c_str() );
 
+       // Write out the project files
        ProcessModules();
-       m_slnFile = fopen ( filename_sln.c_str(), "wb" );
-
-       if ( !m_slnFile )
-       {
-               printf ( "Could not create file '%s'.\n", filename_sln.c_str() 
);
-               return;
-       }
-
-       if ( configuration.VSProjectVersion == "6.00" )
-               _generate_wine_dsw ( m_slnFile );
-       else
-               _generate_sln ( m_slnFile );
-
-       fclose ( m_slnFile );
+
+       // Write the solution file
+       SlnMaker slnMaker( configuration, ProjectNode, m_configurations, 
filename_sln );
+       slnMaker._generate_sln ( _get_solution_version(), _get_studio_version() 
);
+
        printf ( "Done.\n" );
 }
 
@@ -122,12 +136,14 @@
 
                module.guid = _gen_guid();
 
-               if (configuration.VSProjectVersion == "6.00")
-                       _generate_dsp ( module );
-               else if (configuration.VSProjectVersion == "10.00")
-                       _generate_vcxproj ( module );
+               ProjMaker *projMaker;
+
+               if (configuration.VSProjectVersion == "10.00")
+                       projMaker = new VCXProjMaker( configuration, 
m_configurations, "test" );
                else
-                       _generate_vcproj ( module );
+                       projMaker = new VCProjMaker( configuration, 
m_configurations, "test" );
+
+               projMaker->_generate_proj_file ( module );
        }
 }
 
@@ -225,14 +241,6 @@
 }
 
 std::string
-MSVCBackend::OptFileName ( const Module& module ) const
-{
-       return FixSeparatorForSystemCommand(
-               ReplaceExtension ( module.output->relative_path + "\\" + 
module.output->name, "_" + _get_vc_dir() + "_auto.opt" )
-               );
-}
-
-std::string
 MSVCBackend::SuoFileName ( const Module& module ) const
 {
        return FixSeparatorForSystemCommand(
@@ -241,14 +249,6 @@
 }
 
 std::string
-MSVCBackend::DswFileName ( const Module& module ) const
-{
-       return FixSeparatorForSystemCommand(
-               ReplaceExtension ( module.output->relative_path + "\\" + 
module.output->name, "_auto.dsw" )
-               );
-}
-
-std::string
 MSVCBackend::SlnFileName ( const Module& module ) const
 {
        return FixSeparatorForSystemCommand(
@@ -265,14 +265,6 @@
 }
 
 std::string
-MSVCBackend::DspFileName ( const Module& module ) const
-{
-       return FixSeparatorForSystemCommand(
-               ReplaceExtension ( module.output->relative_path + "\\" + 
module.output->name, "_auto.dsp" )
-               );
-}
-
-std::string
 MSVCBackend::VcprojFileName ( const Module& module ) const
 {
        return FixSeparatorForSystemCommand(
@@ -282,20 +274,12 @@
 
 std::string MSVCBackend::_get_vc_dir ( void ) const
 {
-       if ( configuration.VSProjectVersion == "6.00" )
-               return "vc6";
-       else if ( configuration.VSProjectVersion == "7.00" )
-               return "vc70";
-       else if ( configuration.VSProjectVersion == "7.10" )
-               return "vc71";
-       else if ( configuration.VSProjectVersion == "8.00" )
+       if ( configuration.VSProjectVersion == "8.00" )
                return "vc8";
        else if ( configuration.VSProjectVersion == "10.00" )
                return "vc10";
        else /* default to VS2008 */
                return "vc9";
-
-
 }
 
 void
@@ -404,9 +388,6 @@
 
                string basepath = module.output->relative_path;
                remove ( NcbFileName ( module ).c_str () );
-               remove ( DspFileName ( module ).c_str () );
-               remove ( DswFileName ( module ).c_str () );
-               remove ( OptFileName ( module ).c_str () );
                remove ( SlnFileName ( module ).c_str () );
                remove ( SuoFileName ( module ).c_str () );
                remove ( VcprojFileName ( module ).c_str () );
@@ -414,12 +395,12 @@
                string username = getenv ( "USERNAME" );
                string computername = getenv ( "COMPUTERNAME" );
                string vcproj_file_user = "";
-
+#if 0
                if ((computername != "") && (username != ""))
                        vcproj_file_user = VcprojFileName ( module ) + "." + 
computername + "." + username + ".user";
 
                remove ( vcproj_file_user.c_str () );
-
+#endif
                _get_object_files ( module, out );
                _get_def_files ( module, out );
                for ( size_t j = 0; j < out.size (); j++)
@@ -430,10 +411,8 @@
        }
 
        string filename_sln = ProjectNode.name + ".sln";
-       string filename_dsw = ProjectNode.name + ".dsw";
 
        remove ( filename_sln.c_str () );
-       remove ( filename_dsw.c_str () );
 }
 
 bool
@@ -475,3 +454,64 @@
                        printf ("Installed File :'%s'\n",installdir.c_str () );
        }
 }
+
+std::string
+MSVCBackend::_get_solution_version ( void )
+{
+       string version;
+
+       if (configuration.VSProjectVersion.empty())
+               configuration.VSProjectVersion = MS_VS_DEF_VERSION;
+
+       else if (configuration.VSProjectVersion == "8.00")
+               version = "9.00";
+
+       else if (configuration.VSProjectVersion == "9.00")
+               version = "10.00";
+
+       else if (configuration.VSProjectVersion == "10.00")
+               version = "11.00";
+
+       return version;
+}
+
+std::string
+MSVCBackend::_get_studio_version ( void )
+{
+       string version;
+
+       if (configuration.VSProjectVersion.empty())
+               configuration.VSProjectVersion = MS_VS_DEF_VERSION;
+
+       else if (configuration.VSProjectVersion == "8.00")
+               version = "2005";
+
+       else if (configuration.VSProjectVersion == "9.00")
+               version = "2008";
+
+       else if (configuration.VSProjectVersion == "10.00")
+               version = "2010";
+
+       return version;
+}
+
+const Property*
+MSVCBackend::_lookup_property ( const Module& module, const std::string& name 
) const
+{
+       std::map<std::string, Property*>::const_iterator p;
+
+       /* Check local values */
+       p = module.non_if_data.properties.find(name);
+
+       if ( p != module.non_if_data.properties.end() )
+               return p->second;
+
+       // TODO FIXME - should we check local if-ed properties?
+       p = module.project.non_if_data.properties.find(name);
+
+       if ( p != module.project.non_if_data.properties.end() )
+               return p->second;
+
+       // TODO FIXME - should we check global if-ed properties?
+       return NULL;
+}

Modified: trunk/reactos/tools/rbuild/backend/msvc/msvc.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/msvc.h?rev=44377&r1=44376&r2=44377&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/backend/msvc/msvc.h [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/backend/msvc/msvc.h [iso-8859-1] Thu Dec  3 
17:09:09 2009
@@ -25,6 +25,10 @@
 
 #include "../backend.h"
 
+#ifdef OUT
+#undef OUT
+#endif//OUT
+
 
 class FileUnit
 {
@@ -98,11 +102,8 @@
                void OutputFolders();
                void OutputFileUnits();
 
-               std::string DspFileName ( const Module& module ) const;
                std::string VcprojFileName ( const Module& module ) const;
-               std::string DswFileName ( const Module& module ) const;
                std::string SlnFileName ( const Module& module ) const;
-               std::string OptFileName ( const Module& module ) const;
                std::string SuoFileName ( const Module& module ) const;
                std::string NcbFileName ( const Module& module ) const;
 
@@ -113,37 +114,38 @@
 
                int m_unitCount;
 
-               FILE* m_dswFile;
-               FILE* m_slnFile;
-               FILE* m_rulesFile;
-
-               // functions in msvcmaker.cpp:
-
-               void _generate_dsp ( const Module& module );
-               void _generate_dsw_header ( FILE* OUT );
-               void _generate_dsw_project (
-                       FILE* OUT,
-                       const Module& module,
-                       std::string dsp_file,
-                       const std::vector<Dependency*>& dependencies );
-
-               void _generate_dsw_footer ( FILE* OUT );
-               void _generate_wine_dsw ( FILE* OUT );
-
-               // functions in vcprojmaker.cpp:
-
-               std::string _strip_gcc_deffile(std::string Filename, 
std::string sourcedir, std::string objdir);
+               std::string _gen_guid();
+
                std::string _get_solution_version ( void );
                std::string _get_studio_version ( void );
-               std::string _gen_guid();
-               std::string _replace_str(
-                       std::string string1,
-                       const std::string &find_str,
-                       const std::string &replace_str);
-
                std::string _get_vc_dir ( void ) const;
 
-               // These are used in both _generate_vcproj and 
_generate_standard_configuration
+               void _clean_project_files ( void );
+               void _get_object_files ( const Module& module, 
std::vector<std::string>& out ) const;
+               void _get_def_files ( const Module& module, 
std::vector<std::string>& out ) const;
+               void _install_files ( const std::string& vcdir, const 
std::string& config );
+               bool _copy_file ( const std::string& inputname, const 
std::string& targetname ) const;
+               const Property* _lookup_property ( const Module& module, const 
std::string& name ) const;
+};
+
+
+// Abstract class
+class ProjMaker
+{
+       public:
+               ProjMaker ( );
+               ProjMaker ( Configuration& buildConfig, const 
std::vector<MSVCConfiguration*>& msvc_configs, std::string filename );
+               virtual ~ProjMaker() {}
+
+               virtual void _generate_proj_file ( const Module& module ) = 0;
+               virtual void _generate_user_configuration ();
+
+       protected:
+               Configuration configuration;
+               std::vector<MSVCConfiguration*> m_configurations;
+               std::string vcproj_file;
+               FILE* OUT;
+
                std::vector<std::string> header_files;
                std::vector<std::string> includes;
                std::vector<std::string> includes_ros;
@@ -151,36 +153,72 @@
                std::set<std::string> common_defines;
                std::string baseaddr;
 
-               void _generate_standard_configuration(
-                       FILE* OUT,
-                       const Module& module,
-                       const MSVCConfiguration& cfg,
-                       BinaryType binaryType );
-               void _generate_makefile_configuration( FILE* OUT, const Module& 
module, const MSVCConfiguration& cfg );
-
-               void _generate_vcproj ( const Module& module );
-               void _generate_vcxproj ( const Module& module );
-
-               void _generate_sln_header ( FILE* OUT );
-               void _generate_sln_footer ( FILE* OUT );
-               void _generate_sln ( FILE* OUT );
+               std::string VcprojFileName ( const Module& module ) const;
+               std::string _get_vc_dir ( void ) const;
+
+               std::string _strip_gcc_deffile(std::string Filename, 
std::string sourcedir, std::string objdir);
+               std::string _get_solution_version ( void );
+               std::string _get_studio_version ( void );
+               std::string _replace_str( std::string string1, const 
std::string &find_str, const std::string &replace_str);
+
+               void _generate_standard_configuration( const Module& module, 
const MSVCConfiguration& cfg, BinaryType binaryType );
+               void _generate_makefile_configuration( const Module& module, 
const MSVCConfiguration& cfg );
+};
+
+class VCProjMaker : public ProjMaker
+{
+       public:
+               VCProjMaker ( );
+               VCProjMaker ( Configuration& buildConfig, const 
std::vector<MSVCConfiguration*>& msvc_configs, std::string filename );
+               virtual ~VCProjMaker ();
+
+               void _generate_proj_file ( const Module& module );
+               void _generate_user_configuration ();
+
+       private:
+               void _generate_standard_configuration( const Module& module, 
const MSVCConfiguration& cfg, BinaryType binaryType );
+               void _generate_makefile_configuration( const Module& module, 
const MSVCConfiguration& cfg );
+};
+
+class VCXProjMaker : public ProjMaker
+{
+       public:
+               VCXProjMaker ( );
+               VCXProjMaker ( Configuration& buildConfig, const 
std::vector<MSVCConfiguration*>& msvc_configs, std::string filename );
+               virtual ~VCXProjMaker ();
+
+               void _generate_proj_file ( const Module& module );
+               void _generate_user_configuration ();
+
+       private:
+               void _generate_standard_configuration( const Module& module, 
const MSVCConfiguration& cfg, BinaryType binaryType );
+               void _generate_makefile_configuration( const Module& module, 
const MSVCConfiguration& cfg );
+};
+
+class SlnMaker
+{
+       public:
+               SlnMaker ( Configuration& buildConfig, Project& ProjectNode, 
const std::vector<MSVCConfiguration*>& configurations, std::string filename_sln 
);
+               ~SlnMaker ();
+
+               void _generate_sln ( std::string solution_version, std::string 
studio_version );
+
+       private:
+               Configuration m_configuration;
+               Project* m_ProjectNode;
+               std::vector<MSVCConfiguration*> m_configurations;
+               FILE* OUT;
+
+               void _generate_sln_header ( std::string solution_version, 
std::string studio_version );
+               void _generate_sln_footer ( );
                //void _generate_rules_file ( FILE* OUT );
                void _generate_sln_project (
-                       FILE* OUT,
                        const Module& module,
                        std::string vcproj_file,
                        std::string sln_guid,
                        std::string vcproj_guid,
                        const std::vector<Library*>& libraries );
-               void _generate_sln_configurations (
-                       FILE* OUT,
-                       std::string vcproj_guid );
-               void _clean_project_files ( void );
-               void _get_object_files ( const Module& module, 
std::vector<std::string>& out ) const;
-               void _get_def_files ( const Module& module, 
std::vector<std::string>& out ) const;
-               void _install_files ( const std::string& vcdir, const 
std::string& config );
-               bool _copy_file ( const std::string& inputname, const 
std::string& targetname ) const;
-               const Property* _lookup_property ( const Module& module, const 
std::string& name ) const;
+               void _generate_sln_configurations ( std::string vcproj_guid );
 };
 
 #endif // __MSVC_H__

Added: trunk/reactos/tools/rbuild/backend/msvc/projmaker.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/projmaker.cpp?rev=44377&view=auto
==============================================================================
--- trunk/reactos/tools/rbuild/backend/msvc/projmaker.cpp (added)
+++ trunk/reactos/tools/rbuild/backend/msvc/projmaker.cpp [iso-8859-1] Thu Dec  
3 17:09:09 2009
@@ -1,0 +1,226 @@
+/*
+ * Copyright (C) 2002 Patrik Stridvall
+ * Copyright (C) 2005 Royce Mitchell III
+ * Copyright (C) 2006 Hervé Poussineau
+ * Copyright (C) 2006 Christoph von Wittich
+ * Copyright (C) 2009 Ged Murphy
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef _MSC_VER
+#pragma warning ( disable : 4786 )
+#endif//_MSC_VER
+
+#include <string>
+#include <vector>
+#include <set>
+#include <algorithm>
+#include <fstream>
+#include <iostream>
+
+#include <stdio.h>
+
+#include "msvc.h"
+
+using std::string;
+using std::vector;
+using std::set;
+
+typedef set<string> StringSet;
+
+#ifdef OUT
+#undef OUT
+#endif//OUT
+
+ProjMaker::ProjMaker ( )
+{
+       vcproj_file = "";
+}
+
+ProjMaker::ProjMaker ( Configuration& buildConfig,
+                                          const 
std::vector<MSVCConfiguration*>& msvc_configs,
+                                          std::string filename )
+{
+       configuration = buildConfig;
+       m_configurations = msvc_configs;
+       vcproj_file = filename;
+}
+
+void
+ProjMaker::_generate_proj_file ( const Module& module )
+{
+       printf("_generate_proj_file not implemented for the base class\n");
+}
+
+void
+ProjMaker::_generate_user_configuration()
+{
+#if 0
+       /* User configuration file */
+       if (vcproj_file_user != "")
+       {
+               OUT = fopen ( vcproj_file_user.c_str(), "wb" );
+               fprintf ( OUT, "<?xml version=\"1.0\" encoding = 
\"Windows-1252\"?>\r\n" );
+               fprintf ( OUT, "<VisualStudioUserFile\r\n" );
+               fprintf ( OUT, "\tProjectType=\"Visual C++\"\r\n" );
+               fprintf ( OUT, "\tVersion=\"%s\"\r\n", 
configuration.VSProjectVersion.c_str() );
+               fprintf ( OUT, "\tShowAllFiles=\"false\"\r\n" );
+               fprintf ( OUT, "\t>\r\n" );
+
+               fprintf ( OUT, "\t<Configurations>\r\n" );
+               for ( size_t icfg = 0; icfg < m_configurations.size(); icfg++ )
+               {
+                       const MSVCConfiguration& cfg = *m_configurations[icfg];
+                       fprintf ( OUT, "\t\t<Configuration\r\n" );
+                       fprintf ( OUT, "\t\t\tName=\"%s|Win32\"\r\n", 
cfg.name.c_str() );
+                       fprintf ( OUT, "\t\t\t>\r\n" );
+                       fprintf ( OUT, "\t\t\t<DebugSettings\r\n" );
+                       if ( module_type == ".cpl" )
+                       {
+                               fprintf ( OUT, 
"\t\t\t\tCommand=\"rundll32.exe\"\r\n" );
+                               fprintf ( OUT, "\t\t\t\tCommandArguments=\" 
shell32,Control_RunDLL &quot;$(TargetPath)&quot;,@\"\r\n" );
+                       }
+                       else
+                       {
+                               fprintf ( OUT, 
"\t\t\t\tCommand=\"$(TargetPath)\"\r\n" );
+                               fprintf ( OUT, 
"\t\t\t\tCommandArguments=\"\"\r\n" );
+                       }
+                       fprintf ( OUT, "\t\t\t\tAttach=\"false\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tDebuggerType=\"3\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tRemote=\"1\"\r\n" );
+                       string remote_machine = "\t\t\t\tRemoteMachine=\"" + 
computername + "\"\r\n";
+                       fprintf ( OUT, remote_machine.c_str() );
+                       fprintf ( OUT, "\t\t\t\tRemoteCommand=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tHttpUrl=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tPDBPath=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tSQLDebugging=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tEnvironment=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tEnvironmentMerge=\"true\"\r\n" 
);
+                       fprintf ( OUT, "\t\t\t\tDebuggerFlavor=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tMPIRunCommand=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tMPIRunArguments=\"\"\r\n" );
+                       fprintf ( OUT, 
"\t\t\t\tMPIRunWorkingDirectory=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tApplicationCommand=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tApplicationArguments=\"\"\r\n" 
);
+                       fprintf ( OUT, "\t\t\t\tShimCommand=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tMPIAcceptMode=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tMPIAcceptFilter=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t/>\r\n" );
+                       fprintf ( OUT, "\t\t</Configuration>\r\n" );
+               }
+               fprintf ( OUT, "\t</Configurations>\r\n" );
+               fprintf ( OUT, "</VisualStudioUserFile>\r\n" );
+               fclose ( OUT );
+       }
+#endif
+}
+
+
+void
+ProjMaker::_generate_standard_configuration( const Module& module, const 
MSVCConfiguration& cfg, BinaryType binaryType )
+{
+       printf("_generate_standard_configuration not implemented for the base 
class\n");
+}
+
+void
+ProjMaker::_generate_makefile_configuration( const Module& module, const 
MSVCConfiguration& cfg )
+{
+       printf("_generate_makefile_configuration not implemented for the base 
class\n");
+}
+
+std::string
+ProjMaker::_get_vc_dir ( void ) const
+{
+       if ( configuration.VSProjectVersion == "8.00" )
+               return "vc8";
+       else if ( configuration.VSProjectVersion == "10.00" )
+               return "vc10";
+       else /* default to VS2008 */
+               return "vc9";
+}
+
+std::string
+ProjMaker::VcprojFileName ( const Module& module ) const
+{
+       return FixSeparatorForSystemCommand(
+                       ReplaceExtension ( module.output->relative_path + "\\" 
+ module.name, "_" + _get_vc_dir() + "_auto.vcproj" )
+                       );
+}
+
+std::string
+ProjMaker::_strip_gcc_deffile(std::string Filename, std::string sourcedir, 
std::string objdir)
+{
+       std::string NewFilename = Environment::GetIntermediatePath () + "\\" + 
objdir + "\\" + Filename;
+       // we don't like infinite loops - so replace it in two steps
+       NewFilename = _replace_str(NewFilename, ".def", "_msvc.de");
+       NewFilename = _replace_str(NewFilename, "_msvc.de", "_msvc.def");
+       Filename = sourcedir + "\\" + Filename;
+
+       Directory dir(objdir);
+       dir.GenerateTree(IntermediateDirectory, false);
+
+       std::fstream in_file(Filename.c_str(), std::ios::in);
+       std::fstream out_file(NewFilename.c_str(), std::ios::out);
+       std::string::size_type pos;
+       DWORD i = 0;
+
+       std::string line;
+       while (std::getline(in_file, line))
+       {
+               pos = line.find("@", 0);
+               while (std::string::npos != pos)
+               {
+                       if (pos > 1)
+                       {
+                               // make sure it is stdcall and no ordinal
+                               if (line[pos -1] != ' ')
+                               {
+                                       i = 0;
+                                       while (true)
+                                       {
+                                               i++;
+                                               if ((line[pos + i] < '0') || 
(line[pos + i] > '9'))
+                                                       break;
+                                       }
+                                       line.replace(pos, i, "");
+                               }
+                       }
+                       pos = line.find("@", pos + 1);
+               }
+
+               line += "\n";
+               out_file << line;
+       }
+       in_file.close();
+       out_file.close();
+
+       return NewFilename;
+}
+
+std::string
+ProjMaker::_replace_str(std::string string1, const std::string &find_str, 
const std::string &replace_str)
+{
+       std::string::size_type pos = string1.find(find_str, 0);
+       int intLen = find_str.length();
+
+       while(std::string::npos != pos)
+       {
+               string1.replace(pos, intLen, replace_str);
+               pos = string1.find(find_str, intLen + pos);
+       }
+
+       return string1;
+}

Propchange: trunk/reactos/tools/rbuild/backend/msvc/projmaker.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: trunk/reactos/tools/rbuild/backend/msvc/slnmaker.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/slnmaker.cpp?rev=44377&view=auto
==============================================================================
--- trunk/reactos/tools/rbuild/backend/msvc/slnmaker.cpp (added)
+++ trunk/reactos/tools/rbuild/backend/msvc/slnmaker.cpp [iso-8859-1] Thu Dec  
3 17:09:09 2009
@@ -1,0 +1,172 @@
+/*
+ * Copyright (C) 2002 Patrik Stridvall
+ * Copyright (C) 2005 Royce Mitchell III
+ * Copyright (C) 2006 Hervé Poussineau
+ * Copyright (C) 2006 Christoph von Wittich
+ * Copyright (C) 2009 Ged Murphy
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef _MSC_VER
+#pragma warning ( disable : 4786 )
+#endif//_MSC_VER
+
+#include <string>
+#include <vector>
+#include <set>
+#include <algorithm>
+#include <fstream>
+#include <iostream>
+
+#include <stdio.h>
+
+#include "msvc.h"
+
+using std::string;
+using std::vector;
+using std::set;
+
+
+
+SlnMaker::SlnMaker ( Configuration& buildConfig,
+                                        Project& ProjectNode,
+                                        const std::vector<MSVCConfiguration*>& 
configurations,
+                                        std::string filename_sln )
+{
+       m_configuration = buildConfig;
+       m_ProjectNode = &ProjectNode;
+       m_configurations = configurations;
+
+       OUT = fopen ( filename_sln.c_str(), "wb" );
+
+       if ( !OUT )
+       {
+               printf ( "Could not create file '%s'.\n", filename_sln.c_str() 
);
+       }
+}
+
+SlnMaker::~SlnMaker()
+{
+       fclose ( OUT );
+}
+
+void
+SlnMaker::_generate_sln_header ( std::string solution_version, std::string 
studio_version )
+{
+       //fprintf ( OUT, "Microsoft Visual Studio Solution File, Format Version 
%s\r\n", _get_solution_version().c_str() );
+       //fprintf ( OUT, "# Visual Studio %s\r\n", 
_get_studio_version().c_str() );
+       fprintf ( OUT, "Microsoft Visual Studio Solution File, Format Version 
%s\r\n", solution_version.c_str() );
+       fprintf ( OUT, "# Visual Studio %s\r\n", studio_version.c_str() );
+       fprintf ( OUT, "\r\n" );
+}
+
+
+void
+SlnMaker::_generate_sln_project (
+       const Module& module,
+       std::string vcproj_file,
+       std::string sln_guid,
+       std::string vcproj_guid,
+       const std::vector<Library*>& libraries )
+{
+       vcproj_file = DosSeparator ( std::string(".\\") + vcproj_file );
+
+       fprintf ( OUT, "Project(\"%s\") = \"%s\", \"%s\", \"%s\"\r\n", 
sln_guid.c_str() , module.name.c_str(), vcproj_file.c_str(), 
vcproj_guid.c_str() );
+/*
+       //FIXME: only omit ProjectDependencies in VS 2005 when there are no 
dependencies
+       //NOTE: VS 2002 do not use ProjectSection; it uses GlobalSection instead
+       if ((configuration.VSProjectVersion == "7.10") || (libraries.size() > 
0)) {
+               fprintf ( OUT, "\tProjectSection(ProjectDependencies) = 
postProject\r\n" );
+               for ( size_t i = 0; i < libraries.size(); i++ )
+               {
+                       const Module& module = *libraries[i]->importedModule;
+                       fprintf ( OUT, "\t\t%s = %s\r\n", module.guid.c_str(), 
module.guid.c_str() );
+               }
+               fprintf ( OUT, "\tEndProjectSection\r\n" );
+       }
+*/
+       fprintf ( OUT, "EndProject\r\n" );
+}
+
+
+void
+SlnMaker::_generate_sln_footer ( )
+{
+       fprintf ( OUT, "Global\r\n" );
+       fprintf ( OUT, "\tGlobalSection(SolutionConfigurationPlatforms) = 
preSolution\r\n" );
+       for ( size_t i = 0; i < m_configurations.size(); i++ )
+               fprintf ( OUT, "\t\t%s = %s\r\n", 
m_configurations[i]->name.c_str(), m_configurations[i]->name.c_str() );
+       fprintf ( OUT, "\tEndGlobalSection\r\n" );
+
+       fprintf ( OUT, "\tGlobalSection(ProjectConfigurationPlatforms) = 
postSolution\r\n" );
+       for( std::map<std::string, Module*>::const_iterator p = 
m_ProjectNode->modules.begin(); p != m_ProjectNode->modules.end(); ++ p )
+       {
+               Module& module = *p->second;
+               std::string guid = module.guid;
+               _generate_sln_configurations ( guid.c_str() );
+       }
+       fprintf ( OUT, "\tEndGlobalSection\r\n" );
+/*
+       fprintf ( OUT, "\tGlobalSection(ExtensibilityGlobals) = 
postSolution\r\n" );
+       fprintf ( OUT, "\tEndGlobalSection\r\n" );
+       fprintf ( OUT, "\tGlobalSection(ExtensibilityAddIns) = 
postSolution\r\n" );
+       fprintf ( OUT, "\tEndGlobalSection\r\n" );
+*/
+
+       if (m_configuration.VSProjectVersion == "7.00") {
+               fprintf ( OUT, "\tGlobalSection(ProjectDependencies) = 
postSolution\r\n" );
+               //FIXME: Add dependencies for VS 2002
+               fprintf ( OUT, "\tEndGlobalSection\r\n" );
+       }
+       else {
+               fprintf ( OUT, "\tGlobalSection(SolutionProperties) = 
preSolution\r\n" );
+               fprintf ( OUT, "\t\tHideSolutionNode = FALSE\r\n" );
+               fprintf ( OUT, "\tEndGlobalSection\r\n" );
+       }
+
+       fprintf ( OUT, "EndGlobal\r\n" );
+       fprintf ( OUT, "\r\n" );
+}
+
+
+void
+SlnMaker::_generate_sln_configurations (  std::string vcproj_guid )
+{
+       for ( size_t i = 0; i < m_configurations.size (); i++)
+       {
+               const MSVCConfiguration& cfg = *m_configurations[i];
+               fprintf ( OUT, "\t\t%s.%s|Win32.ActiveCfg = %s|Win32\r\n", 
vcproj_guid.c_str(), cfg.name.c_str(), cfg.name.c_str() );
+               fprintf ( OUT, "\t\t%s.%s|Win32.Build.0 = %s|Win32\r\n", 
vcproj_guid.c_str(), cfg.name.c_str(), cfg.name.c_str() );
+       }
+}
+
+void
+SlnMaker::_generate_sln ( std::string solution_version, std::string 
studio_version )
+{
+       string sln_guid = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}";
+       vector<string> guids;
+
+       _generate_sln_header( solution_version, studio_version);
+       // TODO FIXME - is it necessary to sort them?
+       for( std::map<std::string, Module*>::const_iterator p = 
m_ProjectNode->modules.begin(); p != m_ProjectNode->modules.end(); ++ p )
+       {
+               Module& module = *p->second;
+
+               //std::string vcproj_file = 
+               _generate_sln_project ( module, module.name, sln_guid, 
module.guid, module.non_if_data.libraries );
+       }
+       _generate_sln_footer ( );
+}

Propchange: trunk/reactos/tools/rbuild/backend/msvc/slnmaker.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp?rev=44377&r1=44376&r2=44377&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp [iso-8859-1] 
(original)
+++ trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp [iso-8859-1] Thu 
Dec  3 17:09:09 2009
@@ -53,38 +53,38 @@
        }
 };
 
-MSVCConfiguration::MSVCConfiguration ( const OptimizationType optimization, 
const HeadersType headers, const std::string &name )
+
+VCProjMaker::VCProjMaker ( )
 {
-       this->optimization = optimization;
-       this->headers = headers;
-       if ( name != "" )
-               this->name = name;
-       else
-       {
-               std::string headers_name;
-               if ( headers == MSVCHeaders )
-                       headers_name = "";
-               else
-                       headers_name = " - ReactOS headers";
-               if ( optimization == Debug )
-                       this->name = "Debug" + headers_name;
-               else if ( optimization == Release )
-                       this->name = "Release" + headers_name;
-               else if ( optimization == Speed )
-                       this->name = "Speed" + headers_name;
-               else if ( optimization == RosBuild )
-                       this->name = "RosBuild";
-               else
-                       this->name = "Unknown" + headers_name;
-       }
+       vcproj_file = "";
 }
 
+VCProjMaker::VCProjMaker ( Configuration& buildConfig,
+                                                  const 
std::vector<MSVCConfiguration*>& msvc_configs,
+                                                  std::string filename )
+{
+       configuration = buildConfig;
+       m_configurations = msvc_configs;
+       vcproj_file = filename;
+
+       OUT = fopen ( vcproj_file.c_str(), "wb" );
+
+       if ( !OUT )
+       {
+               printf ( "Could not create file '%s'.\n", vcproj_file.c_str() );
+       }
+}
+
+VCProjMaker::~VCProjMaker()
+{
+       fclose ( OUT );
+}
+
 void
-MSVCBackend::_generate_vcproj ( const Module& module )
+VCProjMaker::_generate_proj_file ( const Module& module )
 {
        size_t i;
 
-       string vcproj_file = VcprojFileName(module);
        string computername;
        string username;
 
@@ -108,7 +108,6 @@
                vcproj_file_user = vcproj_file + "." + computername + "." + 
username + ".user";
 
        printf ( "Creating MSVC.NET project: '%s'\n", vcproj_file.c_str() );
-       FILE* OUT = fopen ( vcproj_file.c_str(), "wb" );
 
        string path_basedir = module.GetPathToBaseDir ();
        string intenv = Environment::GetIntermediatePath ();
@@ -263,11 +262,11 @@
 
                if ( cfg.optimization == RosBuild )
                {
-                       _generate_makefile_configuration( OUT, module, cfg );
+                       _generate_makefile_configuration( module, cfg );
                }
                else
                {
-                       _generate_standard_configuration( OUT, module, cfg, 
binaryType );
+                       _generate_standard_configuration( module, cfg, 
binaryType );
                }
        }
        fprintf ( OUT, "\t</Configurations>\r\n" );
@@ -440,70 +439,15 @@
        fprintf ( OUT, "\t<Globals>\r\n" );
        fprintf ( OUT, "\t</Globals>\r\n" );
        fprintf ( OUT, "</VisualStudioProject>\r\n" );
-       fclose ( OUT );
-
-#if 0
-       /* User configuration file */
-       if (vcproj_file_user != "")
-       {
-               OUT = fopen ( vcproj_file_user.c_str(), "wb" );
-               fprintf ( OUT, "<?xml version=\"1.0\" encoding = 
\"Windows-1252\"?>\r\n" );
-               fprintf ( OUT, "<VisualStudioUserFile\r\n" );
-               fprintf ( OUT, "\tProjectType=\"Visual C++\"\r\n" );
-               fprintf ( OUT, "\tVersion=\"%s\"\r\n", 
configuration.VSProjectVersion.c_str() );
-               fprintf ( OUT, "\tShowAllFiles=\"false\"\r\n" );
-               fprintf ( OUT, "\t>\r\n" );
-
-               fprintf ( OUT, "\t<Configurations>\r\n" );
-               for ( size_t icfg = 0; icfg < m_configurations.size(); icfg++ )
-               {
-                       const MSVCConfiguration& cfg = *m_configurations[icfg];
-                       fprintf ( OUT, "\t\t<Configuration\r\n" );
-                       fprintf ( OUT, "\t\t\tName=\"%s|Win32\"\r\n", 
cfg.name.c_str() );
-                       fprintf ( OUT, "\t\t\t>\r\n" );
-                       fprintf ( OUT, "\t\t\t<DebugSettings\r\n" );
-                       if ( module_type == ".cpl" )
-                       {
-                               fprintf ( OUT, 
"\t\t\t\tCommand=\"rundll32.exe\"\r\n" );
-                               fprintf ( OUT, "\t\t\t\tCommandArguments=\" 
shell32,Control_RunDLL &quot;$(TargetPath)&quot;,@\"\r\n" );
-                       }
-                       else
-                       {
-                               fprintf ( OUT, 
"\t\t\t\tCommand=\"$(TargetPath)\"\r\n" );
-                               fprintf ( OUT, 
"\t\t\t\tCommandArguments=\"\"\r\n" );
-                       }
-                       fprintf ( OUT, "\t\t\t\tAttach=\"false\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tDebuggerType=\"3\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tRemote=\"1\"\r\n" );
-                       string remote_machine = "\t\t\t\tRemoteMachine=\"" + 
computername + "\"\r\n";
-                       fprintf ( OUT, remote_machine.c_str() );
-                       fprintf ( OUT, "\t\t\t\tRemoteCommand=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tHttpUrl=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tPDBPath=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tSQLDebugging=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tEnvironment=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tEnvironmentMerge=\"true\"\r\n" 
);
-                       fprintf ( OUT, "\t\t\t\tDebuggerFlavor=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tMPIRunCommand=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tMPIRunArguments=\"\"\r\n" );
-                       fprintf ( OUT, 
"\t\t\t\tMPIRunWorkingDirectory=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tApplicationCommand=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tApplicationArguments=\"\"\r\n" 
);
-                       fprintf ( OUT, "\t\t\t\tShimCommand=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tMPIAcceptMode=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tMPIAcceptFilter=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t/>\r\n" );
-                       fprintf ( OUT, "\t\t</Configuration>\r\n" );
-               }
-               fprintf ( OUT, "\t</Configurations>\r\n" );
-               fprintf ( OUT, "</VisualStudioUserFile>\r\n" );
-               fclose ( OUT );
-       }
-#endif
 }
 
-void MSVCBackend::_generate_standard_configuration( FILE* OUT,
-                                                                               
                        const Module& module,
+void VCProjMaker::_generate_user_configuration ()
+{
+       // Call base implementation
+       ProjMaker::_generate_user_configuration ();
+}
+
+void VCProjMaker::_generate_standard_configuration( const Module& module,
                                                                                
                        const MSVCConfiguration& cfg,
                                                                                
                        BinaryType binaryType )
 {
@@ -942,7 +886,7 @@
 
 
 void
-MSVCBackend::_generate_makefile_configuration( FILE* OUT, const Module& 
module, const MSVCConfiguration& cfg )
+VCProjMaker::_generate_makefile_configuration( const Module& module, const 
MSVCConfiguration& cfg )
 {
        string path_basedir = module.GetPathToBaseDir ();
        string intenv = Environment::GetIntermediatePath ();
@@ -1002,248 +946,3 @@
        fprintf ( OUT, "\t\t\t/>\r\n" );
        fprintf ( OUT, "\t\t</Configuration>\r\n" );
 }
-
-
-std::string
-MSVCBackend::_strip_gcc_deffile(std::string Filename, std::string sourcedir, 
std::string objdir)
-{
-       std::string NewFilename = Environment::GetIntermediatePath () + "\\" + 
objdir + "\\" + Filename;
-       // we don't like infinite loops - so replace it in two steps
-       NewFilename = _replace_str(NewFilename, ".def", "_msvc.de");
-       NewFilename = _replace_str(NewFilename, "_msvc.de", "_msvc.def");
-       Filename = sourcedir + "\\" + Filename;
-
-       Directory dir(objdir);
-       dir.GenerateTree(IntermediateDirectory, false);
-
-       std::fstream in_file(Filename.c_str(), std::ios::in);
-       std::fstream out_file(NewFilename.c_str(), std::ios::out);
-       std::string::size_type pos;
-       DWORD i = 0;
-
-       std::string line;
-       while (std::getline(in_file, line))
-       {
-               pos = line.find("@", 0);
-               while (std::string::npos != pos)
-               {
-                       if (pos > 1)
-                       {
-                               // make sure it is stdcall and no ordinal
-                               if (line[pos -1] != ' ')
-                               {
-                                       i = 0;
-                                       while (true)
-                                       {
-                                               i++;
-                                               if ((line[pos + i] < '0') || 
(line[pos + i] > '9'))
-                                                       break;
-                                       }
-                                       line.replace(pos, i, "");
-                               }
-                       }
-                       pos = line.find("@", pos + 1);
-               }
-
-               line += "\n";
-               out_file << line;
-       }
-       in_file.close();
-       out_file.close();
-
-       return NewFilename;
-}
-
-std::string
-MSVCBackend::_replace_str(std::string string1, const std::string &find_str, 
const std::string &replace_str)
-{
-       std::string::size_type pos = string1.find(find_str, 0);
-       int intLen = find_str.length();
-
-       while(std::string::npos != pos)
-       {
-               string1.replace(pos, intLen, replace_str);
-               pos = string1.find(find_str, intLen + pos);
-       }
-
-       return string1;
-}
-
-std::string
-MSVCBackend::_get_solution_version ( void )
-{
-       string version;
-
-       if (configuration.VSProjectVersion.empty())
-               configuration.VSProjectVersion = MS_VS_DEF_VERSION;
-
-       else if (configuration.VSProjectVersion == "7.00")
-               version = "7.00";
-
-       else if (configuration.VSProjectVersion == "7.10")
-               version = "8.00";
-
-       else if (configuration.VSProjectVersion == "8.00")
-               version = "9.00";
-
-       else if (configuration.VSProjectVersion == "9.00")
-               version = "10.00";
-
-       else if (configuration.VSProjectVersion == "10.00")
-               version = "11.00";
-
-       return version;
-}
-
-std::string
-MSVCBackend::_get_studio_version ( void )
-{
-       string version;
-
-       if (configuration.VSProjectVersion.empty())
-               configuration.VSProjectVersion = MS_VS_DEF_VERSION;
-
-       else if (configuration.VSProjectVersion == "7.00")
-               version = "2002";
-
-       else if (configuration.VSProjectVersion == "7.10")
-               version = "2003";
-
-       else if (configuration.VSProjectVersion == "8.00")
-               version = "2005";
-
-       else if (configuration.VSProjectVersion == "9.00")
-               version = "2008";
-
-       else if (configuration.VSProjectVersion == "10.00")
-               version = "2010";
-
-       return version;
-}
-
-void
-MSVCBackend::_generate_sln_header ( FILE* OUT )
-{
-       fprintf ( OUT, "Microsoft Visual Studio Solution File, Format Version 
%s\r\n", _get_solution_version().c_str() );
-       fprintf ( OUT, "# Visual Studio %s\r\n", _get_studio_version().c_str() 
);
-       fprintf ( OUT, "\r\n" );
-}
-
-
-void
-MSVCBackend::_generate_sln_project (
-       FILE* OUT,
-       const Module& module,
-       std::string vcproj_file,
-       std::string sln_guid,
-       std::string vcproj_guid,
-       const std::vector<Library*>& libraries )
-{
-       vcproj_file = DosSeparator ( std::string(".\\") + vcproj_file );
-
-       fprintf ( OUT, "Project(\"%s\") = \"%s\", \"%s\", \"%s\"\r\n", 
sln_guid.c_str() , module.name.c_str(), vcproj_file.c_str(), 
vcproj_guid.c_str() );
-
-       //FIXME: only omit ProjectDependencies in VS 2005 when there are no 
dependencies
-       //NOTE: VS 2002 do not use ProjectSection; it uses GlobalSection instead
-       if ((configuration.VSProjectVersion == "7.10") || (libraries.size() > 
0)) {
-               fprintf ( OUT, "\tProjectSection(ProjectDependencies) = 
postProject\r\n" );
-               for ( size_t i = 0; i < libraries.size(); i++ )
-               {
-                       const Module& module = *libraries[i]->importedModule;
-                       fprintf ( OUT, "\t\t%s = %s\r\n", module.guid.c_str(), 
module.guid.c_str() );
-               }
-               fprintf ( OUT, "\tEndProjectSection\r\n" );
-       }
-
-       fprintf ( OUT, "EndProject\r\n" );
-}
-
-
-void
-MSVCBackend::_generate_sln_footer ( FILE* OUT )
-{
-       fprintf ( OUT, "Global\r\n" );
-       fprintf ( OUT, "\tGlobalSection(SolutionConfigurationPlatforms) = 
preSolution\r\n" );
-       for ( size_t i = 0; i < m_configurations.size(); i++ )
-               fprintf ( OUT, "\t\t%s = %s\r\n", 
m_configurations[i]->name.c_str(), m_configurations[i]->name.c_str() );
-       fprintf ( OUT, "\tEndGlobalSection\r\n" );
-
-       fprintf ( OUT, "\tGlobalSection(ProjectConfigurationPlatforms) = 
postSolution\r\n" );
-       for( std::map<std::string, Module*>::const_iterator p = 
ProjectNode.modules.begin(); p != ProjectNode.modules.end(); ++ p )
-       {
-               Module& module = *p->second;
-               std::string guid = module.guid;
-               _generate_sln_configurations ( OUT, guid.c_str() );
-       }
-       fprintf ( OUT, "\tEndGlobalSection\r\n" );
-/*
-       fprintf ( OUT, "\tGlobalSection(ExtensibilityGlobals) = 
postSolution\r\n" );
-       fprintf ( OUT, "\tEndGlobalSection\r\n" );
-       fprintf ( OUT, "\tGlobalSection(ExtensibilityAddIns) = 
postSolution\r\n" );
-       fprintf ( OUT, "\tEndGlobalSection\r\n" );
-*/
-       if (configuration.VSProjectVersion == "7.00") {
-               fprintf ( OUT, "\tGlobalSection(ProjectDependencies) = 
postSolution\r\n" );
-               //FIXME: Add dependencies for VS 2002
-               fprintf ( OUT, "\tEndGlobalSection\r\n" );
-       }
-       else {
-               fprintf ( OUT, "\tGlobalSection(SolutionProperties) = 
preSolution\r\n" );
-               fprintf ( OUT, "\t\tHideSolutionNode = FALSE\r\n" );
-               fprintf ( OUT, "\tEndGlobalSection\r\n" );
-       }
-
-       fprintf ( OUT, "EndGlobal\r\n" );
-       fprintf ( OUT, "\r\n" );
-}
-
-
-void
-MSVCBackend::_generate_sln_configurations ( FILE* OUT, std::string vcproj_guid 
)
-{
-       for ( size_t i = 0; i < m_configurations.size (); i++)
-       {
-               const MSVCConfiguration& cfg = *m_configurations[i];
-               fprintf ( OUT, "\t\t%s.%s|Win32.ActiveCfg = %s|Win32\r\n", 
vcproj_guid.c_str(), cfg.name.c_str(), cfg.name.c_str() );
-               fprintf ( OUT, "\t\t%s.%s|Win32.Build.0 = %s|Win32\r\n", 
vcproj_guid.c_str(), cfg.name.c_str(), cfg.name.c_str() );
-       }
-}
-
-void
-MSVCBackend::_generate_sln ( FILE* OUT )
-{
-       string sln_guid = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}";
-       vector<string> guids;
-
-       _generate_sln_header(OUT);
-       // TODO FIXME - is it necessary to sort them?
-       for( std::map<std::string, Module*>::const_iterator p = 
ProjectNode.modules.begin(); p != ProjectNode.modules.end(); ++ p )
-       {
-               Module& module = *p->second;
-
-               std::string vcproj_file = VcprojFileName ( module );
-               _generate_sln_project ( OUT, module, vcproj_file, sln_guid, 
module.guid, module.non_if_data.libraries );
-       }
-       _generate_sln_footer ( OUT );
-}
-
-const Property*
-MSVCBackend::_lookup_property ( const Module& module, const std::string& name 
) const
-{
-       std::map<std::string, Property*>::const_iterator p;
-
-       /* Check local values */
-       p = module.non_if_data.properties.find(name);
-
-       if ( p != module.non_if_data.properties.end() )
-               return p->second;
-
-       // TODO FIXME - should we check local if-ed properties?
-       p = module.project.non_if_data.properties.find(name);
-
-       if ( p != module.project.non_if_data.properties.end() )
-               return p->second;
-
-       // TODO FIXME - should we check global if-ed properties?
-       return NULL;
-}

Modified: trunk/reactos/tools/rbuild/backend/msvc/vcxprojmaker.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/vcxprojmaker.cpp?rev=44377&r1=44376&r2=44377&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/backend/msvc/vcxprojmaker.cpp [iso-8859-1] 
(original)
+++ trunk/reactos/tools/rbuild/backend/msvc/vcxprojmaker.cpp [iso-8859-1] Thu 
Dec  3 17:09:09 2009
@@ -1,4 +1,8 @@
 /*
+ * Copyright (C) 2002 Patrik Stridvall
+ * Copyright (C) 2005 Royce Mitchell III
+ * Copyright (C) 2006 Hervé Poussineau
+ * Copyright (C) 2006 Christoph von Wittich
  * Copyright (C) 2009 Ged Murphy
  *
  * This program is free software; you can redistribute it and/or modify
@@ -15,6 +19,10 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
+
+#ifdef _MSC_VER
+#pragma warning ( disable : 4786 )
+#endif//_MSC_VER
 
 #include <string>
 #include <vector>
@@ -37,141 +45,57 @@
 #undef OUT
 #endif//OUT
 
+
+VCXProjMaker::VCXProjMaker ( )
+{
+       vcproj_file = "";
+}
+
+VCXProjMaker::VCXProjMaker ( Configuration& buildConfig,
+                                                        const 
std::vector<MSVCConfiguration*>& msvc_configs,
+                                                        std::string filename )
+{
+       configuration = buildConfig;
+       m_configurations = msvc_configs;
+       vcproj_file = filename;
+
+       OUT = fopen ( vcproj_file.c_str(), "wb" );
+
+       if ( !OUT )
+       {
+               printf ( "Could not create file '%s'.\n", vcproj_file.c_str() );
+       }
+}
+
+VCXProjMaker::~VCXProjMaker()
+{
+       fclose ( OUT );
+}
+
 void
-MSVCBackend::_generate_vcxproj ( const Module& module )
+VCXProjMaker::_generate_proj_file ( const Module& module )
 {
-       size_t i;
+       // TODO: Implement me
+       ProjMaker::_generate_proj_file ( module );
+}
 
-       string vcproj_file = VcprojFileName(module);
-       string computername;
-       string username;
-       string intermediatedir = "";
+void
+VCXProjMaker::_generate_user_configuration ()
+{
+       // Call base implementation
+       ProjMaker::_generate_user_configuration ();
+}
 
-       if (getenv ( "USERNAME" ) != NULL)
-               username = getenv ( "USERNAME" );
-       if (getenv ( "COMPUTERNAME" ) != NULL)
-               computername = getenv ( "COMPUTERNAME" );
-       else if (getenv ( "HOSTNAME" ) != NULL)
-               computername = getenv ( "HOSTNAME" );
+void
+VCXProjMaker::_generate_standard_configuration( const Module& module, const 
MSVCConfiguration& cfg, BinaryType binaryType )
+{
+       // TODO: Implement me
+       ProjMaker::_generate_standard_configuration ( module, cfg, binaryType );
+}
 
-       printf ( "Creating MSVC project: '%s'\n", vcproj_file.c_str() );
-       FILE* OUT = fopen ( vcproj_file.c_str(), "wb" );
-
-       string path_basedir = module.GetPathToBaseDir ();
-       string intenv = Environment::GetIntermediatePath ();
-       string outenv = Environment::GetOutputPath ();
-       string outdir;
-       string intdir;
-       string vcdir;
-
-       if ( intenv == "obj-i386" )
-               intdir = path_basedir + "obj-i386"; /* append relative dir from 
project dir */
-       else
-               intdir = intenv;
-
-       if ( outenv == "output-i386" )
-               outdir = path_basedir + "output-i386";
-       else
-               outdir = outenv;
-
-       if ( configuration.UseVSVersionInPath )
-       {
-               vcdir = DEF_SSEP + _get_vc_dir();
-       }
-
-
-
-       bool include_idl = false;
-
-       vector<string> source_files, resource_files;
-       vector<const IfableData*> ifs_list;
-       ifs_list.push_back ( &module.project.non_if_data );
-       ifs_list.push_back ( &module.non_if_data );
-
-       while ( ifs_list.size() )
-       {
-               const IfableData& data = *ifs_list.back();
-               ifs_list.pop_back();
-               const vector<File*>& files = data.files;
-               for ( i = 0; i < files.size(); i++ )
-               {
-                       if (files[i]->file.directory != SourceDirectory)
-                               continue;
-
-                       // We want the full path here for directory support 
later on
-                       string path = Path::RelativeFromDirectory (
-                               files[i]->file.relative_path,
-                               module.output->relative_path );
-                       string file = path + std::string("\\") + 
files[i]->file.name;
-
-                       if ( !stricmp ( Right(file,3).c_str(), ".rc" ) )
-                               resource_files.push_back ( file );
-                       else if ( !stricmp ( Right(file,2).c_str(), ".h" ) )
-                               header_files.push_back ( file );
-                       else
-                               source_files.push_back ( file );
-               }
-               const vector<Include*>& incs = data.includes;
-               for ( i = 0; i < incs.size(); i++ )
-               {
-                       string path = Path::RelativeFromDirectory (
-                               incs[i]->directory->relative_path,
-                               module.output->relative_path );
-                       if ( module.type != RpcServer && module.type != 
RpcClient )
-                       {
-                               if ( path.find ("/include/reactos/idl") != 
string::npos)
-                               {
-                                       include_idl = true;
-                                       continue;
-                               }
-                       }
-                       // switch between general headers and ros headers
-                       if ( 
!strncmp(incs[i]->directory->relative_path.c_str(), "include\\crt", 11 ) ||
-                            
!strncmp(incs[i]->directory->relative_path.c_str(), "include\\ddk", 11 ) ||
-                            
!strncmp(incs[i]->directory->relative_path.c_str(), "include\\GL", 10 ) ||
-                            
!strncmp(incs[i]->directory->relative_path.c_str(), "include\\psdk", 12 ) ||
-                            
!strncmp(incs[i]->directory->relative_path.c_str(), "include\\reactos\\wine", 
20 ) )
-                       {
-                               if 
(strncmp(incs[i]->directory->relative_path.c_str(), "include\\crt", 11 ))
-                                       // not crt include
-                                       includes_ros.push_back ( path );
-                       }
-                       else
-                       {
-                               includes.push_back ( path );
-                       }
-               }
-               const vector<Library*>& libs = data.libraries;
-               for ( i = 0; i < libs.size(); i++ )
-               {
-                       string libpath = outdir + "\\" + 
libs[i]->importedModule->output->relative_path + "\\" + _get_vc_dir() + 
"\\---\\" + libs[i]->name + ".lib";
-                       libraries.push_back ( libpath );
-               }
-               const vector<Define*>& defs = data.defines;
-               for ( i = 0; i < defs.size(); i++ )
-               {
-                       if ( defs[i]->backend != "" && defs[i]->backend != 
"msvc" )
-                               continue;
-
-                       if ( defs[i]->value[0] )
-                               common_defines.insert( defs[i]->name + "=" + 
defs[i]->value );
-                       else
-                               common_defines.insert( defs[i]->name );
-               }
-               for ( std::map<std::string, Property*>::const_iterator p = 
data.properties.begin(); p != data.properties.end(); ++ p )
-               {
-                       Property& prop = *p->second;
-                       if ( strstr ( module.baseaddress.c_str(), 
prop.name.c_str() ) )
-                               baseaddr = prop.value;
-               }
-       }
-       /* include intermediate path for reactos.rc */
-       string version = intdir + "\\include";
-       includes.push_back (version);
-       version += "\\reactos";
-       includes.push_back (version);
-
-       string include_string;
-
-       fprintf ( OUT, "<?xml version=\"1.0\" encoding = 
\"Windows-1252\"?>\r\n" );
+void
+VCXProjMaker::_generate_makefile_configuration( const Module& module, const 
MSVCConfiguration& cfg )
+{
+       // TODO: Implement me
+       ProjMaker::_generate_makefile_configuration ( module, cfg );
 }

Modified: trunk/reactos/tools/rbuild/rbuild.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/rbuild.h?rev=44377&r1=44376&r2=44377&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/rbuild.h [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/rbuild.h [iso-8859-1] Thu Dec  3 17:09:09 2009
@@ -68,7 +68,7 @@
 #define DEF_SBAD_SEP "\\"
 #endif
 
-#define MS_VS_DEF_VERSION "7.10"
+#define MS_VS_DEF_VERSION "8.00"
 
 class XmlNode;
 class Directory;

Modified: trunk/reactos/tools/rbuild/rbuild.mak
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/rbuild.mak?rev=44377&r1=44376&r2=44377&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/rbuild.mak [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/rbuild.mak [iso-8859-1] Thu Dec  3 17:09:09 2009
@@ -227,7 +227,8 @@
 RBUILD_BACKEND_MSVC_BASE_SOURCES = $(addprefix $(RBUILD_MSVC_BASE_), \
        genguid.cpp \
        msvc.cpp \
-       msvcmaker.cpp \
+       projmaker.cpp \
+       slnmaker.cpp \
        vcprojmaker.cpp \
        vcxprojmaker.cpp \
        )
@@ -522,8 +523,12 @@
 $(RBUILD_MSVC_INT_)msvc.o: $(RBUILD_MSVC_BASE_)msvc.cpp $(RBUILD_HEADERS) | 
$(RBUILD_MSVC_INT)
        $(ECHO_HOSTCC)
        ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
-
-$(RBUILD_MSVC_INT_)msvcmaker.o: $(RBUILD_MSVC_BASE_)msvcmaker.cpp 
$(RBUILD_HEADERS) | $(RBUILD_MSVC_INT)
+       
+$(RBUILD_MSVC_INT_)projmaker.o: $(RBUILD_MSVC_BASE_)projmaker.cpp 
$(RBUILD_HEADERS) | $(RBUILD_MSVC_INT)
+       $(ECHO_HOSTCC)
+       ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
+       
+$(RBUILD_MSVC_INT_)slnmaker.o: $(RBUILD_MSVC_BASE_)slnmaker.cpp 
$(RBUILD_HEADERS) | $(RBUILD_MSVC_INT)
        $(ECHO_HOSTCC)
        ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
 

Modified: trunk/reactos/tools/rbuild/rbuild.vcproj
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/rbuild.vcproj?rev=44377&r1=44376&r2=44377&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/rbuild.vcproj [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/rbuild.vcproj [iso-8859-1] Thu Dec  3 17:09:09 
2009
@@ -287,28 +287,12 @@
                                        >
                                </File>
                                <File
-                                       
RelativePath="backend\msvc\msvcmaker.cpp"
-                                       >
-                                       <FileConfiguration
-                                               Name="Release|Win32"
-                                               >
-                                               <Tool
-                                                       Name="VCCLCompilerTool"
-                                                       Optimization="2"
-                                                       
PreprocessorDefinitions=""
-                                               />
-                                       </FileConfiguration>
-                                       <FileConfiguration
-                                               Name="Debug|Win32"
-                                               >
-                                               <Tool
-                                                       Name="VCCLCompilerTool"
-                                                       Optimization="0"
-                                                       
AdditionalIncludeDirectories=""
-                                                       
PreprocessorDefinitions=""
-                                                       BasicRuntimeChecks="3"
-                                               />
-                                       </FileConfiguration>
+                                       
RelativePath=".\backend\msvc\projmaker.cpp"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath=".\backend\msvc\slnmaker.cpp"
+                                       >
                                </File>
                                <File
                                        
RelativePath="backend\msvc\vcprojmaker.cpp"


Reply via email to