Kexi ODB filter: Setting up with paths with
Jaroslaw Staniek
staniek at kde.org
Mon Jun 9 07:33:05 BST 2014
On 6 June 2014 17:52, Harshi Mistry <harshimistry at gmail.com> wrote:
> I was kind of stuck in
> figuring out cmake way of doing things.
> So compiling cpp file with JNI code needs JNI headers to be included and
> Java binaries to be linked. I do like this when running my standalone code:
Hi,
Thanks for getting this far Harshita!
[I've altered the subject to reflect real topic here]
> gcc -I/usr/lib64/jvm/java-7-openjdk/include/
> -I/usr/lib64/jvm/java-7-openjdk/include/linux/ -L/usr/bin/java
> -L/usr/lib64/jvm/java-7-openjdk/jre/lib/amd64/server/ javaFromCpp.cpp -ljvm
>
> Also running resultant executable requires LD_LIBRARY_PATH to be set. I was
> figuring out how to do these things in cmake.
> As far as I understand I need to do find_package(JNI) in top CMakeLists.txt
> file in src/calligra directory. Then do following in CMakeLists.txt in odb
> directory.
>
> include_directories(${JNI_INCLUDE_DIRS})
> target_link_libraries (helloworld ${JNI_LIBRARIES})
>
> Though I am not yet sure how to set LD_LIBRARY_PATH in cmake.
> Further, I need to install a Java library called hsqldb.jar (used for jdbc
> operations on odb files) using cmake and get its absolute path in my cpp
> code. I don't understand how to do it. Please help me in this.
Some first hints only. Anyone please correct me if needed.
If you need to access the install prefix from C++, look how it's
already put by cmake inside our /KoConfig.h file.
It's geenrated out of KoConfig.h.cmake and the C/C++ variable is CALLIGRAPREFIX.
Regarding the compiler paths and flags for Java, cmake offers
detection -- this is for investigation as I have not used it really
but look at docs for FindJava, it sets Java_INCLUDE_DIRS.
Ultimately it's recommended to test if Java was found (Java_FOUND) --
if not found, we do not attempt to build the ODB plugin so Kexi still
builds fine. It's also good idea to exclude build on non-Linux until
building and running on other platforms is tested.
Regarding LD_LIBRARY_PATH, we set it as a part of build/run
environment as expressed http://community.kde.org/Calligra/Building.
So you can extend it further.
So it's outside of cmake unless you really need LD_LIBRARY_PATH at
configure or build time.
--
regards / pozdrawiam, Jaroslaw Staniek
Kexi & Calligra & KDE | http://calligra.org/kexi | http://kde.org
Qt for Tizen | http://qt-project.org/wiki/Tizen
Qt Certified Specialist | http://www.linkedin.com/in/jstaniek
More information about the calligra-devel
mailing list