Building ossimjni module:

This is an example from linux. Adjust for windows as required.

Get the code:

$ svn co http://svn.osgeo.org/ossim/trunk/ossimjni ossimjni

Build the c++ side:

$ cd /work/osgeo/build
$ xemacs ossim-osgeo-cmake-config.sh
Add line:
-DOSSIM_BUILD_ADDITIONAL_DIRECTORIES="${build_dir}/ossimjni" \

Note if you have multiple addition projects to build separate by a semi-colon;

$ cat ossim-osgeo-cmake-config.sh
#!/bin/sh

build_dir="/work/osgeo";

cmake -G "Unix Makefiles" \
-DBUILD_CSMAPI=OFF \
-DBUILD_LIBRARY_DIR=lib \
-DBUILD_OMS=ON \
-DBUILD_OSSIM=ON \
-DBUILD_OSSIM_PLUGIN=ON  \
-DBUILD_OSSIMCONTRIB_PLUGIN=ON \
-DBUILD_OSSIMCSM_PLUGIN=OFF \
-DBUILD_OSSIMGDAL_PLUGIN=ON \
-DBUILD_OSSIMHDF_PLUGIN=OFF \
-DBUILD_OSSIMKAKADU_PLUGIN=ON \
-DBUILD_OSSIMKMLSUPEROVERLAY_PLUGIN=OFF \
-DBUILD_OSSIMLAS_PLUGIN=ON \
-DBUILD_OSSIMLIBLAS_PLUGIN=ON \
-DBUILD_OSSIMLIBRAW_PLUGIN=ON \
-DBUILD_OSSIMMRSID_PLUGIN=ON \
-DBUILD_OSSIMNDF_PLUGIN=ON \
-DBUILD_OSSIMOPENJPEG_PLUGIN=ON \
-DBUILD_OSSIMPNG_PLUGIN=ON \
-DBUILD_OSSIMREGISTRATION_PLUGIN=ON \
-DBUILD_OSSIMQT4=ON \
-DBUILD_OSSIM_MPI_SUPPORT=OFF \
-DBUILD_OSSIMPLANET=ON \
-DBUILD_OSSIMPLANETQT=ON \
-DBUILD_OSSIMPREDATOR=ON \
-DBUILD_OSSIM_TEST_APPS=ON \
-DBUILD_RAPIER_TEST_APPS=ON \
-DBUILD_RUNTIME_DIR=bin \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_WMS=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INCLUDE_PATH=${build_dir}/local/include \
-DCMAKE_INSTALL_PREFIX=${build_dir}/local \
-DCMAKE_LIBRARY_PATH=${build_dir}/local/lib \
-DCMAKE_MODULE_PATH=${build_dir}/ossim_package_support/cmake/CMakeModules \
-DKAKADU_ROOT_SRC=/work/drb/kakadu/latest \
-DKAKADU_AUX_LIBRARY=${build_dir}/local/lib64/libkdu_a64R.so \
-DKAKADU_LIBRARY=${build_dir}/local/lib64/libkdu_v64R.so  \
-DMPI_INCLUDE_PATH=/usr/include/openmpi-x86_64 \
-DMPI_LIBRARY=/usr/lib64/openmpi/lib/libmpi.so \
-DMRSID_LIBRARY=${build_dir}/local/lib/libltidsdk.a \
-DOSSIM_BUILD_ADDITIONAL_DIRECTORIES="${build_dir}/ossimjni;${build_dir}/Rapier;${build_dir}/ossim_rapier_plugin" \
-DOSSIM_COMPILE_WITH_FULL_WARNING=ON \
-DOSSIM_DEPENDENCIES=${build_dir}/local \
-DOSSIM_DEV_HOME=${build_dir} \
-DOSSIM_INSTALL_PLUGINS_WITH_VERSION=OFF \
-DOSSIM_LIBRARIES=${build_dir}/build/lib/libossim.so \
-DOSSIMPLANET_ENABLE_EPHEMERIS=ON \
../ossim_package_support/cmake/

$ rm CMakeCache.txt
$ ./ossim-osgeo-cmake-config.sh
...
**************** begin ossimjni project cmake setup ****************
**************** end ossimjni project cmake setup ****************
...
-- Build files have been written to: /work/osgeo/build
$ make -j 4

Generate the swig bindings and compile the java with ant:

To install ant on linux do:

$ sudo yum install ant ant-contrib cpptasks
$ cd /work/osgeo/ossimjni/java/
$ cp local.properties.template local.properties
$ xemacs local.properties
$ ant
Buildfile: build.xml
     [echo] module.name = ossimjni
     [echo] use ant -projecthelp to see targets.
     [echo] jdk.home        = /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64
     [echo] os.name         = Linux
     [echo] ossim.home      = /work/osgeo/ossim
     [echo] ossimjni.home   = /work/osgeo/ossimjni
     [echo] basedir         = /home/work/osgeo/ossimjni/java

