I need to add an IDL compiler to my bjam project. The invocation itself is simple; a one-liner with the IDL file as input will produce five new files, three headers and two sources. The sources are then to be used to compile a library.
For this purpose, I created a generator (after finding some examples on this mailing list):
# omniidl.jam
import generators ;
import type ;
type.register IDL : idl ;
generators.register-standard omniidl.omniidl
: IDL
: CPP(T%Caller) CPP(T%Dispatcher)
;
rule omniidl ( targets + : source : properties * : d * : e * )
{
}
actions omniidl
{
<idl invocation command> -C ./ $(>)
}
# end of omniidl.jam
The problem:
The IDL files are named as interfaces, which means they have a filename according to the pattern I*.idl. The generated files get the following patterns:
I*.h
T*Caller.cpp
T*Caller.h
T*Dispatcher.cpp
T*Dispatcher.h
That I/T prefix is giving me problems. If I try to invoke the omniidl rule above with the complete filename (IExample.idl), bjam expects the ORB to output TIExampleCaller.cpp and TIExampleDispatcher.cpp, when it actually generates TExampleCaller.cpp and TExampleDispatcher.cpp. If I try to adapt the generator to accept target names without the prefix and generate them after the fact, it complains about source files not existing.
Is there an elegant way to solve this? The best solution would be if I could remove the first letter of the target name string when I register the generator, but I have no idea how to do this.
Thank you for your time.