From 0be0bb57b2e79209cd57b453fa349377f8d9b9ac Mon Sep 17 00:00:00 2001 From: Royce Mitchell III Date: Tue, 8 Mar 2005 17:14:07 +0000 Subject: [PATCH] detect PCH support ( not doing anything more than detection yet ) svn path=/branches/xmlbuildsystem/; revision=13878 --- reactos/tools/rbuild/backend/mingw/mingw.cpp | 23 +++++++++++++++++++ reactos/tools/rbuild/backend/mingw/mingw.h | 3 +++ .../rbuild/backend/mingw/pch_detection.h | 1 + 3 files changed, 27 insertions(+) create mode 100644 reactos/tools/rbuild/backend/mingw/pch_detection.h diff --git a/reactos/tools/rbuild/backend/mingw/mingw.cpp b/reactos/tools/rbuild/backend/mingw/mingw.cpp index 4e1a5f5d4e1..0773f0e6321 100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.cpp +++ b/reactos/tools/rbuild/backend/mingw/mingw.cpp @@ -26,6 +26,8 @@ MingwBackend::MingwBackend ( Project& project ) void MingwBackend::Process () { + DetectPCHSupport(); + CreateMakefile (); GenerateHeader (); GenerateGlobalVariables (); @@ -323,3 +325,24 @@ FixupTargetFilename ( const string& targetFilename ) { return string("$(ROS_INTERMEDIATE)") + NormalizeFilename ( targetFilename ); } + +void +MingwBackend::DetectPCHSupport() +{ + string path = "tools" SSEP "rbuild" SSEP "backend" SSEP "mingw" SSEP "pch_detection.h"; + system ( ssprintf("gcc -c %s", path.c_str()).c_str() ); + path += ".gch"; + { + FILE* f = fopen ( path.c_str(), "rb" ); + if ( f ) + { + use_pch = true; + fclose(f); + unlink ( path.c_str() ); + } + else + use_pch = false; + } + // TODO FIXME - eventually check for ROS_USE_PCH env var and + // allow that to override use_pch if true +} diff --git a/reactos/tools/rbuild/backend/mingw/mingw.h b/reactos/tools/rbuild/backend/mingw/mingw.h index 604176e0cc8..7d4c5a7d978 100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.h +++ b/reactos/tools/rbuild/backend/mingw/mingw.h @@ -32,7 +32,10 @@ private: void GenerateInitTarget () const; void GenerateXmlBuildFilesMacro() const; void CheckAutomaticDependencies (); + void DetectPCHSupport(); + FILE* fMakefile; + bool use_pch; }; std::string FixupTargetFilename ( const std::string& targetFilename ); diff --git a/reactos/tools/rbuild/backend/mingw/pch_detection.h b/reactos/tools/rbuild/backend/mingw/pch_detection.h new file mode 100644 index 00000000000..4c883e0aaa7 --- /dev/null +++ b/reactos/tools/rbuild/backend/mingw/pch_detection.h @@ -0,0 +1 @@ +// this file is intentionally left empty \ No newline at end of file