Add an option to disable precompiled headers

svn path=/trunk/; revision=34186
This commit is contained in:
Hervé Poussineau 2008-06-29 12:42:11 +00:00
parent b6e4377917
commit d595a43107
5 changed files with 54 additions and 20 deletions

View file

@ -118,6 +118,7 @@
# -c Clean as you go. Delete generated files as soon as they are not needed anymore.
# -dd Disable automatic dependencies.
# -dm{module} Check only automatic dependencies for this module.
# -hd Disable precompiled headers.
# -mi Let make handle creation of install directories. Rbuild will not generate the directories.
# -ps Generate proxy makefiles in source tree instead of the output tree.
# -ud Disable compilation units.

View file

@ -1074,30 +1074,38 @@ MingwBackend::DetectPCHSupport ()
{
printf ( "Detecting compiler pre-compiled header support..." );
string path = "tools" + sSep + "rbuild" + sSep + "backend" + sSep + "mingw" + sSep + "pch_detection.h";
string cmd = ssprintf (
"%s -c %s 1>%s 2>%s",
FixSeparatorForSystemCommand(compilerCommand).c_str (),
path.c_str (),
NUL,
NUL );
system ( cmd.c_str () );
path += ".gch";
FILE* f = fopen ( path.c_str (), "rb" );
if ( f )
if ( configuration.PrecompiledHeadersEnabled )
{
use_pch = true;
fclose ( f );
unlink ( path.c_str () );
string path = "tools" + sSep + "rbuild" + sSep + "backend" + sSep + "mingw" + sSep + "pch_detection.h";
string cmd = ssprintf (
"%s -c %s 1>%s 2>%s",
FixSeparatorForSystemCommand(compilerCommand).c_str (),
path.c_str (),
NUL,
NUL );
system ( cmd.c_str () );
path += ".gch";
FILE* f = fopen ( path.c_str (), "rb" );
if ( f )
{
use_pch = true;
fclose ( f );
unlink ( path.c_str () );
}
else
use_pch = false;
if ( use_pch )
printf ( "detected\n" );
else
printf ( "not detected\n" );
}
else
{
use_pch = false;
if ( use_pch )
printf ( "detected\n" );
else
printf ( "not detected\n" );
printf ( "disabled\n" );
}
}
void

View file

@ -27,6 +27,7 @@ Configuration::Configuration ()
AutomaticDependencies = true;
CheckDependenciesForModuleOnly = false;
CompilationUnitsEnabled = true;
PrecompiledHeadersEnabled = true;
MakeHandlesInstallDirectories = false;
GenerateProxyMakefilesInSourceTree = false;
InstallFiles = false;

View file

@ -82,6 +82,24 @@ ParseCompilationUnitSwitch (
return true;
}
bool
ParsePrecompiledHeaderSwitch (
char switchChar2,
char* switchStart )
{
switch ( switchChar2 )
{
case 'd':
configuration.PrecompiledHeadersEnabled = false;
break;
default:
printf ( "Unknown switch -h%c\n",
switchChar2 );
return false;
}
return true;
}
bool
ParseVCProjectSwitch (
char switchChar2,
@ -214,6 +232,11 @@ ParseSwitch ( int argc, char** argv, int index )
return ParseAutomaticDependencySwitch (
switchChar2,
argv[index] );
case 'h':
return ParsePrecompiledHeaderSwitch (
switchChar2,
argv[index] );
case 'u':
return ParseCompilationUnitSwitch (
switchChar2,

View file

@ -160,6 +160,7 @@ public:
bool AutomaticDependencies;
bool CheckDependenciesForModuleOnly;
bool CompilationUnitsEnabled;
bool PrecompiledHeadersEnabled;
std::string CheckDependenciesForModuleOnlyModule;
std::string VSProjectVersion;
std::string VSConfigurationType;