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