mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 19:26:32 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -152,6 +152,7 @@ public:
|
||||
std::vector<CompilerFlag*> compilerFlags;
|
||||
std::vector<LinkerFlag*> linkerFlags;
|
||||
PchFile* pch;
|
||||
bool cplusplus;
|
||||
|
||||
Module ( const Project& project,
|
||||
const XMLElement& moduleNode,
|
||||
|
||||
Reference in New Issue
Block a user