* Support enabling/disabling modules depending on configuration.

* Enable halup for MP=0 configuration and halmp for MP=1 configuration.


svn path=/trunk/; revision=15801
This commit is contained in:
Casper Hornstrup 2005-06-05 11:22:16 +00:00
parent 34ef0d66de
commit 1aa91e26e5
8 changed files with 88 additions and 7 deletions

View file

@ -1,4 +1,4 @@
<module name="halmp" type="kernelmodedll"> <module if="${MP}" name="halmp" type="kernelmodedll" installbase="system32" installname="hal.dll">
<importlibrary definition="../../hal/hal.def" /> <importlibrary definition="../../hal/hal.def" />
<include base="hal_generic">../include</include> <include base="hal_generic">../include</include>
<include base="ntoskrnl">include</include> <include base="ntoskrnl">include</include>

View file

@ -1,4 +1,4 @@
<module name="halup" type="kernelmodedll" installbase="system32" installname="hal.dll"> <module ifnot="${MP}" name="halup" type="kernelmodedll" installbase="system32" installname="hal.dll">
<importlibrary definition="../../hal/hal.def" /> <importlibrary definition="../../hal/hal.def" />
<bootstrap base="reactos" nameoncd="hal.dll" /> <bootstrap base="reactos" nameoncd="hal.dll" />
<include base="hal_generic">../include</include> <include base="hal_generic">../include</include>

View file

