detect PCH support ( not doing anything more than detection yet )
authorRoyce Mitchell III <royce3@ev1.net>
Tue, 8 Mar 2005 17:14:07 +0000 (17:14 +0000)
committerRoyce Mitchell III <royce3@ev1.net>
Tue, 8 Mar 2005 17:14:07 +0000 (17:14 +0000)
svn path=/branches/xmlbuildsystem/; revision=13878

reactos/tools/rbuild/backend/mingw/mingw.cpp
reactos/tools/rbuild/backend/mingw/mingw.h
reactos/tools/rbuild/backend/mingw/pch_detection.h [new file with mode: 0644]

index 4e1a5f5..0773f0e 100644 (file)
@@ -26,6 +26,8 @@ MingwBackend::MingwBackend ( Project& project )
 void\r
 MingwBackend::Process ()\r
 {\r
+       DetectPCHSupport();\r
+\r
        CreateMakefile ();\r
        GenerateHeader ();\r
        GenerateGlobalVariables ();\r
@@ -323,3 +325,24 @@ FixupTargetFilename ( const string& targetFilename )
 {\r
        return string("$(ROS_INTERMEDIATE)") + NormalizeFilename ( targetFilename );\r
 }\r
+\r
+void\r
+MingwBackend::DetectPCHSupport()\r
+{\r
+       string path = "tools" SSEP "rbuild" SSEP "backend" SSEP "mingw" SSEP "pch_detection.h";\r
+       system ( ssprintf("gcc -c %s", path.c_str()).c_str() );\r
+       path += ".gch";\r
+       {\r
+               FILE* f = fopen ( path.c_str(), "rb" );\r
+               if ( f )\r
+               {\r
+                       use_pch = true;\r
+                       fclose(f);\r
+                       unlink ( path.c_str() );\r
+               }\r
+               else\r
+                       use_pch = false;\r
+       }\r
+       // TODO FIXME - eventually check for ROS_USE_PCH env var and\r
+       // allow that to override use_pch if true\r
+}\r
index 604176e..7d4c5a7 100644 (file)
@@ -32,7 +32,10 @@ private:
        void GenerateInitTarget () const;\r
        void GenerateXmlBuildFilesMacro() const;\r
        void CheckAutomaticDependencies ();\r
+       void DetectPCHSupport();\r
+\r
        FILE* fMakefile;\r
+       bool use_pch;\r
 };\r
 \r
 std::string FixupTargetFilename ( const std::string& targetFilename );\r
diff --git a/reactos/tools/rbuild/backend/mingw/pch_detection.h b/reactos/tools/rbuild/backend/mingw/pch_detection.h
new file mode 100644 (file)
index 0000000..4c883e0
--- /dev/null
@@ -0,0 +1 @@
+// this file is intentionally left empty
\ No newline at end of file