[CMake] Is there a tool pretty much like cmake for Java?

Nicolas Desprès nicolas.despres at gmail.com
Mon Oct 18 05:21:58 EDT 2010


2010/10/14 Michał Czuczman <biurku at gmail.com>:
> On 2010-10-07, 12:57:50, Bill Hoffman wrote:
>>
>> On 10/7/2010 12:37 PM, Ryan Pavlik wrote:
>> >
>> >
>> > On 10/07/2010 09:57 AM, Andreas Schneider wrote:
>> >> On Thursday 07 October 2010 16:45:49 Andreas Schneider wrote:
>> >>> My current problem is with javah (C header file generator). This
>> >>> generator
>> >>> works on the class files. The class files aren't in
>> >>> CMAKE_CURRENT_BINARY_DIR they are located in:
>> >>>
>> >>>
>> >>> ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/<project>.dir/<some>/<directory>/foo
>> >>>
>> >>> bar.class
>> >>>
>> >>> So my current problem is how to point the generator there ...
>> >> In the language information file, this is<OBJECT_DIR> so is there
>> >> something
>> >> like CMAKE_CURRENT_OBJECT_DIR?
>> >>
>> >>
>> >> -- andreas
>> >
>> > I made a CMake-based build for the VRPN Java bindings, which require a
>> > javah call. I have no experience actually using them, so I'm not sure if
>> > they work, but they certainly compile. (Of course, I didn't realize
>> > there was CMake Java support, so this is all add_custom_command/target
>> > driven) Perhaps it will help:
>> >
>> > http://github.com/rpavlik/vrpn/blob/cmake-java/java_vrpn/CMakeLists.txt
>> >
>> > Hope this helps!
>> >
>> > Ryan
>> >
>> The java support was broken a while ago when we re-organized the build
>> trees.   I don't have much time to work on this, but I would like to get
>> it fixed.  The best approach might be a pure custom command approach.
>> We could model it after the scons java support which is quite simple.  I
>> am thinking of adding a module for java building into the Modules
>> directory as java does not really fit our language type that well.
>>
>> Anyone want to help?
>>
>> -Bill
>
> I would be interested in improving Java support in CMake.  A source code
> parser which finds out names of generated output object files, as in the
> SCons Java support, is a must.  That's what the current Java support in
> CMake lacks the most.  I've searched through CMake source code and it looks
> like the object file name is always obtained just from the source file
> name.  Unfortunately this doesn't work for Java.  Would you please give me
> some more details on how do you see the module implemented?  Or some hints
> from where to start?  The most tricky part is how to handle changing
> dependencies.  Should the classes and jar be separate targets, as it is in
> SCons?

Hello,

I am also very interested in the Java support in CMake. I had a quick
look at the source code in cmake and found those files:

Source/cmDependsJava.cxx
Source/cmDependsJava.h
Source/cmDependsJavaLexer.cxx
Source/cmDependsJavaLexer.h
Source/cmDependsJavaLexer.in.l
Source/cmDependsJavaParser.cxx
Source/cmDependsJavaParser.y
Source/cmDependsJavaParserHelper.cxx
Source/cmDependsJavaParserHelper.h

So it seems there is a Java parser and lexer written in flex and
bison. But the cmDependsJava.cxx file looks empty specially the
WriteDependencies method:

http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmDependsJava.cxx;h=1d849145cb70ae7bd21cb0fa5c33e289cd0fbc8d;hb=HEAD


-- 
Nicolas Desprès


More information about the CMake mailing list