@ -256,6 +256,8 @@ MingwBackend::ProcessModules ()
for ( i = 0; i < ProjectNode.modules.size (); i++ ) for ( i = 0; i < ProjectNode.modules.size (); i++ )
{ {
Module& module = *ProjectNode.modules[i]; Module& module = *ProjectNode.modules[i];
if ( !module.enabled )
continue;
MingwModuleHandler* h = MingwModuleHandler::InstanciateHandler ( MingwModuleHandler* h = MingwModuleHandler::InstanciateHandler (
module, module,
this ); this );
@ -547,6 +549,8 @@ MingwBackend::GetBuildToolDependencies () const
for ( size_t i = 0; i < ProjectNode.modules.size (); i++ ) for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )
{ {
Module& module = *ProjectNode.modules[i]; Module& module = *ProjectNode.modules[i];
if ( !module.enabled )
continue;
if ( module.type == BuildTool ) if ( module.type == BuildTool )
{ {
if ( dependencies.length () > 0 ) if ( dependencies.length () > 0 )
@ -845,6 +849,8 @@ MingwBackend::GetModuleInstallTargetFiles (
for ( size_t i = 0; i < ProjectNode.modules.size (); i++ ) for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )
{ {
const Module& module = *ProjectNode.modules[i]; const Module& module = *ProjectNode.modules[i];
if ( !module.enabled )
continue;
if ( module.installName.length () > 0 ) if ( module.installName.length () > 0 )
{ {
string targetFilenameNoFixup; string targetFilenameNoFixup;
@ -915,6 +921,8 @@ MingwBackend::OutputModuleInstallTargets ()
for ( size_t i = 0; i < ProjectNode.modules.size (); i++ ) for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )
{ {
const Module& module = *ProjectNode.modules[i]; const Module& module = *ProjectNode.modules[i];
if ( !module.enabled )
continue;
if ( module.installName.length () > 0 ) if ( module.installName.length () > 0 )
{ {
string sourceFilename = MingwModuleHandler::PassThruCacheDirectory ( string sourceFilename = MingwModuleHandler::PassThruCacheDirectory (
@ -1004,6 +1012,8 @@ MingwBackend::GetModuleTestTargets (
for ( size_t i = 0; i < ProjectNode.modules.size (); i++ ) for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )
{ {
const Module& module = *ProjectNode.modules[i]; const Module& module = *ProjectNode.modules[i];
if ( !module.enabled )
continue;
if ( module.type == Test ) if ( module.type == Test )
out.push_back ( module.name ); out.push_back ( module.name );
} }

View file

@ -2573,6 +2573,8 @@ MingwIsoModuleHandler::OutputBootstrapfileCopyCommands (
for ( size_t i = 0; i < module.project.modules.size (); i++ ) for ( size_t i = 0; i < module.project.modules.size (); i++ )
{ {
const Module& m = *module.project.modules[i]; const Module& m = *module.project.modules[i];
if ( !m.enabled )
continue;
if ( m.bootstrap != NULL ) if ( m.bootstrap != NULL )
{ {
string sourceFilename = PassThruCacheDirectory ( string sourceFilename = PassThruCacheDirectory (
@ -2619,6 +2621,8 @@ MingwIsoModuleHandler::GetBootstrapCdDirectories ( const string& bootcdDirectory
for ( size_t i = 0; i < module.project.modules.size (); i++ ) for ( size_t i = 0; i < module.project.modules.size (); i++ )
{ {
const Module& m = *module.project.modules[i]; const Module& m = *module.project.modules[i];
if ( !m.enabled )
continue;
if ( m.bootstrap != NULL ) if ( m.bootstrap != NULL )
{ {
string targetDirectory ( bootcdDirectory + SSEP + m.bootstrap->base ); string targetDirectory ( bootcdDirectory + SSEP + m.bootstrap->base );
@ -2664,6 +2668,8 @@ MingwIsoModuleHandler::GetBootstrapCdFiles (
for ( size_t i = 0; i < module.project.modules.size (); i++ ) for ( size_t i = 0; i < module.project.modules.size (); i++ )
{ {
const Module& m = *module.project.modules[i]; const Module& m = *module.project.modules[i];
if ( !m.enabled )
continue;
if ( m.bootstrap != NULL ) if ( m.bootstrap != NULL )
{ {
string filename = PassThruCacheDirectory ( string filename = PassThruCacheDirectory (
@ -2795,6 +2801,8 @@ MingwLiveIsoModuleHandler::OutputModuleCopyCommands ( string& livecdDirectory,
for ( size_t i = 0; i < module.project.modules.size (); i++ ) for ( size_t i = 0; i < module.project.modules.size (); i++ )
{ {
const Module& m = *module.project.modules[i]; const Module& m = *module.project.modules[i];
if ( !m.enabled )
continue;
if ( m.installName.length () > 0 ) if ( m.installName.length () > 0 )
{ {
string sourceFilename = MingwModuleHandler::PassThruCacheDirectory ( string sourceFilename = MingwModuleHandler::PassThruCacheDirectory (

View file

@ -99,6 +99,15 @@ NormalizeFilename ( const string& filename )
return FixSeparator ( relativeNormalizedPath ); return FixSeparator ( relativeNormalizedPath );
} }
bool
GetBooleanValue ( const string& value )
{
if ( value == "1" )
return true;
else
return false;
}
IfableData::~IfableData() IfableData::~IfableData()
{ {
size_t i; size_t i;
@ -153,11 +162,21 @@ Module::Module ( const Project& project,
__LINE__, __LINE__,
"Module created with non-<module> node" ); "Module created with non-<module> node" );
xmlbuildFile = Path::RelativeFromWorkingDirectory ( moduleNode.xmlFile->filename() ); xmlbuildFile = Path::RelativeFromWorkingDirectory ( moduleNode.xmlFile->filename () );
path = FixSeparator ( modulePath ); path = FixSeparator ( modulePath );
const XMLAttribute* att = moduleNode.GetAttribute ( "name", true ); enabled = true;
const XMLAttribute* att = moduleNode.GetAttribute ( "if", false );
if ( att != NULL )
enabled = GetBooleanValue ( project.ResolveProperties ( att->value ) );
att = moduleNode.GetAttribute ( "ifnot", false );
if ( att != NULL )
enabled = !GetBooleanValue ( project.ResolveProperties ( att->value ) );
att = moduleNode.GetAttribute ( "name", true );
assert(att); assert(att);
name = att->value; name = att->value;

View file

@ -85,10 +85,49 @@ Project::LookupProperty ( const string& name ) const
return NULL; return NULL;
} }
string
Project::ResolveNextProperty ( string& s ) const
{
size_t i = s.find ( "${" );
if ( i == string::npos )
i = s.find ( "$(" );
if ( i != string::npos )
{
string endCharacter;
if ( s[i + 1] == '{' )
endCharacter = "}";
else
endCharacter = ")";
size_t j = s.find ( endCharacter );
if ( j != string::npos )
{
int propertyNameLength = j - i - 2;
string propertyName = s.substr ( i + 2, propertyNameLength );
const Property* property = LookupProperty ( propertyName );
if ( property != NULL )
return s.replace ( i, propertyNameLength + 3, property->value );
}
}
return s;
}
string
Project::ResolveProperties ( const string& s ) const
{
string s2 = s;
string s3;
do
{
s3 = s2;
s2 = ResolveNextProperty ( s3 );
} while ( s2 != s3 );
return s2;
}
void void
Project::SetConfigurationOption ( char* s, Project::SetConfigurationOption ( char* s,
string name, string name,
string* alternativeName ) string* alternativeName )
{ {
const Property* property = LookupProperty ( name ); const Property* property = LookupProperty ( name );
if ( property != NULL && property->value.length () > 0 ) if ( property != NULL && property->value.length () > 0 )

View file

@ -134,7 +134,9 @@ public:
Module* LocateModule ( const std::string& name ); Module* LocateModule ( const std::string& name );
const Module* LocateModule ( const std::string& name ) const; const Module* LocateModule ( const std::string& name ) const;
std::string GetProjectFilename () const; std::string GetProjectFilename () const;
std::string ResolveProperties ( const std::string& s ) const;
private: private:
std::string ResolveNextProperty ( std::string& s ) const;
const Property* LookupProperty ( const std::string& name ) const; const Property* LookupProperty ( const std::string& name ) const;
void SetConfigurationOption ( char* s, void SetConfigurationOption ( char* s,
std::string name, std::string name,
@ -210,6 +212,7 @@ public:
std::string installName; std::string installName;
bool useWRC; bool useWRC;
bool enableWarnings; bool enableWarnings;
bool enabled;
Module ( const Project& project, Module ( const Project& project,
const XMLElement& moduleNode, const XMLElement& moduleNode,

View file

@ -107,11 +107,13 @@ Module element
There can be zero or more modules per xml build file. There can be zero or more modules per xml build file.
Syntax: Syntax:
<module name="msvcrt" type="win32dll" extension=".dll" entrypoint="_DllMain@12" baseaddress="0x70000000" mangledsymbols="true" installbase="system32" installname="msvcrt.dll" usewrc="false" warnings="true"> <module if="${MP}" ifnot="${MP}" name="msvcrt" type="win32dll" extension=".dll" entrypoint="_DllMain@12" baseaddress="0x70000000" mangledsymbols="true" installbase="system32" installname="msvcrt.dll" usewrc="false" warnings="true">
... ...
</module> </module>
Attributes: Attributes:
if - If the value is 1, then the module is enabled, otherwise it is disabled. A disabled module is not processed.
ifnot - If the value is 1, then the module is disabled, otherwise it is enabled. A disabled module is not processed.
name - Name of the module. Also the base name of the generated file if such file is generated for the particular module type. name - Name of the module. Also the base name of the generated file if such file is generated for the particular module type.
type - Type of module. See below for an explanation of module types. type - Type of module. See below for an explanation of module types.
extension - Extension of the generated file if such file is generated for the particular module type. extension - Extension of the generated file if such file is generated for the particular module type.