more efficient detection of C++ modules, fixed bug in C++ pch support, always clean...
authorRoyce Mitchell III <royce3@ev1.net>
Thu, 10 Mar 2005 20:34:08 +0000 (20:34 +0000)
committerRoyce Mitchell III <royce3@ev1.net>
Thu, 10 Mar 2005 20:34:08 +0000 (20:34 +0000)
svn path=/branches/xmlbuildsystem/; revision=13917

reactos/tools/rbuild/backend/mingw/modulehandler.cpp
reactos/tools/rbuild/module.cpp
reactos/tools/rbuild/rbuild.h

index 7656034..90bd48e 100644 (file)
@@ -1056,24 +1056,27 @@ MingwModuleHandler::GenerateObjectFileTargets (
        const string& windresflagsMacro,\r
        string_list& clean_files ) const\r
 {\r
-       if ( module.pch && use_pch )\r
+       if ( module.pch )\r
        {\r
                const string& pch_file = module.pch->header;\r
                string gch_file = pch_file + ".gch";\r
                CLEAN_FILE(gch_file);\r
-               fprintf (\r
-                       fMakefile,\r
-                       "%s: %s\n",\r
-                       gch_file.c_str(),\r
-                       pch_file.c_str() );\r
-               fprintf ( fMakefile, "\t$(ECHO_PCH)\n" );\r
-               fprintf (\r
-                       fMakefile,\r
-                       "\t%s -c %s -o %s %s\n\n",\r
-                       cc.c_str(),\r
-                       pch_file.c_str(),\r
-                       gch_file.c_str(),\r
-                       cflagsMacro.c_str() );\r
+               if ( use_pch )\r
+               {\r
+                       fprintf (\r
+                               fMakefile,\r
+                               "%s: %s\n",\r
+                               gch_file.c_str(),\r
+                               pch_file.c_str() );\r
+                       fprintf ( fMakefile, "\t$(ECHO_PCH)\n" );\r
+                       fprintf (\r
+                               fMakefile,\r
+                               "\t%s -o %s %s -g %s\n\n",\r
+                               ( module.cplusplus ? cppc.c_str() : cc.c_str() ),\r
+                               gch_file.c_str(),\r
+                               cflagsMacro.c_str(),\r
+                               pch_file.c_str() );\r
+               }\r
        }\r
 \r
        GenerateObjectFileTargets ( module,\r
@@ -1456,18 +1459,10 @@ MingwModuleHandler::GetDefinitionDependencies ( const Module& module ) const
        return dependencies;\r
 }\r
 \r
-// TODO FIXME - check for C++ extensions when parsing XML, and set a\r
-// bool in the Module class\r
 bool\r
 MingwModuleHandler::IsCPlusPlusModule ( const Module& module ) const\r
 {\r
-       if ( module.HasFileWithExtension ( module.non_if_data, ".cc" ) )\r
-               return true;\r
-       if ( module.HasFileWithExtension ( module.non_if_data, ".cxx" ) )\r
-               return true;\r
-       if ( module.HasFileWithExtension ( module.non_if_data, ".cpp" ) )\r
-               return true;\r
-       return false;\r
+       return module.cplusplus;\r
 }\r
 \r
 \r
index 2425f1d..0ffae73 100644 (file)
@@ -91,7 +91,8 @@ Module::Module ( const Project& project,
          node (moduleNode),\r
          importLibrary (NULL),\r
          bootstrap (NULL),\r
-         pch (NULL)\r
+         pch (NULL),\r
+         cplusplus (false)\r
 {\r
        if ( node.name != "module" )\r
                throw Exception ( "internal tool error: Module created with non-<module> node" );\r
@@ -185,6 +186,17 @@ Module::ProcessXMLSubElement ( const XMLElement& e,
                                        e.location,\r
                                        "attribute 'first' of <file> element can only be 'true' or 'false'" );\r
                }\r
+               if ( !cplusplus )\r
+               {\r
+                       // check for c++ file\r
+                       string ext = GetExtension ( e.value );\r
+                       if ( !stricmp ( ext.c_str(), ".cpp" ) )\r
+                               cplusplus = true;\r
+                       else if ( !stricmp ( ext.c_str(), ".cc" ) )\r
+                               cplusplus = true;\r
+                       else if ( !stricmp ( ext.c_str(), ".cxx" ) )\r
+                               cplusplus = true;\r
+               }\r
                File* pFile = new File ( FixSeparator ( path + CSEP + e.value ), first );\r
                if ( pIf )\r
                        pIf->data.files.push_back ( pFile );\r
index 08112e8..b541363 100644 (file)
@@ -152,6 +152,7 @@ public:
        std::vector<CompilerFlag*> compilerFlags;\r
        std::vector<LinkerFlag*> linkerFlags;\r
        PchFile* pch;\r
+       bool cplusplus;\r
 \r
        Module ( const Project& project,\r
                 const XMLElement& moduleNode,\r