Do automatic dependency checking for pre-compiled header files

svn path=/branches/xmlbuildsystem/; revision=15337
This commit is contained in:
Casper Hornstrup 2005-05-16 11:41:54 +00:00
parent 42715b124a
commit 0a8ee28a63
4 changed files with 39 additions and 17 deletions

View file

@ -274,17 +274,31 @@ AutomaticDependency::Process ()
ProcessModule ( *project.modules[i] );
}
void
AutomaticDependency::GetModuleFiles ( Module& module,
vector<File*>& files ) const
{
for ( size_t i = 0; i < module.non_if_data.files.size (); i++ )
files.push_back ( module.non_if_data.files[i] );
/* FIXME: Collect files in IFs here */
if ( module.pch != NULL )
files.push_back ( &module.pch->file );
}
void
AutomaticDependency::ProcessModule ( Module& module )
{
const vector<File*>& files = module.non_if_data.files;
vector<File*> files;
GetModuleFiles ( module, files );
for ( size_t i = 0; i < files.size (); i++ )
ProcessFile ( module, *files[i] );
}
void
AutomaticDependency::ProcessFile ( Module& module,
const File& file )
const File& file )
{
string normalizedFilename = NormalizeFilename ( file.name );
RetrieveFromCacheOrParse ( module,
@ -388,7 +402,8 @@ AutomaticDependency::CheckAutomaticDependencies ( bool verbose )
struct utimbuf timebuf;
for ( size_t mi = 0; mi < project.modules.size (); mi++ )
{
const vector<File*>& files = project.modules[mi]->non_if_data.files;
vector<File*> files;
GetModuleFiles ( *project.modules[mi], files );
for ( size_t fi = 0; fi < files.size (); fi++ )
{
File& file = *files[fi];

View file

@ -840,7 +840,7 @@ MingwModuleHandler::GenerateGccCommand (
{
string dependencies = sourceFilename;
if ( module.pch && use_pch )
dependencies += " " + module.pch->header + ".gch";
dependencies += " " + module.pch->file.name + ".gch";
/* WIDL generated headers may be used */
dependencies += " " + GetLinkingDependenciesMacro ();
@ -1471,7 +1471,7 @@ MingwModuleHandler::GenerateObjectFileTargets (
{
if ( module.pch )
{
const string& pch_file = module.pch->header;
const string& pch_file = module.pch->file.name;
string gch_file = pch_file + ".gch";
CLEAN_FILE(gch_file);
if ( use_pch )
@ -2920,9 +2920,9 @@ void
MingwTestModuleHandler::GetModuleSpecificSourceFiles ( vector<File*>& sourceFiles )
{
string basePath = "$(INTERMEDIATE)" SSEP + module.GetBasePath ();
sourceFiles.push_back ( new File ( basePath + SSEP "_hooks.c", false, "" ) );
sourceFiles.push_back ( new File ( basePath + SSEP "_stubs.S", false, "" ) );
sourceFiles.push_back ( new File ( basePath + SSEP "_startup.c", false, "" ) );
sourceFiles.push_back ( new File ( basePath + SSEP "_hooks.c", false, "", false ) );
sourceFiles.push_back ( new File ( basePath + SSEP "_stubs.S", false, "", false ) );
sourceFiles.push_back ( new File ( basePath + SSEP "_startup.c", false, "", false ) );
}
void

View file

@ -323,7 +323,8 @@ Module::ProcessXMLSubElement ( const XMLElement& e,
}
File* pFile = new File ( FixSeparator ( path + CSEP + e.value ),
first,
switches );
switches,
false );
if ( pIf )
pIf->data.files.push_back ( pFile );
else
@ -445,7 +446,7 @@ Module::ProcessXMLSubElement ( const XMLElement& e,
e.location,
"Only one <pch> is valid per module" );
pch = new PchFile (
e, *this, FixSeparator ( path + CSEP + e.value ) );
e, *this, File ( FixSeparator ( path + CSEP + e.value ), false, "", true ) );
subs_invalid = true;
}
if ( subs_invalid && e.subElements.size() > 0 )
@ -729,10 +730,12 @@ Module::InvokeModule () const
File::File ( const string& _name, bool _first,
std::string _switches )
std::string _switches,
bool _isPreCompiledHeader )
: name(_name),
first(_first),
switches(_switches)
switches(_switches),
isPreCompiledHeader(_isPreCompiledHeader)
{
}
@ -1011,8 +1014,8 @@ Property::ProcessXML()
PchFile::PchFile (
const XMLElement& node_,
const Module& module_,
const string& header_ )
: node(node_), module(module_), header(header_)
const File file_ )
: node(node_), module(module_), file(file_)
{
}

View file

@ -278,10 +278,12 @@ public:
std::string name;
bool first;
std::string switches;
bool isPreCompiledHeader;
File ( const std::string& _name,
bool _first,
std::string _switches );
std::string _switches,
bool _isPreCompiledHeader );
void ProcessXML();
bool IsGeneratedFile () const;
@ -570,6 +572,8 @@ public:
void CheckAutomaticDependencies ( bool verbose );
void CheckAutomaticDependenciesForFile ( SourceFile* sourceFile );
private:
void GetModuleFiles ( Module& module,
std::vector<File*>& files ) const;
void ProcessModule ( Module& module );
void ProcessFile ( Module& module,
const File& file );
@ -640,12 +644,12 @@ class PchFile
public:
const XMLElement& node;
const Module& module;
std::string header;
File file;
PchFile (
const XMLElement& node,
const Module& module,
const std::string& header );
const File file );
void ProcessXML();
};