added new cmdline switch to rbuild: -vs{version}

to select the version of MS VS project files to generate

default is now 7.10 (VS 2003)

svn path=/trunk/; revision=18621
This commit is contained in:
Christoph von Wittich 2005-10-20 06:40:58 +00:00
parent 089e05b94d
commit 2eb4ba358b
3 changed files with 68 additions and 7 deletions

View file

@ -171,7 +171,11 @@ MSVCBackend::_generate_vcproj ( const Module& module )
fprintf ( OUT, "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\r\n" );
fprintf ( OUT, "<VisualStudioProject\r\n" );
fprintf ( OUT, "\tProjectType=\"Visual C++\"\r\n" );
fprintf ( OUT, "\tVersion=\"7.00\"\r\n" );
if (configuration.VSProjectVersion.empty())
configuration.VSProjectVersion = MS_VS_DEF_VERSION;
fprintf ( OUT, "\tVersion=\"%s\"\r\n", configuration.VSProjectVersion.c_str() );
fprintf ( OUT, "\tName=\"%s\"\r\n", module.name.c_str() );
fprintf ( OUT, "\tKeyword=\"Win32Proj\">\r\n" );
@ -386,8 +390,22 @@ MSVCBackend::_generate_vcproj ( const Module& module )
void
MSVCBackend::_generate_sln_header ( FILE* OUT )
{
fprintf ( OUT, "Microsoft Visual Studio Solution File, Format Version 9.00\r\n" );
fprintf ( OUT, "# Visual C++ Express 2005\r\n" );
if (configuration.VSProjectVersion.empty())
configuration.VSProjectVersion = MS_VS_DEF_VERSION;
string version;
if (configuration.VSProjectVersion == "7.00")
version = "7.00";
if (configuration.VSProjectVersion == "7.10")
version = "8.00";
if (configuration.VSProjectVersion == "8.00")
version = "9.00";
fprintf ( OUT, "Microsoft Visual Studio Solution File, Format Version %s\r\n", version.c_str() );
fprintf ( OUT, "# Visual Studio 2005\r\n" );
fprintf ( OUT, "\r\n" );
}
@ -410,7 +428,7 @@ MSVCBackend::_generate_sln ( FILE* OUT )
/*
m_devFile << "Microsoft Visual Studio Solution File, Format Version 9.00" << endl;
m_devFile << "# Visual C++ Express 2005" << endl;
m_devFile << "# Visual Studio 2005" << endl;
m_devFile << "# FIXME Project listings here" << endl;
m_devFile << "EndProject" << endl;

View file

@ -61,6 +61,41 @@ ParseAutomaticDependencySwitch ( char switchChar2,
return true;
}
bool
ParseVCProjectSwitch ( char switchChar2,
char* switchStart )
{
switch ( switchChar2 )
{
case 's':
if ( strlen ( switchStart ) <= 3 )
{
printf ( "Switch -dm requires a module name\n" );
return false;
}
configuration.VSProjectVersion = string(&switchStart[3]);
if (configuration.VSProjectVersion.at(0) == '{') {
printf ( "Error: invalid char {\n" );
return false;
}
if (configuration.VSProjectVersion.length() == 1) //7,8
configuration.VSProjectVersion.append(".00");
if (configuration.VSProjectVersion.length() == 3) //7.1
configuration.VSProjectVersion.append("0");
break;
default:
printf ( "Unknown switch -d%c\n",
switchChar2 );
return false;
}
return true;
}
bool
ParseMakeSwitch ( char switchChar2 )
{
@ -101,7 +136,11 @@ ParseSwitch ( int argc, char** argv, int index )
switch ( switchChar )
{
case 'v':
configuration.Verbose = true;
if (switchChar2 == 's')
return ParseVCProjectSwitch ( switchChar2,
argv[index] );
else
configuration.Verbose = true;
break;
case 'c':
configuration.CleanAsYouGo = true;
@ -163,11 +202,12 @@ main ( int argc, char** argv )
printf ( " not generate the directories.\n" );
printf ( " -ps Generate proxy makefiles in source tree instead of the output.\n" );
printf ( " tree.\n" );
printf ( " -vs{version} Version of MS VS project files. Default is %s.\n", MS_VS_DEF_VERSION );
printf ( "\n" );
printf ( " buildsystem Target build system. Can be one of:\n" );
printf ( " mingw MinGW\n" );
printf ( " devcpp DevC++\n\n" );
printf ( " msvc Generates dsp files for MSVC" );
printf ( " devcpp DevC++\n" );
printf ( " msvc MS Visual Studio\n" );
return 1;
}
try

View file

@ -57,6 +57,8 @@ typedef std::vector<std::string> string_list;
#define SBAD_SEP "\\"
#endif
#define MS_VS_DEF_VERSION "7.10"
class Project;
class IfableData;
class Module;
@ -95,6 +97,7 @@ public:
bool AutomaticDependencies;
bool CheckDependenciesForModuleOnly;
std::string CheckDependenciesForModuleOnlyModule;
std::string VSProjectVersion;
bool MakeHandlesInstallDirectories;
bool GenerateProxyMakefilesInSourceTree;
};