check-reqired-properties:

initialize-environment:

generate-wrappers:
     [echo] module.name = ossimjni
     [echo] use ant -projecthelp to see targets.
     [echo] jdk.home        = /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64
     [echo] os.name         = Linux
     [echo] ossim.home      = /work/osgeo/ossim
     [echo] ossimjni.home   = /work/osgeo/ossimjni
     [echo] basedir         = /home/work/osgeo/ossimjni/java

generate-wrapper:
    [mkdir] Created dir: /home/work/osgeo/ossimjni/java/build/generated_src
     [echo] ossimjni
     [echo] /home/work/osgeo/ossimjni/java/swig/ossimjni.i

compile-cpp-wrappers:
    [mkdir] Created dir: /home/work/osgeo/ossimjni/java/build/lib
    [mkdir] Created dir: /home/work/osgeo/ossimjni/java/build/obj
       [cc] 1 total files to be compiled.
       [cc] Starting link

compile-java-wrappers:
    [mkdir] Created dir: /home/work/osgeo/ossimjni/java/build/classes
    [javac] Compiling 8 source files to /home/work/osgeo/ossimjni/java/build/classes

compile-java:
    [javac] Compiling 7 source files to /home/work/osgeo/ossimjni/java/build/classes

create-jar:
      [jar] Building jar: /home/work/osgeo/ossimjni/java/build/lib/ossimjni.jar

build:

BUILD SUCCESSFUL

Test the build:

$ java -Djava.library.path=/work/osgeo/ossimjni/java/build/lib -cp /work/osgeo/ossimjni/java/build/lib/ossimjni.jar org.ossim.jni.apps.OssimInfo /data1/tif/point-tif-ovr.tif
image0.band0.max_value:  255
image0.band0.min_value:  1
image0.band0.null_value:  0
image0.band1.max_value:  255
image0.band1.min_value:  1
image0.band1.null_value:  0
image0.band2.max_value:  255
image0.band2.min_value:  1
image0.band2.null_value:  0
image0.decimal_degrees_per_pixel_lat:  0.000224652629478557
image0.decimal_degrees_per_pixel_lon:  0.00030418128582111
image0.decimations:  (1,1) (0.5,0.5) (0.25,0.25) (0.125,0.125) (0.0625,0.0625) (0.03125,0.03125) (0.015625,0.015625) (0.0078125,0.0078125)
image0.entry:  0
image0.gsd:  (24.9824476685318,24.9824453696149)
image0.image_handler:  ossimTiffTileSource
image0.image_size:  (1000,1000)
image0.ll_lat:  42.3815978380446
image0.ll_lon:  -90.7879645973049
image0.lr_lat:  42.3912153358375
image0.lr_lon:  -90.4851680233695
image0.lr_x:  999
image0.lr_y:  999
image0.meters_per_pixel_x:  24.9824476685318
image0.meters_per_pixel_y:  24.9824453696149
image0.number_decimation_levels:  8
image0.number_input_bands:  3
image0.number_lines:  1000
image0.number_output_bands:  3
image0.number_samples:  1000
image0.overview_handler:  ossimTiffTileSource
image0.projection.central_meridian:  -87
image0.projection.datum:  WGE
image0.projection.elevation_lookup_flag:  0
image0.projection.ellipse_code:  WE
image0.projection.ellipse_epsg_code:  7030
image0.projection.ellipse_name:  WGS 84
image0.projection.false_easting_northing:  (500000,0)
image0.projection.false_easting_northing_units:  meters
image0.projection.gcs_code:  4326
image0.projection.hemisphere:  N
image0.projection.major_axis:  6378137
image0.projection.minor_axis:  6356752.3142
image0.projection.origin_latitude:  0
image0.projection.pcs_code:  32616
image0.projection.pixel_scale_units:  meters
image0.projection.pixel_scale_xy:  (25,25)
image0.projection.srs_name:  EPSG:32616
image0.projection.tie_point_units:  meters
image0.projection.tie_point_xy:  (188150,4724075)
image0.projection.type:  ossimUtmProjection
image0.projection.zone:  16
image0.radiometry:  8-bit
image0.target_rrds:  0
image0.tie_point_lat:  42.6060258148936
image0.tie_point_lon:  -90.8015523744828
image0.type:  ossimImageGeometry
image0.ul_lat:  42.6060258148936
image0.ul_lon:  -90.8015523744828
image0.ul_x:  0
image0.ul_y:  0
image0.ur_lat:  42.6157187475369
image0.ur_lon:  -90.4976752699475
number_entries:  1
Last modified 7 years ago Last modified on Jul 6, 2012 12:44:35 PM