make_msvcX_install_[config] patch by Brezenbak
authorChristoph von Wittich <christoph_vw@reactos.org>
Wed, 11 Jan 2006 15:47:22 +0000 (15:47 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Wed, 11 Jan 2006 15:47:22 +0000 (15:47 +0000)
(i.e. make_msvc71_install_speed)

svn path=/trunk/; revision=20785

reactos/Makefile
reactos/tools/rbuild/backend/msvc/msvc.cpp
reactos/tools/rbuild/backend/msvc/msvc.h
reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp
reactos/tools/rbuild/configuration.cpp
reactos/tools/rbuild/project.cpp
reactos/tools/rbuild/rbuild.cpp
reactos/tools/rbuild/rbuild.h

index ce29342..f685a8a 100644 (file)
@@ -396,22 +396,22 @@ msvc8: $(RBUILD_TARGET)
        $(ECHO_RBUILD)
        $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs8.00 msvc
 
-.PHONY: msvc6
+.PHONY: msvc6_clean
 msvc6_clean: $(RBUILD_TARGET)
        $(ECHO_RBUILD)
        $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs6.00 msvc
 
-.PHONY: msvc7
+.PHONY: msvc7_clean
 msvc7_clean: $(RBUILD_TARGET)
        $(ECHO_RBUILD)
        $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs7.00 msvc
 
-.PHONY: msvc71
+.PHONY: msvc71_clean
 msvc71_clean: $(RBUILD_TARGET)
        $(ECHO_RBUILD)
        $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs7.10 msvc
 
-.PHONY: msvc8
+.PHONY: msvc8_clean
 msvc8_clean: $(RBUILD_TARGET)
        $(ECHO_RBUILD)
        $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs8.00 msvc
@@ -429,6 +429,52 @@ msvc_clean_all: $(RBUILD_TARGET)
        $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs7.10 msvc
        $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs8.10 msvc
 
+.PHONY: msvc7_install_debug
+msvc7_install_debug: $(RBUILD_TARGET)
+       $(ECHO_RBUILD)
+       $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.00 -vcdebug msvc
+
+.PHONY: msvc7_install_release
+msvc7_install_release: $(RBUILD_TARGET)
+       $(ECHO_RBUILD)
+       $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.00 -vcrelease msvc
+
+.PHONY: msvc7_install_speed
+msvc7_install_speed: $(RBUILD_TARGET)
+       $(ECHO_RBUILD)
+       $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.00 -vcspeed msvc
+
+.PHONY: msvc71_install_debug
+msvc71_install_debug: $(RBUILD_TARGET)
+       $(ECHO_RBUILD)
+       $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.10 -vcdebug msvc
+
+.PHONY: msvc71_install_release
+msvc71_install_release: $(RBUILD_TARGET)
+       $(ECHO_RBUILD)
+       $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.10 -vcrelease msvc
+
+
+.PHONY: msvc71_install_speed
+msvc71_install_speed: $(RBUILD_TARGET)
+       $(ECHO_RBUILD)
+       $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.10 -vcspeed msvc
+
+.PHONY: msvc8_install_debug
+msvc8_install_debug: $(RBUILD_TARGET)
+       $(ECHO_RBUILD)
+       $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs8.00 -vcdebug msvc
+
+.PHONY: msvc8_install_release
+msvc8_install_release: $(RBUILD_TARGET)
+       $(ECHO_RBUILD)
+       $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs8.00 -vcrelease msvc
+
+.PHONY: msvc8_install_speed
+msvc8_install_speed: $(RBUILD_TARGET)
+       $(ECHO_RBUILD)
+       $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs8.00 -vcspeed msvc
+
 .PHONY: makefile_auto_clean
 makefile_auto_clean:
        -@$(rm) $(ROS_AUTOMAKE) $(PREAUTO) 2>$(NUL)
index 25adae1..dfadc5e 100644 (file)
@@ -60,7 +60,10 @@ void MSVCBackend::Process()
                _clean_project_files();\r
                return;\r
        }\r
-\r
+       if ( configuration.InstallFiles ) {\r
+               _install_files( _get_vc_dir(),  configuration.VSConfigurationType );\r
+               return;\r
+       }\r
        string filename_sln ( ProjectNode.name );\r
        //string filename_rules = "gccasm.rules";\r
        \r
@@ -374,3 +377,42 @@ MSVCBackend::_clean_project_files ( void )
        remove ( filename_dsw.c_str () );\r
 }\r
 \r
