-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:
handler = new MingwIdlHeaderModuleHandler ( module );
break;
case TypeLib:
handler = new MingwTypeLibModuleHandler ( module );
break;
default:
throw UnknownModuleTypeException (
module.node.location,
@ -320,13 +323,17 @@ MingwModuleHandler::GetActualSourceFilename (
backend->intermediateDirectory );
return new FileLocation ( backend->intermediateDirectory, NormalizeFilename ( newname ) );
}
else //if ( module.type == IdlHeader )
else if ( module.type == IdlHeader )
{
newname = basename + ".h";
PassThruCacheDirectory ( NormalizeFilename ( newname ),
backend->intermediateDirectory );
return new FileLocation ( fileLocation->directory, filename );
}
else
{
return new FileLocation ( fileLocation->directory, filename );
}
}
else
return new FileLocation ( fileLocation->directory, filename );
@ -342,8 +349,10 @@ MingwModuleHandler::GetExtraDependencies (
string basename = GetBasename ( filename );
if ( (module.type == RpcServer) || (module.type == RpcClient) )
return GetRpcServerHeaderFilename ( basename ) + " " + GetRpcClientHeaderFilename ( basename );
else
else if ( module.type == IdlHeader )
return GetIdlHeaderFilename ( basename );
else
return "";
}
else
return "";
@ -1253,6 +1262,32 @@ MingwModuleHandler::GetIdlHeaderFilename ( string basename ) const
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
MingwModuleHandler::GenerateWidlCommandsClient (
const CompilationUnit& compilationUnit,
@ -1331,7 +1366,10 @@ MingwModuleHandler::GenerateWidlCommands (
else if ( module.type == RpcClient )
GenerateWidlCommandsClient ( compilationUnit,
widlflagsMacro );
else
else if ( module.type == TypeLib )
GenerateWidlCommandsTypeLib ( compilationUnit,
widlflagsMacro );
else // applies also for other module.types which include idl files
GenerateWidlCommandsIdlHeader ( compilationUnit,
widlflagsMacro );
}
@ -2454,6 +2492,20 @@ MingwKernelModeDLLModuleHandler::MingwKernelModeDLLModuleHandler (
{
}
MingwTypeLibModuleHandler::MingwTypeLibModuleHandler (
const Module& module_ )
: MingwModuleHandler ( module_ )
{
}
void
MingwTypeLibModuleHandler::Process ()
{
GenerateRules ();
}
void
MingwKernelModeDLLModuleHandler::AddImplicitLibraries ( Module& module )
{

View file

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

View file

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

View file

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

View file

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