[ros-diffs] [hpoussin] 34186: Add an option to disable precompiled headers

hpoussin at svn.reactos.org hpoussin at svn.reactos.org
Sun Jun 29 14:42:11 CEST 2008


Author: hpoussin
Date: Sun Jun 29 07:42:11 2008
New Revision: 34186

URL: http://svn.reactos.org/svn/reactos?rev=34186&view=rev
Log:
Add an option to disable precompiled headers

Modified:
    trunk/reactos/Makefile
    trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp
    trunk/reactos/tools/rbuild/configuration.cpp
    trunk/reactos/tools/rbuild/rbuild.cpp
    trunk/reactos/tools/rbuild/rbuild.h

Modified: trunk/reactos/Makefile
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/Makefile?rev=34186&r1=34185&r2=34186&view=diff
==============================================================================
--- trunk/reactos/Makefile [iso-8859-1] (original)
+++ trunk/reactos/Makefile [iso-8859-1] Sun Jun 29 07:42:11 2008
@@ -118,6 +118,7 @@
 #            -c           Clean as you go. Delete generated files as soon as they are not needed anymore.
 #            -dd          Disable automatic dependencies.
 #            -dm{module}  Check only automatic dependencies for this module.
+#            -hd          Disable precompiled headers.
 #            -mi          Let make handle creation of install directories. Rbuild will not generate the directories.
 #            -ps          Generate proxy makefiles in source tree instead of the output tree.
 #            -ud          Disable compilation units.

Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp?rev=34186&r1=34185&r2=34186&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp [iso-8859-1] Sun Jun 29 07:42:11 2008
@@ -1074,30 +1074,38 @@
 {
 	printf ( "Detecting compiler pre-compiled header support..." );
 
-	string path = "tools" + sSep + "rbuild" + sSep + "backend" + sSep + "mingw" + sSep + "pch_detection.h";
-	string cmd = ssprintf (
-		"%s -c %s 1>%s 2>%s",
-		FixSeparatorForSystemCommand(compilerCommand).c_str (),
-		path.c_str (),
-		NUL,
-		NUL );
-	system ( cmd.c_str () );
-	path += ".gch";
-
-	FILE* f = fopen ( path.c_str (), "rb" );
-	if ( f )
-	{
-		use_pch = true;
-		fclose ( f );
-		unlink ( path.c_str () );
+	if ( configuration.PrecompiledHeadersEnabled )
+	{
+		string path = "tools" + sSep + "rbuild" + sSep + "backend" + sSep + "mingw" + sSep + "pch_detection.h";
+		string cmd = ssprintf (
+			"%s -c %s 1>%s 2>%s",
+			FixSeparatorForSystemCommand(compilerCommand).c_str (),
+			path.c_str (),
+			NUL,
+			NUL );
+		system ( cmd.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;
+
+		if ( use_pch )
+			printf ( "detected\n" );
+		else
+			printf ( "not detected\n" );
 	}
 	else
+	{
 		use_pch = false;
-
-	if ( use_pch )
-		printf ( "detected\n" );
-	else
-		printf ( "not detected\n" );
+		printf ( "disabled\n" );
+	}
 }
 
 void

Modified: trunk/reactos/tools/rbuild/configuration.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/configuration.cpp?rev=34186&r1=34185&r2=34186&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/configuration.cpp [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/configuration.cpp [iso-8859-1] Sun Jun 29 07:42:11 2008
@@ -27,6 +27,7 @@
 	AutomaticDependencies = true;
 	CheckDependenciesForModuleOnly = false;
 	CompilationUnitsEnabled = true;
+	PrecompiledHeadersEnabled = true;
 	MakeHandlesInstallDirectories = false;
 	GenerateProxyMakefilesInSourceTree = false;
 	InstallFiles = false;

Modified: trunk/reactos/tools/rbuild/rbuild.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/rbuild.cpp?rev=34186&r1=34185&r2=34186&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/rbuild.cpp [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/rbuild.cpp [iso-8859-1] Sun Jun 29 07:42:11 2008
@@ -83,6 +83,24 @@
 }
 
 bool
+ParsePrecompiledHeaderSwitch (
+	char switchChar2,
+	char* switchStart )
+{
+	switch ( switchChar2 )
+	{
+		case 'd':
+			configuration.PrecompiledHeadersEnabled = false;
+			break;
+		default:
+			printf ( "Unknown switch -h%c\n",
+			         switchChar2 );
+			return false;
+	}
+	return true;
+}
+
+bool
 ParseVCProjectSwitch (
 	char switchChar2,
 	char* switchStart )
@@ -214,6 +232,11 @@
 			return ParseAutomaticDependencySwitch (
 				switchChar2,
 				argv[index] );
+		case 'h':
+			return ParsePrecompiledHeaderSwitch (
+				switchChar2,
+				argv[index] );
+
 		case 'u':
 			return ParseCompilationUnitSwitch (
 				switchChar2,

Modified: trunk/reactos/tools/rbuild/rbuild.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/rbuild.h?rev=34186&r1=34185&r2=34186&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/rbuild.h [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/rbuild.h [iso-8859-1] Sun Jun 29 07:42:11 2008
@@ -160,6 +160,7 @@
 	bool AutomaticDependencies;
 	bool CheckDependenciesForModuleOnly;
 	bool CompilationUnitsEnabled;
+	bool PrecompiledHeadersEnabled;
 	std::string CheckDependenciesForModuleOnlyModule;
 	std::string VSProjectVersion;
 	std::string VSConfigurationType;



More information about the Ros-diffs mailing list