Option to disable compilation units
Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp
Modified: trunk/reactos/tools/rbuild/compilationunitsupportcode.cpp
Modified: trunk/reactos/tools/rbuild/configuration.cpp
Modified: trunk/reactos/tools/rbuild/module.cpp
Modified: trunk/reactos/tools/rbuild/project.cpp
Modified: trunk/reactos/tools/rbuild/rbuild.cpp
Modified: trunk/reactos/tools/rbuild/rbuild.h
_____
Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp
--- trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-11-23
01:40:19 UTC (rev 19476)
+++ trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-11-23
03:12:52 UTC (rev 19477)
@@ -527,10 +527,13 @@
void
MingwBackend::GenerateCompilationUnitSupportCode ()
{
- printf ( "Generating compilation unit support code..." );
- CompilationUnitSupportCode compilationUnitSupportCode (
ProjectNode );
- compilationUnitSupportCode.Generate ( configuration.Verbose );
- printf ( "done\n" );
+ if ( configuration.CompilationUnitsEnabled )
+ {
+ printf ( "Generating compilation unit support code..."
);
+ CompilationUnitSupportCode compilationUnitSupportCode (
ProjectNode );
+ compilationUnitSupportCode.Generate (
configuration.Verbose );
+ printf ( "done\n" );
+ }
}
string
_____
Modified: trunk/reactos/tools/rbuild/compilationunitsupportcode.cpp
--- trunk/reactos/tools/rbuild/compilationunitsupportcode.cpp
2005-11-23 01:40:19 UTC (rev 19476)
+++ trunk/reactos/tools/rbuild/compilationunitsupportcode.cpp
2005-11-23 03:12:52 UTC (rev 19477)
@@ -83,12 +83,12 @@
s = s + sprintf ( s, "/* This file is automatically generated.
*/\n" );
s = s + sprintf ( s, "#define ONE_COMPILATION_UNIT\n" );
if ( module.pch )
- s = s + sprintf ( s, "#include <%s>\n",
NormalizeFilename ( module.pch->file.name ).c_str () );
+ s = s + sprintf ( s, "#include <%s>\n", ChangeSeparator
( module.pch->file.name, '\\', '/' ).c_str () );
for ( size_t i = 0; i < compilationUnit.files.size () ; i++ )
{
File& file = *compilationUnit.files[i];
- s = s + sprintf ( s, "#include \"%s\"\n",
file.name.c_str () );
+ s = s + sprintf ( s, "#include <%s>\n", ChangeSeparator
( file.name, '\\', '/' ).c_str () );
}
s = s + sprintf ( s, "\n" );
_____
Modified: trunk/reactos/tools/rbuild/configuration.cpp
--- trunk/reactos/tools/rbuild/configuration.cpp 2005-11-23
01:40:19 UTC (rev 19476)
+++ trunk/reactos/tools/rbuild/configuration.cpp 2005-11-23
03:12:52 UTC (rev 19477)
@@ -26,6 +26,7 @@
CleanAsYouGo = false;
AutomaticDependencies = true;
CheckDependenciesForModuleOnly = false;
+ CompilationUnitsEnabled = true;
MakeHandlesInstallDirectories = false;
GenerateProxyMakefilesInSourceTree = false;
}
_____
Modified: trunk/reactos/tools/rbuild/module.cpp
--- trunk/reactos/tools/rbuild/module.cpp 2005-11-23 01:40:19 UTC
(rev 19476)
+++ trunk/reactos/tools/rbuild/module.cpp 2005-11-23 03:12:52 UTC
(rev 19477)
@@ -52,19 +52,27 @@
}
string
-FixSeparator ( const string& s )
+ChangeSeparator ( const string& s,
+ const char fromSeparator,
+ const char toSeparator )
{
string s2(s);
- char* p = strchr ( &s2[0], cBadSep );
+ char* p = strchr ( &s2[0], fromSeparator );
while ( p )
{
- *p++ = cSep;
- p = strchr ( p, cBadSep );
+ *p++ = toSeparator;
+ p = strchr ( p, fromSeparator );
}
return s2;
}
string
+FixSeparator ( const string& s )
+{
+ return ChangeSeparator ( s, cBadSep, cSep );
+}
+
+string
FixSeparatorForSystemCommand ( const string& s )
{
string s2(s);
@@ -627,12 +635,15 @@
}
else if ( e.name == "compilationunit" )
{
- CompilationUnit* pCompilationUnit = new CompilationUnit
( &project, this, &e );
- if ( parseContext.ifData )
-
parseContext.ifData->data.compilationUnits.push_back ( pCompilationUnit
);
- else
- non_if_data.compilationUnits.push_back (
pCompilationUnit );
- parseContext.compilationUnit = pCompilationUnit;
+ if ( project.configuration.CompilationUnitsEnabled )
+ {
+ CompilationUnit* pCompilationUnit = new
CompilationUnit ( &project, this, &e );
+ if ( parseContext.ifData )
+
parseContext.ifData->data.compilationUnits.push_back ( pCompilationUnit
);
+ else
+ non_if_data.compilationUnits.push_back (
pCompilationUnit );
+ parseContext.compilationUnit = pCompilationUnit;
+ }
subs_invalid = false;
}
if ( subs_invalid && e.subElements.size() > 0 )
_____
Modified: trunk/reactos/tools/rbuild/project.cpp
--- trunk/reactos/tools/rbuild/project.cpp 2005-11-23 01:40:19 UTC
(rev 19476)
+++ trunk/reactos/tools/rbuild/project.cpp 2005-11-23 03:12:52 UTC
(rev 19477)
@@ -81,11 +81,13 @@
}
-Project::Project ( const string& filename )
+Project::Project ( const Configuration& configuration,
+ const string& filename )
: xmlfile (filename),
node (NULL),
- head (NULL)
-{
+ head (NULL),
+ configuration (configuration)
+{
ReadXml();
}
_____
Modified: trunk/reactos/tools/rbuild/rbuild.cpp
--- trunk/reactos/tools/rbuild/rbuild.cpp 2005-11-23 01:40:19 UTC
(rev 19476)
+++ trunk/reactos/tools/rbuild/rbuild.cpp 2005-11-23 03:12:52 UTC
(rev 19477)
@@ -61,6 +61,22 @@
return true;
}
+bool
+ParseCompilationUnitSwitch ( char switchChar2,
+ char* switchStart )
+{
+ switch ( switchChar2 )
+ {
+ case 'd':
+ configuration.CompilationUnitsEnabled = false;
+ break;
+ default:
+ printf ( "Unknown switch -u%c\n",
+ switchChar2 );
+ return false;
+ }
+ return true;
+}
bool
ParseVCProjectSwitch ( char switchChar2,
@@ -148,6 +164,9 @@
case 'd':
return ParseAutomaticDependencySwitch (
switchChar2,
argv[index] );
+ case 'u':
+ return ParseCompilationUnitSwitch ( switchChar2,
+ argv[index]
);
case 'r':
RootXmlFile = string(&argv[index][2]);
break;
@@ -196,9 +215,10 @@
printf ( " -v Be verbose.\n" );
printf ( " -c Clean as you go. Delete
generated files as soon as they are not\n" );
printf ( " needed anymore.\n" );
+ printf ( " -r{file.xml} Name of the root xml file.
Default is ReactOS.xml.\n" );
printf ( " -dd Disable automatic
dependencies.\n" );
printf ( " -dm{module} Check only automatic
dependencies for this module.\n" );
- printf ( " -r{file.xml} Name of the root xml file.
Default is ReactOS.xml.\n" );
+ printf ( " -ud Disable multiple source files
per compilation unit.\n" );
printf ( " -mi Let make handle creation of
install directories. Rbuild will\n" );
printf ( " not generate the
directories.\n" );
printf ( " -ps Generate proxy makefiles in
source tree instead of the output.\n" );
@@ -215,7 +235,7 @@
{
string projectFilename ( RootXmlFile );
printf ( "Reading build files..." );
- Project project ( projectFilename );
+ Project project ( configuration, projectFilename );
printf ( "done\n" );
project.WriteConfigurationFile ();
project.ExecuteInvocations ();
_____
Modified: trunk/reactos/tools/rbuild/rbuild.h
--- trunk/reactos/tools/rbuild/rbuild.h 2005-11-23 01:40:19 UTC (rev
19476)
+++ trunk/reactos/tools/rbuild/rbuild.h 2005-11-23 03:12:52 UTC (rev
19477)
@@ -133,6 +133,7 @@
bool CleanAsYouGo;
bool AutomaticDependencies;
bool CheckDependenciesForModuleOnly;
+ bool CompilationUnitsEnabled;
std::string CheckDependenciesForModuleOnlyModule;
std::string VSProjectVersion;
bool MakeHandlesInstallDirectories;
@@ -189,6 +190,7 @@
std::string xmlfile;
XMLElement *node, *head;
public:
+ const Configuration& configuration;
std::string name;
std::string makefile;
XMLIncludes xmlbuildfiles;
@@ -198,7 +200,8 @@
std::vector<InstallFile*> installfiles;
IfableData non_if_data;
- Project ( const std::string& filename );
+ Project ( const Configuration& configuration,
+ const std::string& filename );
~Project ();
void WriteConfigurationFile ();
void ExecuteInvocations ();
@@ -873,6 +876,11 @@
Replace ( const std::string& s, const std::string& find, const
std::string& with );
extern std::string
+ChangeSeparator ( const std::string& s,
+ const char fromSeparator,
+ const char toSeparator );
+
+extern std::string
FixSeparator ( const std::string& s );
extern std::string