[ismrmrd] 160/281: using FindJNI for Java bindings.

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:01:09 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to annotated tag ismrmrd0.5
in repository ismrmrd.

commit 6cd599a57169872f36cbdf1d8073326f27306c47
Author: Joseph Naegele <joseph.naegele at gmail.com>
Date:   Wed Jul 31 15:05:35 2013 -0400

    using FindJNI for Java bindings.
    
    No longer need to specify JAVA_INCLUDE_DIR for cmake, as FindJNI
    defines JAVA_INCLUDE_PATH.
---
 bindings/CMakeLists.txt                       |  6 ++++--
 bindings/java/CMakeLists.txt                  | 11 ++++++-----
 bindings/java/{make_jar.sh => make_jar.sh.in} |  2 +-
 bindings/python/CMakeLists.txt                |  2 +-
 4 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt
index 2b7cda6..bba1000 100644
--- a/bindings/CMakeLists.txt
+++ b/bindings/CMakeLists.txt
@@ -11,10 +11,12 @@ if(SWIG_FOUND)
         message("PythonLibs not found. Not building Python bindings")
     endif(PYTHONLIBS_FOUND)
 
-    if(DEFINED JAVA_INCLUDE_DIR)
+    find_package(JNI)
+    if(JNI_FOUND)
+        message(STATUS "JAVA Include Path: ${JAVA_INCLUDE_PATH}")
         add_subdirectory(java)
     else()
-        message("JAVA_INCLUDE_DIR not defined. Not building Java bindings")
+        message("JNI not found. Not building Java bindings")
     endif()
 
 endif(SWIG_FOUND)
diff --git a/bindings/java/CMakeLists.txt b/bindings/java/CMakeLists.txt
index 86c2f23..27b7bef 100644
--- a/bindings/java/CMakeLists.txt
+++ b/bindings/java/CMakeLists.txt
@@ -1,19 +1,20 @@
 include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
 include_directories(${HDF5_INCLUDE_DIR} ${HDF5_INCLUDE_DIR}/cpp ${Boost_INCLUDE_DIR})
-include_directories(${JAVA_INCLUDE_DIR})
+include_directories(${JAVA_INCLUDE_PATH})
 if (UNIX)
-    include_directories(${JAVA_INCLUDE_DIR}/linux)
+    include_directories(${JAVA_INCLUDE_PATH}/linux)
 endif (UNIX)
 
 set(CMAKE_SWIG_FLAGS -package org.ismrm.ismrmrd)
 set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/org/ismrm/ismrmrd)
 
-set(SWIG_SOURCES ismrmrd_java.i ../../ismrmrd_hdf5.cpp)
+set(SWIG_SOURCES ismrmrd_java.i ${CMAKE_SOURCE_DIR}/ismrmrd_hdf5.cpp)
 set_source_files_properties(${SWIG_SOURCES} PROPERTIES CPLUSPLUS ON)
 swig_add_module(jismrmrd java ${SWIG_SOURCES})
 swig_link_libraries(jismrmrd ${HDF5_LIBRARIES} ${Boost_LIBRARIES})
 
-## TODO: this will NOT work on Windows
+## TODO: not use a unix shell script
+configure_file(make_jar.sh.in make_jar.sh @ONLY)
 set_source_files_properties(ismrmrd.jar PROPERTIES GENERATED true)
 add_custom_command(
     TARGET jismrmrd
@@ -25,7 +26,7 @@ add_custom_command(
     COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/org/ismrm/ismrmrd/xmlhdr
     COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/XMLString.java	
                ${CMAKE_CURRENT_BINARY_DIR}/org/ismrm/ismrmrd/xmlhdr/
-    COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/make_jar.sh
+    COMMAND sh make_jar.sh
     VERBATIM
 )
 
diff --git a/bindings/java/make_jar.sh b/bindings/java/make_jar.sh.in
similarity index 75%
rename from bindings/java/make_jar.sh
rename to bindings/java/make_jar.sh.in
index 0b2145e..a04fa97 100755
--- a/bindings/java/make_jar.sh
+++ b/bindings/java/make_jar.sh.in
@@ -3,7 +3,7 @@ javac org/ismrm/ismrmrd/*.java
 
 ## The XML Header classes
 # Make a class out of the schema
-xjc -p org.ismrm.ismrmrd.xmlhdr -b ../../../bindings/java/cfg.jxb ../../../schema/ismrmrd.xsd
+xjc -p org.ismrm.ismrmrd.xmlhdr -b @CMAKE_SOURCE_DIR@/bindings/java/cfg.jxb @CMAKE_SOURCE_DIR@/schema/ismrmrd.xsd
 javac org/ismrm/ismrmrd/xmlhdr/*.java
 
 # Build a big jar
diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
index 30199ea..b1861fb 100644
--- a/bindings/python/CMakeLists.txt
+++ b/bindings/python/CMakeLists.txt
@@ -4,7 +4,7 @@ include_directories(${HDF5_INCLUDE_DIR} ${HDF5_INCLUDE_DIR}/cpp ${Boost_INCLUDE_
 
 set_source_files_properties(ismrmrd_python.i PROPERTIES CPLUSPLUS ON)
 
-swig_add_module(ismrmrd python ismrmrd_python.i ../../ismrmrd_hdf5.cpp)
+swig_add_module(ismrmrd python ismrmrd_python.i ${CMAKE_SOURCE_DIR}/ismrmrd_hdf5.cpp)
 swig_link_libraries(ismrmrd ${HDF5_LIBRARIES} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
 
 install(TARGETS ${SWIG_MODULE_ismrmrd_REAL_NAME} DESTINATION lib)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ismrmrd.git



More information about the debian-science-commits mailing list