make_msvcX_install_[config] patch by Brezenbak

(i.e. make_msvc71_install_speed)

svn path=/trunk/; revision=20785
This commit is contained in:
Christoph von Wittich 2006-01-11 15:47:22 +00:00
parent cf64f6d550
commit 3802b8636c
8 changed files with 112 additions and 10 deletions

View 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)

View file

@ -60,7 +60,10 @@ void MSVCBackend::Process()
_clean_project_files();
return;
}
if ( configuration.InstallFiles ) {
_install_files( _get_vc_dir(), configuration.VSConfigurationType );
return;
}
string filename_sln ( ProjectNode.name );
//string filename_rules = "gccasm.rules";
@ -374,3 +377,42 @@ MSVCBackend::_clean_project_files ( void )
remove ( filename_dsw.c_str () );
}
bool
MSVCBackend::_copy_file ( const std::string& inputname, const std::string& targetname ) const
{
FILE * input = fopen ( inputname.c_str (), "rb" );
if ( !input )
return false;
FILE * output = fopen ( targetname.c_str (), "wb+" );
if ( !output )
{
fclose ( input );
return false;
}
char buffer[256];
int num_read;
while ( (num_read = fread( buffer, sizeof(char), 256, input) ) || !feof( input ) )
fwrite( buffer, sizeof(char), num_read, output );
fclose ( input );
fclose ( output );
return true;
}
void
MSVCBackend::_install_files (const std::string& vcdir, const::string& config)
{
for ( size_t i = 0; i < ProjectNode.modules.size(); i++ )
{
Module& module = *ProjectNode.modules[i];
if ( module.installBase == "" || module.installName == "" )
continue;
string inputname = Environment::GetOutputPath () + "\\" + module.GetBasePath () + "\\" + vcdir + "\\" + config + "\\" + module.GetTargetName ();
string installdir = Environment::GetInstallPath () + "\\" + module.installBase + "\\" + module.installName;
if ( _copy_file( inputname, installdir ) )
printf ("Installed File :'%s'\n",installdir.c_str () );
}
}

View file

@ -114,6 +114,8 @@ class MSVCBackend : public Backend
std::string vcproj_guid );
void _clean_project_files ( void );
void _get_object_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;
};
#endif // __MSVC_H__

View file

@ -145,11 +145,10 @@ MSVCBackend::_generate_vcproj ( const Module& module )
// this code is deactivated untill the tree builds fine with msvc
// --- is appended to each library path which is later
// replaced by the configuration
// i.e. ../output-i386/lib/rtl/---/rtl.lib becomes
// ../output-i386/lib/rtl/Debug/rtl.lib
// i.e. ../output-i386/lib/rtl/vcXX/---/rtl.lib becomes
// ../output-i386/lib/rtl/vcXX/Debug/rtl.lib
// etc
libs[i]->importedModule->
string libpath = outdir + "\\" + libs[i]->importedModule->GetBasePath() + "\\---\\" + libs[i]->name + ".lib";
string libpath = outdir + "\\" + libs[i]->importedModule->GetBasePath() + "\\" + _get_vc_dir() + "\\---\\" + libs[i]->name + ".lib";
libraries.push_back ( libpath );
#else
libraries.push_back ( libs[i]->name + ".lib" );

View file

@ -29,6 +29,7 @@ Configuration::Configuration ()
CompilationUnitsEnabled = true;
MakeHandlesInstallDirectories = false;
GenerateProxyMakefilesInSourceTree = false;
InstallFiles = false;
}
Configuration::~Configuration ()

View 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 ();

View 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,

View 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