-added support for TypeLibs

svn path=/trunk/; revision=27368
This commit is contained in:
Christoph von Wittich 2007-07-03 15:27:43 +00:00
parent 2d419df2e3
commit 42b7fb0c0e
5 changed files with 78 additions and 4 deletions

View file

@ -265,6 +265,9 @@ MingwModuleHandler::InstanciateHandler (
case IdlHeader: case IdlHeader:
handler = new MingwIdlHeaderModuleHandler ( module ); handler = new MingwIdlHeaderModuleHandler ( module );
break; break;
case TypeLib:
handler = new MingwTypeLibModuleHandler ( module );
break;
default: default:
throw UnknownModuleTypeException ( throw UnknownModuleTypeException (
module.node.location, module.node.location,
@ -320,13 +323,17 @@ MingwModuleHandler::GetActualSourceFilename (
backend->intermediateDirectory ); backend->intermediateDirectory );
return new FileLocation ( backend->intermediateDirectory, NormalizeFilename ( newname ) ); return new FileLocation ( backend->intermediateDirectory, NormalizeFilename ( newname ) );
} }
else //if ( module.type == IdlHeader ) else if ( module.type == IdlHeader )
{ {
newname = basename + ".h"; newname = basename + ".h";
PassThruCacheDirectory ( NormalizeFilename ( newname ), PassThruCacheDirectory ( NormalizeFilename ( newname ),
backend->intermediateDirectory ); backend->intermediateDirectory );
return new FileLocation ( fileLocation->directory, filename ); return new FileLocation ( fileLocation->directory, filename );
} }
else
{
return new FileLocation ( fileLocation->directory, filename );
}
} }
else else
return new FileLocation ( fileLocation->directory, filename ); return new FileLocation ( fileLocation->directory, filename );
@ -342,8 +349,10 @@ MingwModuleHandler::GetExtraDependencies (
string basename = GetBasename ( filename ); string basename = GetBasename ( filename );
if ( (module.type == RpcServer) || (module.type == RpcClient) ) if ( (module.type == RpcServer) || (module.type == RpcClient) )
return GetRpcServerHeaderFilename ( basename ) + " " + GetRpcClientHeaderFilename ( basename ); return GetRpcServerHeaderFilename ( basename ) + " " + GetRpcClientHeaderFilename ( basename );
else else if ( module.type == IdlHeader )
return GetIdlHeaderFilename ( basename ); return GetIdlHeaderFilename ( basename );
else
return "";
} }
else else
return ""; return "";
@ -1253,6 +1262,32 @@ MingwModuleHandler::GetIdlHeaderFilename ( string basename ) const
backend->intermediateDirectory ); backend->intermediateDirectory );
} }
void
MingwModuleHandler::GenerateWidlCommandsTypeLib (
const CompilationUnit& compilationUnit,
const string& widlflagsMacro )
{
FileLocation* sourceFileLocation = compilationUnit.GetFilename ( backend->intermediateDirectory );
string filename = sourceFileLocation->filename;
string dependencies = filename;
dependencies += " " + NormalizeFilename ( module.xmlbuildFile );
string TypeLibFilename = module.GetTargetName ();
fprintf ( fMakefile,
"%s: %s $(WIDL_TARGET) | %s\n",
GetTargetMacro ( module ).c_str (),
dependencies.c_str (),
GetDirectory ( TypeLibFilename ).c_str () );
fprintf ( fMakefile, "\t$(ECHO_WIDL)\n" );
fprintf ( fMakefile,
"\t%s %s %s -t -T $@ %s\n",
"$(Q)$(WIDL_TARGET)",
GetWidlFlags ( compilationUnit ).c_str (),
widlflagsMacro.c_str (),
filename.c_str () );
}
void void
MingwModuleHandler::GenerateWidlCommandsClient ( MingwModuleHandler::GenerateWidlCommandsClient (
const CompilationUnit& compilationUnit, const CompilationUnit& compilationUnit,
@ -1331,7 +1366,10 @@ MingwModuleHandler::GenerateWidlCommands (
else if ( module.type == RpcClient ) else if ( module.type == RpcClient )
GenerateWidlCommandsClient ( compilationUnit, GenerateWidlCommandsClient ( compilationUnit,
widlflagsMacro ); widlflagsMacro );
else else if ( module.type == TypeLib )
GenerateWidlCommandsTypeLib ( compilationUnit,
widlflagsMacro );
else // applies also for other module.types which include idl files
GenerateWidlCommandsIdlHeader ( compilationUnit, GenerateWidlCommandsIdlHeader ( compilationUnit,
widlflagsMacro ); widlflagsMacro );
} }
@ -2454,6 +2492,20 @@ MingwKernelModeDLLModuleHandler::MingwKernelModeDLLModuleHandler (
{ {
} }
MingwTypeLibModuleHandler::MingwTypeLibModuleHandler (
const Module& module_ )
: MingwModuleHandler ( module_ )
{
}
void
MingwTypeLibModuleHandler::Process ()
{
GenerateRules ();
}
void void
MingwKernelModeDLLModuleHandler::AddImplicitLibraries ( Module& module ) MingwKernelModeDLLModuleHandler::AddImplicitLibraries ( Module& module )
{ {

View file

@ -172,6 +172,9 @@ private:
void GenerateWidlCommandsIdlHeader ( void GenerateWidlCommandsIdlHeader (
const CompilationUnit& compilationUnit, const CompilationUnit& compilationUnit,
const std::string& widlflagsMacro ); const std::string& widlflagsMacro );
void GenerateWidlCommandsTypeLib (
const CompilationUnit& compilationUnit,
const std::string& widlflagsMacro );
void GenerateWidlCommands ( const CompilationUnit& compilationUnit, void GenerateWidlCommands ( const CompilationUnit& compilationUnit,
const std::string& widlflagsMacro ); const std::string& widlflagsMacro );
void GenerateCommands ( const CompilationUnit& compilationUnit, void GenerateCommands ( const CompilationUnit& compilationUnit,
@ -502,4 +505,12 @@ public:
virtual void Process (); virtual void Process ();
}; };
class MingwTypeLibModuleHandler : public MingwModuleHandler
{
public:
MingwTypeLibModuleHandler ( const Module& module );
virtual HostType DefaultHost() { return HostFalse; }
virtual void Process ();
};
#endif /* MINGW_MODULEHANDLER_H */ #endif /* MINGW_MODULEHANDLER_H */

View file

@ -68,6 +68,7 @@ Bootstrap::IsSupportedModuleType ( ModuleType type )
case RpcClient: case RpcClient:
case Alias: case Alias:
case IdlHeader: case IdlHeader:
case TypeLib:
return false; return false;
} }
throw InvalidOperationException ( __FILE__, throw InvalidOperationException ( __FILE__,

View file

@ -839,6 +839,8 @@ Module::GetModuleType ( const string& location, const XMLAttribute& attribute )
return Alias; return Alias;
if ( attribute.value == "idlheader" ) if ( attribute.value == "idlheader" )
return IdlHeader; return IdlHeader;
if ( attribute.value == "typelib" )
return TypeLib;
throw InvalidAttributeValueException ( location, throw InvalidAttributeValueException ( location,
attribute.name, attribute.name,
attribute.value ); attribute.value );
@ -890,6 +892,8 @@ Module::GetDefaultModuleExtension () const
case BootProgram: case BootProgram:
case IdlHeader: case IdlHeader:
return ""; return "";
case TypeLib:
return ".tlb";
} }
throw InvalidOperationException ( __FILE__, throw InvalidOperationException ( __FILE__,
__LINE__ ); __LINE__ );
@ -939,6 +943,7 @@ Module::GetDefaultModuleEntrypoint () const
case Alias: case Alias:
case BootProgram: case BootProgram:
case IdlHeader: case IdlHeader:
case TypeLib:
return ""; return "";
} }
throw InvalidOperationException ( __FILE__, throw InvalidOperationException ( __FILE__,
@ -981,6 +986,7 @@ Module::GetDefaultModuleBaseaddress () const
case Alias: case Alias:
case BootProgram: case BootProgram:
case IdlHeader: case IdlHeader:
case TypeLib:
return ""; return "";
} }
throw InvalidOperationException ( __FILE__, throw InvalidOperationException ( __FILE__,
@ -1025,6 +1031,7 @@ Module::IsDLL () const
case RpcClient: case RpcClient:
case Alias: case Alias:
case IdlHeader: case IdlHeader:
case TypeLib:
return false; return false;
} }
throw InvalidOperationException ( __FILE__, throw InvalidOperationException ( __FILE__,
@ -1056,6 +1063,7 @@ Module::GenerateInOutputTree () const
case LiveIso: case LiveIso:
case IsoRegTest: case IsoRegTest:
case LiveIsoRegTest: case LiveIsoRegTest:
case TypeLib:
return true; return true;
case StaticLibrary: case StaticLibrary:
case ObjectLibrary: case ObjectLibrary:
@ -1557,6 +1565,7 @@ AutoRegister::IsSupportedModuleType ( ModuleType type )
case RpcClient: case RpcClient:
case Alias: case Alias:
case IdlHeader: case IdlHeader:
case TypeLib:
return false; return false;
} }
throw InvalidOperationException ( __FILE__, throw InvalidOperationException ( __FILE__,

View file

@ -273,7 +273,8 @@ enum ModuleType
ExportDriver = 22, ExportDriver = 22,
IdlHeader = 23, IdlHeader = 23,
IsoRegTest = 24, IsoRegTest = 24,
LiveIsoRegTest = 25 LiveIsoRegTest = 25,
TypeLib = 26
}; };
enum HostType enum HostType