more efficient detection of C++ modules, fixed bug in C++ pch support, always clean pch files, even if pch not being used

svn path=/branches/xmlbuildsystem/; revision=13917
This commit is contained in:
Royce Mitchell III
2005-03-10 20:34:08 +00:00
parent af9bc63975
commit 107eec449d
3 changed files with 32 additions and 24 deletions
@@ -1056,24 +1056,27 @@ MingwModuleHandler::GenerateObjectFileTargets (
const string& windresflagsMacro,
string_list& clean_files ) const
{
if ( module.pch && use_pch )
if ( module.pch )
{
const string& pch_file = module.pch->header;
string gch_file = pch_file + ".gch";
CLEAN_FILE(gch_file);
fprintf (
fMakefile,
"%s: %s\n",
gch_file.c_str(),
pch_file.c_str() );
fprintf ( fMakefile, "\t$(ECHO_PCH)\n" );
fprintf (
fMakefile,
"\t%s -c %s -o %s %s\n\n",
cc.c_str(),
pch_file.c_str(),
gch_file.c_str(),
cflagsMacro.c_str() );
if ( use_pch )
{
fprintf (
fMakefile,
"%s: %s\n",
gch_file.c_str(),
pch_file.c_str() );
fprintf ( fMakefile, "\t$(ECHO_PCH)\n" );
fprintf (
fMakefile,
"\t%s -o %s %s -g %s\n\n",
( module.cplusplus ? cppc.c_str() : cc.c_str() ),
gch_file.c_str(),
cflagsMacro.c_str(),
pch_file.c_str() );
}
}
GenerateObjectFileTargets ( module,
@@ -1456,18 +1459,10 @@ MingwModuleHandler::GetDefinitionDependencies ( const Module& module ) const
return dependencies;
}
// TODO FIXME - check for C++ extensions when parsing XML, and set a
// bool in the Module class
bool
MingwModuleHandler::IsCPlusPlusModule ( const Module& module ) const
{
if ( module.HasFileWithExtension ( module.non_if_data, ".cc" ) )
return true;
if ( module.HasFileWithExtension ( module.non_if_data, ".cxx" ) )
return true;
if ( module.HasFileWithExtension ( module.non_if_data, ".cpp" ) )
return true;
return false;
return module.cplusplus;
}
+13 -1
View File
@@ -91,7 +91,8 @@ Module::Module ( const Project& project,
node (moduleNode),
importLibrary (NULL),
bootstrap (NULL),
pch (NULL)
pch (NULL),
cplusplus (false)
{
if ( node.name != "module" )
throw Exception ( "internal tool error: Module created with non-<module> node" );
@@ -185,6 +186,17 @@ Module::ProcessXMLSubElement ( const XMLElement& e,
e.location,
"attribute 'first' of <file> element can only be 'true' or 'false'" );
}
if ( !cplusplus )
{
// check for c++ file
string ext = GetExtension ( e.value );
if ( !stricmp ( ext.c_str(), ".cpp" ) )
cplusplus = true;
else if ( !stricmp ( ext.c_str(), ".cc" ) )
cplusplus = true;
else if ( !stricmp ( ext.c_str(), ".cxx" ) )
cplusplus = true;
}
File* pFile = new File ( FixSeparator ( path + CSEP + e.value ), first );
if ( pIf )
pIf->data.files.push_back ( pFile );
+1
View File
@@ -152,6 +152,7 @@ public:
std::vector<CompilerFlag*> compilerFlags;
std::vector<LinkerFlag*> linkerFlags;
PchFile* pch;
bool cplusplus;
Module ( const Project& project,
const XMLElement& moduleNode,