mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 14:37:45 +00:00
Option to disable compilation units
svn path=/trunk/; revision=19477
This commit is contained in:
parent
a0b7f5c0aa
commit
4758974147
|
@ -527,10 +527,13 @@ MingwBackend::GenerateTestSupportCode ()
|
|||
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
|
||||
|
|
|
@ -83,12 +83,12 @@ CompilationUnitSupportCode::WriteCompilationUnitFile ( Module& module,
|
|||
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" );
|
||||
|
|
|
@ -26,6 +26,7 @@ Configuration::Configuration ()
|
|||
CleanAsYouGo = false;
|
||||
AutomaticDependencies = true;
|
||||
CheckDependenciesForModuleOnly = false;
|
||||
CompilationUnitsEnabled = true;
|
||||
MakeHandlesInstallDirectories = false;
|
||||
GenerateProxyMakefilesInSourceTree = false;
|
||||
}
|
||||
|
|
|
@ -52,18 +52,26 @@ Replace ( const string& s, const string& find, const string& with )
|
|||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
|
@ -627,12 +635,15 @@ Module::ProcessXMLSubElement ( const XMLElement& e,
|
|||
}
|
||||
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 )
|
||||
|
|
|
@ -81,11 +81,13 @@ FileLocation::FileLocation ( Directory* directory,
|
|||
}
|
||||
|
||||
|
||||
Project::Project ( const string& filename )
|
||||
Project::Project ( const Configuration& configuration,
|
||||
const string& filename )
|
||||
: xmlfile (filename),
|
||||
node (NULL),
|
||||
head (NULL)
|
||||
{
|
||||
head (NULL),
|
||||
configuration (configuration)
|
||||
{
|
||||
ReadXml();
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,22 @@ ParseAutomaticDependencySwitch ( char switchChar2,
|
|||
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 @@ ParseSwitch ( int argc, char** argv, int index )
|
|||
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 @@ main ( int argc, char** argv )
|
|||
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 @@ main ( int argc, char** argv )
|
|||
{
|
||||
string projectFilename ( RootXmlFile );
|
||||
printf ( "Reading build files..." );
|
||||
Project project ( projectFilename );
|
||||
Project project ( configuration, projectFilename );
|
||||
printf ( "done\n" );
|
||||
project.WriteConfigurationFile ();
|
||||
project.ExecuteInvocations ();
|
||||
|
|
|
@ -133,6 +133,7 @@ public:
|
|||
bool CleanAsYouGo;
|
||||
bool AutomaticDependencies;
|
||||
bool CheckDependenciesForModuleOnly;
|
||||
bool CompilationUnitsEnabled;
|
||||
std::string CheckDependenciesForModuleOnlyModule;
|
||||
std::string VSProjectVersion;
|
||||
bool MakeHandlesInstallDirectories;
|
||||
|
@ -189,6 +190,7 @@ class Project
|
|||
std::string xmlfile;
|
||||
XMLElement *node, *head;
|
||||
public:
|
||||
const Configuration& configuration;
|
||||
std::string name;
|
||||
std::string makefile;
|
||||
XMLIncludes xmlbuildfiles;
|
||||
|
@ -198,7 +200,8 @@ public:
|
|||
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 ();
|
||||
|
@ -872,6 +875,11 @@ Right ( const std::string& s, size_t n );
|
|||
extern std::string
|
||||
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 );
|
||||
|
||||
|
|
Loading…
Reference in a new issue