+bool\r
+MSVCBackend::_copy_file ( const std::string& inputname, const std::string& targetname ) const\r
+{\r
+  FILE * input = fopen ( inputname.c_str (), "rb" );\r
+       if ( !input )\r
+               return false;\r
+\r
+  FILE * output = fopen ( targetname.c_str (), "wb+" );\r
+  if ( !output )\r
+  {\r
+       fclose ( input );\r
+       return false;\r
+  }\r
+\r
+  char buffer[256];\r
+  int num_read;\r
+  while ( (num_read = fread( buffer, sizeof(char), 256, input) ) || !feof( input ) )\r
+               fwrite( buffer, sizeof(char), num_read, output );\r
+\r
+  fclose ( input );\r
+  fclose ( output );\r
+  return true;\r
+}\r
+\r
+void\r
+MSVCBackend::_install_files (const std::string& vcdir, const::string& config)\r
+{\r
+       for ( size_t i = 0; i < ProjectNode.modules.size(); i++ )\r
+       {\r
+               Module& module = *ProjectNode.modules[i];\r
+               if ( module.installBase == "" || module.installName == "" )\r
+                       continue;\r
+\r
+               string inputname = Environment::GetOutputPath () + "\\" + module.GetBasePath () + "\\" + vcdir + "\\" + config + "\\" + module.GetTargetName ();\r
+               string installdir = Environment::GetInstallPath () + "\\" + module.installBase + "\\" + module.installName;\r
+               if ( _copy_file( inputname, installdir ) )\r
+                       printf ("Installed File :'%s'\n",installdir.c_str () );\r
+       }\r
+}\r
index 459fcee..4ddbcd1 100644 (file)
@@ -114,6 +114,8 @@ class MSVCBackend : public Backend
                        std::string vcproj_guid );\r
                void _clean_project_files ( void );\r
                void _get_object_files ( const Module& module, std::vector<std::string>& out ) const;\r
+               void _install_files ( const std::string& vcdir, const std::string& config );\r
+               bool _copy_file ( const std::string& inputname, const std::string& targetname ) const;\r
 };\r
 \r
 #endif // __MSVC_H__\r
index f0b32fa..3140229 100644 (file)
@@ -145,11 +145,10 @@ MSVCBackend::_generate_vcproj ( const Module& module )
                        // this code is deactivated untill the tree builds fine with msvc\r
                        // --- is appended to each library path which is later\r
                        // replaced by the configuration\r
-                       // i.e. ../output-i386/lib/rtl/---/rtl.lib becomes\r
-                       //      ../output-i386/lib/rtl/Debug/rtl.lib \r
+                       // i.e. ../output-i386/lib/rtl/vcXX/---/rtl.lib becomes\r
+                       //      ../output-i386/lib/rtl/vcXX/Debug/rtl.lib \r
                        // etc\r
-                       libs[i]->importedModule->\r
-                       string libpath = outdir + "\\" + libs[i]->importedModule->GetBasePath() + "\\---\\" + libs[i]->name + ".lib";\r
+                       string libpath = outdir + "\\" + libs[i]->importedModule->GetBasePath() + "\\" + _get_vc_dir() + "\\---\\" + libs[i]->name + ".lib";\r
                        libraries.push_back ( libpath );\r
 #else\r
                libraries.push_back ( libs[i]->name + ".lib" );\r
index f384f18..08fddde 100644 (file)
@@ -29,6 +29,7 @@ Configuration::Configuration ()
        CompilationUnitsEnabled = true;
        MakeHandlesInstallDirectories = false;
        GenerateProxyMakefilesInSourceTree = false;
+       InstallFiles = false;
 }
 
 Configuration::~Configuration ()
index 9617d36..a705c30 100644 (file)
@@ -298,6 +298,12 @@ Project::ProcessXML ( const string& path )
                        (property->value == non_if_data.ifs[i]->value);
                if ( conditionTrue )
                        non_if_data.ifs[i]->data.ExtractModules( modules );
+               else
+               {
+                       If * if_data = non_if_data.ifs[i];
+                       non_if_data.ifs.erase ( non_if_data.ifs.begin () + i );
+                       delete if_data;
+               }
        }
        for ( i = 0; i < linkerFlags.size (); i++ )
                linkerFlags[i]->ProcessXML ();
index e838e86..42d5052 100644 (file)
@@ -106,6 +106,10 @@ ParseVCProjectSwitch (
                        if (configuration.VSProjectVersion.length() == 3) //7.1
                                configuration.VSProjectVersion.append("0");
 
+                       break;
+               case 'c':
+                       configuration.VSConfigurationType = string (&switchStart[3]);
+                       configuration.InstallFiles = true;
                        break;
                default:
                        printf ( "Unknown switch -d%c\n",
@@ -155,7 +159,7 @@ ParseSwitch ( int argc, char** argv, int index )
        switch ( switchChar )
        {
                case 'v':
-                       if (switchChar2 == 's')
+                       if (switchChar2 == 's' || switchChar2 == 'c' )
                        {
                                return ParseVCProjectSwitch (
                                        switchChar2,
index 917512a..f6b9df7 100644 (file)
@@ -141,8 +141,10 @@ public:
        bool CompilationUnitsEnabled;
        std::string CheckDependenciesForModuleOnlyModule;
        std::string VSProjectVersion;
+       std::string VSConfigurationType;
        bool MakeHandlesInstallDirectories;
        bool GenerateProxyMakefilesInSourceTree;
+       bool InstallFiles;
 };
 
 class Environment