Changes between Version 3 and Version 4 of GdalOgrInJavaBuildInstructions


Ignore:
Timestamp:
Jan 30, 2011, 11:31:53 AM (13 years ago)
Author:
warmerdam
Comment:

partial rewrite...

Legend:

Unmodified
Added
Removed
Modified
  • GdalOgrInJavaBuildInstructions

    v3 v4  
    22= Build Instructions for GDAL/OGR In Java (Windows) =
    33
    4 '''NOTES'''
    5 
    6 (1) These instructions were written in January 2008.
    7 
    8 (2) GEOS is included here, but it is not necessary.
    9 
    10 (3) MS Visual C++ is required for compiling various packages. Version 7 has been tested and has no problems; older/newer versions should work, but have not been tested.
    11 
    12 (4) Version numbers in parentheses are the latest versions available for each given package (except for packages where a specific version is required).
    13 
    14 (5) ''<geos-dir>'' refers to the directory where GEOS is installed. ''<gdal-dir>'' refers to the directory where GDAL is installed. ''<java-dir>'' refers to the directory where Java is installed. ''<ant-dir>'' refers to the directory where Apache Ant is installed.
    15 
    16 '''1. Compile GEOS 2.2.3'''
    17 
    18 [http://geos.refractions.net]
    19 
    20 I couldn't get the latest version, 3.0.0, to compile on my PC with MS VC7; however, there are project files for MS VC8 available that could be tried. However, version 2.2.3 was good enough for what I needed.
    21 
    22 a. Download [http://svn.osgeo.org/geos/trunk/source/headers/geos/version.h.vc] and place it in ''<geos-dir>''\source\headers\geos. Edit the following lines:
    23 {{{
    24 #define GEOS_VERSION_MAJOR 3    - change 3 to 2
    25 #define GEOS_VERSION_MINOR 0    - change 0 to 2
    26 #define GEOS_VERSION_PATCH 0rc4 - change 0rc4 to 2
    27 #define GEOS_VERSION "3.0.0rc4" - change 3.0.0rc4 to 2.2.3
    28 }}}
    29 
    30 b. Rename ''<geos-dir>''\source\capi\geos_c.h.in to geos_c.h.vc.
    31 
    32 c. Run MSVC's vcvars32.bat
    33 
    34 d. In the "source" directory, run "nmake -f makefile.vc"
    35 
    36 '''2. Install the latest version of SWIG (1.3.33)'''
     4== Install SWIG ==
    375
    386[http://www.swig.org/download.html]
    397
    40 A Windows version with a pre-built executable is available, so compiling isn't necessary.
     8Install an appropriate version of SWIG for windows.  GDAL/OGR's Java bindings correct operation are fairly sensitive to the version of SWIG used.  Version 1.3.39 is appropriate for GDAL/OGR 1.8.0.  A Windows version with a pre-built executable is available, so compiling isn't necessary.
    419
    42 '''3. Install the latest version of the Java SE Development Kit (1.6.0_03)'''
     10OSGeo4W has a "swig" package which will install a suitable version of swig in C:\OSGeo4W\apps\swigwin.
    4311
    44 [http://java.sun.com/javase/downloads/index.jsp]
     12== Install the latest version of the Java SE Development Kit ==
    4513
    46 '''4. Install the latest version of Apache Ant (1.7.0)'''
     14Make sure you are getting the "JDK", not just the runtime environment.  The "SE" (standard edition?) is fine, no need for "EE" (enterprise edition).
     15
     16[http://www.oracle.com/technetwork/java/javase/downloads/index.html]
     17
     18
     19== Apache Ant ==
    4720
    4821[http://ant.apache.org/bindownload.cgi]
     
    5023Binary distributions are available, so compiling isn't necessary.
    5124
    52 '''5. Set up environment variables'''
     25''I don't think ANT is really needed, perhaps remove this step...''
     26
     27== Set up environment variables ==
    5328
    5429a. In the Control Panel, open up System. Switch to the Advanced tab and click on Environmental Variables.
     
    5833c. Do the same for PATH. Ensure that "''<java-dir>''\bin" and "''<ant-dir>''\bin" are included in PATH.
    5934
    60 '''6.   Compile GDAL 1.4.4 with GEOS'''
     35== Compile GDAL ==
    6136
    6237[http://trac.osgeo.org/gdal/wiki/DownloadSource]
    6338
    64 GDAL 1.5's Java bindings are orphaned and are believed to be broken, so we'll stick with 1.4.4 for now.
     39Adjust the SWIG macro in <''gdal-dir''>\nmake.opt to point to C:\OSGeo4W\apps\swigwin\swig.exe if using the OSGeo4W provided version of swig.
    6540
    66 a. Open <''gdal-dir''>\nmake.opt and make the following changes:
     41Otherwise build GDAL normally.
     42
     43== Configure Swig Bindings ==
     44
     45In ''<gdal-dir>''\swig\java, edit the java.opt file pointing it to your correct JDK location.   Also update the JAVA_INCLUDE to reference the win32 directory.
     46
    6747{{{
    68 - Change the value of SWIG to the location of swig.exe (ex. SWIG = c:\progra~1\swigwin-1.3.33\swig.exe).
    69 - Uncomment the GEOS_CFLAGS and GEOS_LIB lines.
    70 - Change the value of GEOS_CFLAGS to the source/capi directory in the GEOS installation (ex. GEOS_CFLAGS = -Ic:\geos-2.2.3\source\capi -DHAVE_GEOS).
    71 - Change the value of GEOS_LIB to the location of geos_c_i.lib (ex. GEOS_LIB = c:\geos-2.2.3\source\geos_c_i.lib).
     48JAVA_HOME = "C:\Program Files\Java\jdk1.6.0_23"
     49JAVADOC=$(JAVA_HOME)/bin/javadoc
     50JAVAC=$(JAVA_HOME)/bin/javac
     51JAVA=$(JAVA_HOME)/bin/java
     52JAR=$(JAVA_HOME)/bin/jar
     53JAVA_INCLUDE=-I$(JAVA_HOME)\include -I$(JAVA_HOME)\include\win32
    7254}}}
    73 
    74 b. Run MSVC's vcvars32.bat
    75 
    76 c. In ''<gdal-dir>'', run "nmake -f makefile.vc".
    77 
    78 '''7. Compile GDAL's Java bindings'''
    79 
    80 a. Run MSVC's vcvars32.bat
    81 
    82 b. In ''<gdal-dir>''\swig\java, edit the java.opt file pointing it to your correct JDK and ant locations.
    8355
    8456c. In ''<gdal-dir>''\swig, run "nmake -f makefile.vc java".