[Kde-java] Re: GCJ (Re: Build system for KDE4)

Richard Dale Richard_Dale at tipitina.demon.co.uk
Thu Jun 16 10:04:11 CEST 2005


On Thursday 16 June 2005 10:18, Martijn Klingens wrote:
> Richard Dale said:
> > The java bindings are autogenerated - the kalyptus tool is driven by a
> > list of
> > headers in kdebindings/smoke/qt/header_list. It should be a matter of
> > adding
> > your library headers to that list, then editing the 'generate.pl' script
> > in
> > smoke/qt changing the kalyptus option '-fsmoke' to '-fjni', then type
> > 'perl
> > generate.pl'. It will generate .java and .cpp sources. You then use javah
> > to
> > generate the .h files from the compiled java classes.
>
> Hmm, with some small changes it can indeed be made generic enough to
> support libs other than qt and kdelibs too. In theory it can even become
> part of the build system to auto-import a C++ lib into Java code and do
> all the binding generation and linking automagically.
Yes, the sources for the Smoke library are generated when you type make in 
smoke/qt or smoke/kde directories, and they don't need to be checked into the 
svn. I've been meaning to do that for java for ages, but haven't got round to 
it. It would certainly be nice for the next version of the bindings.

> > But the package names are hard coded - any classes beginning with 'Q' go
> > into
> > org.kde.qt and all others go into org.kde.koala. So maybe when we decide
> > on a
> > better package naming scheme, the bindings generator ought to allow any
> > Qt headers to be used for bindings generation and not just the ones in
> > the Qt and KDE libs. Maybe a configuration file is needed for C++
> > classname to Java
> > package/classname mappings.
>
> In the case of kextprocess it's namespaced C++ code. There's the
> KExtProcess namespace with several classes in it. The most 'natural'
> namespace for Java in terms of typing and grouping would probably be
> <classname>.extprocess.kde.
I should have said to try your headers in the smoke/kde directory, and add 
them to the kde_header_list in there, and run 'perl generate.pl' in that 
directory. Maybe any kde classes in a namespace should use the scheme you 
give above. Then have a configuration file to specify any exceptions to the 
rule. The Qt4 classes aren't in namespaces, but I think the best mapping for 
them is one java package per library - qt.core.* qt.gui.* qt.xml.* and so on.

-- Richard


More information about the Kde-java mailing list