Boost logo

Boost-Build :

From: Alexey Pakhunov (alexeypa_at_[hidden])
Date: 2005-05-19 16:22:10


Reece Dunn wrote:

> I have had a chance to try out your idl toolset and you are right. The
> problem would be when building the proxy stub/dlldata code as these need to
> be build from a driver file.
>
> I have got the basics of a solution for generating the proxy stubs, but it

[skip]

> Maybe this will lead you in the right direction...

Nice solution. I also tried to play a bit with a custom generator. But
then I found a much nicer way:

-- Jamfile.v2 --

lib foops
:
foo.idl
:
<link>shared
<def-file>foops.def
<proxy-dll>yes # <-- build a proxy dll
;

lib foo
:
foo.cpp
foo.idl
foo.rc
:
<link>shared
<def-file>foo.def
<proxy-dll>no # <-- build a normal dll
;

----
-- msvc.jam --
generators.register-c-compiler msvc.compile.idl : IDL : TLB H C(%_i) 
C(%_p) C(%_dlldata) : <toolset>msvc <proxy-dll>yes ;
generators.register-c-compiler msvc.compile.idl : IDL : TLB H C(%_i) : 
<toolset>msvc <proxy-dll>no ;
actions compile.idl
{
$(.IDL) /nologo /robust /U$(UNDEFS) /D$(DEFINES) $(MIDLFLAGS) 
/I"$(INCLUDES)" /tlb "$(<[1]:W)" /h "$(<[2]:W)" /iid "$(<[2]:WS=)_i.c" 
/proxy "$(<[2]:WS=)_p.c" /dlldata "$(<[2]:WS=)_dlldata.c" "$(>:W)"
}
----
The trick is registering the idl generator twice: the 1st registration 
will serve building proxy dll; the 2nd - building a normal dll. In fact 
only targets lists are different. Proxy dll requires more files to be 
compiled but files are the same. Once we do it BB will do everything we 
need.
There are still some problems though:
1. MIDL is called twice since normal/proxy dlls are placed into 
different directories.
2. Proxy dll requires several defines to be defined and a few libraries 
(like rpcrt4.lib) to be linked with it. It would be nice if this was 
done automatically.
3. I need to try different options (merge proxy/stub - yes/no, etc).
Hope I will be able to present an updated version of the patch.
Best regards,
Alexey Pakhunov.
 

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk