Ignore:
Timestamp:
02/19/09 12:50:03 (11 years ago)
Author:
curtis
Message:

Better build system for Bio-Formats C++ bindings on Linux.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats-jace/build.xml

    r4761 r4822  
    22build.xml 
    33 
    4 Ant build file for bfjace, the Bio-Formats Jace C++ bindings. 
     4Ant build file for the Bio-Formats C++ bindings. 
    55Download Apache Ant from http://ant.apache.org/. 
    66Type "ant -p" for a list of targets. 
     7 
     8Note that this build file extends common.xml rather than java.xml, 
     9because this component does not consist of Java source files. 
    710--> 
    811 
    9 <project name="formats-jace" default="jar" basedir="."> 
     12<project name="bfcpp" default="compile" basedir="."> 
    1013  <description> 
    11     Build file for Bio-Formats Jace C++ bindings 
     14    Build file for Bio-Formats C++ bindings 
    1215  </description> 
    1316  <property file="base.properties"/> 
     
    1518  <property file="build.properties"/> 
    1619 
    17   <!-- 
    18   Guess where the java runtime classes are for Jace 
    19   Stolen from: 
    20   http://forums.gamegardens.com/discussion/mvnforum/viewthread?thread=324 
    21   --> 
    22   <!-- if Mac OS X --> 
    23   <property name="jre.macosx.classes" 
    24     value="/System/Library/Frameworks/JavaVM.framework/Classes/classes.jar"/> 
    25   <property name="jre.macosx.ui" 
    26     value="/System/Library/Frameworks/JavaVM.framework/Classes/ui.jar"/> 
    27   <condition property="jre.runtime" 
    28     value="${jre.macosx.classes}:${jre.macosx.ui}"> 
    29     <and> 
    30       <os family="mac"/> 
    31       <os family="unix"/> 
    32     </and> 
    33   </condition> 
    34   <!-- Default for Unix --> 
    35   <property name="jre.runtime" value="${java.home}/lib/rt.jar"/> 
     20  <target name="check-jace"> 
     21    <available file="${jace.home}/release/lib" property="jaceFound"/> 
     22    <if> 
     23      <isset property="jaceFound"/> 
     24      <else> 
     25<echo> 
     26This component requires Jace, available from: 
     27  http://sourceforge.net/projects/jace/ 
    3628 
    37   <target name="gen-proxies" depends="clean-gen" 
    38     description="generate Jace proxies from C++ source code"> 
    39     <mkdir dir="${jace.proxy-dir}/include"/> 
    40     <mkdir dir="${jace.proxy-dir}/source"/> 
    41     <java classname="jace.autoproxy.AutoProxy"> 
    42       <arg path="include"/> 
    43       <arg path="source"/> 
    44       <arg path="${jace.proxy-dir}/include"/> 
    45       <arg path="${jace.proxy-dir}/source"/> 
    46       <arg path="${jre.runtime}:${artifact.dir}/bio-formats.jar"/> 
    47       <classpath> 
    48         <fileset dir="jace/lib"> 
    49           <include name="*.jar"/> 
    50         </fileset> 
    51       </classpath> 
    52       <arg value="-mindep"/> 
    53     </java> 
     29Please set the jace.home property to point to 
     30your Jace installation directory. E.g.: 
     31  ant -Djace.home=${user.home}/jace 
     32 
     33You can check out the latest Jace code from 
     34the Subversion repository using the command: 
     35  svn co https://jace.svn.sourceforge.net/svnroot/jace/trunk jace 
     36</echo> 
     37        <fail message="Jace not found."/> 
     38      </else> 
     39    </if> 
    5440  </target> 
    5541 
    56   <target name="clean-gen" description="clean Jace proxies"> 
    57     <delete dir="${jace.proxy-dir}"/> 
     42  <target name="compile-jace" depends="check-jace" 
     43    description="compile Jace Java classes"> 
     44    <available file="${jace.home}/release/lib/jace.jar" 
     45      property="jaceJarsExist"/> 
     46    <if> 
     47      <isset property="jaceJarsExist"/> 
     48      <then> 
     49<echo>Jace libraries exist; run clean-jace target first to recompile.</echo> 
     50      </then> 
     51      <else> 
     52        <ant dir="${jace.home}/source/java"/> 
     53      </else> 
     54    </if> 
    5855  </target> 
    5956 
    60   <target name="build" depends="gen-proxies" 
    61     description="Build Bio-Formats Jace C++ library"> 
    62     <mkdir dir="${cmake.build-dir}"/> 
    63     <exec executable="cmake" dir="${cmake.build-dir}"> 
     57  <target name="gen-proxies" depends="compile-jace" 
     58    description="generate C++ proxies for Bio-Formats Java library"> 
     59    <available file="${proxies.dir}" property="proxiesExist"/> 
     60    <if> 
     61      <isset property="proxiesExist"/> 
     62      <then> 
     63<echo>Proxies exist; run clean-proxies target first to regenerate.</echo> 
     64      </then> 
     65      <else> 
     66        <mkdir dir="${proxies.dir}/include"/> 
     67        <mkdir dir="${proxies.dir}/source"/> 
     68        <!-- NB: Need to fork or else Ant raises a cryptic exception. --> 
     69        <java classname="jace.autoproxy.AutoProxy" fork="true"> 
     70          <arg path="include"/> 
     71          <arg path="source"/> 
     72          <arg path="${proxies.dir}/include"/> 
     73          <arg path="${proxies.dir}/source"/> 
     74          <arg path="${jre.runtime}:${artifact.dir}/bio-formats.jar"/> 
     75          <classpath> 
     76            <fileset dir="${jace.home}/release/lib"> 
     77              <include name="*.jar"/> 
     78            </fileset> 
     79          </classpath> 
     80          <arg value="-mindep"/> 
     81        </java> 
     82      </else> 
     83    </if> 
     84  </target> 
     85 
     86  <target name="gen-makefile" depends="check-jace, gen-proxies" 
     87    description="Generate build system for Bio-Formats C++ bindings"> 
     88    <mkdir dir="${build.dir}"/> 
     89    <exec executable="cmake" dir="${build.dir}" failonerror="true"> 
     90      <arg value="-DJACE_DIR=${jace.home}"/> 
    6491      <arg value=".."/> 
    6592    </exec> 
    66     <exec executable="make" dir="${cmake.build-dir}"/> 
    67     <copy file="${cmake.build-dir}/jace/libjace.so" todir="${cmake.build-dir}"/> 
    68     <copy file="jace/lib/jace-runtime.jar" todir="${cmake.build-dir}"/> 
    69     <copy file="${artifact.dir}/loci_tools.jar" todir="${cmake.build-dir}"/> 
    7093  </target> 
    7194 
    72   <target name="clean-build" description="clean bfjace build files"> 
    73     <delete dir="${cmake.build-dir}"/> 
     95  <target name="copy-libs" depends="check-jace, compile-jace"> 
     96    <mkdir dir="${build.dir}"/> 
     97    <copy file="${artifact.dir}/loci_tools.jar" todir="${build.dir}"/> 
     98    <copy file="${jace.home}/release/lib/jace-runtime.jar" 
     99      todir="${build.dir}"/> 
     100  </target> 
     101 
     102  <target name="compile" depends="gen-makefile, copy-libs" 
     103    description="Build Bio-Formats C++ library"> 
     104    <exec executable="make" dir="${build.dir}" failonerror="true"/> 
     105  </target> 
     106 
     107  <target name="clean-jace" depends="check-jace" 
     108    description="clean Jace libraries"> 
     109    <ant dir="${jace.home}/source/java" target="clean"/> 
     110    <delete file="${jace.home}/release/lib/jace.jar"/> 
     111    <delete file="${jace.home}/release/lib/jace-runtime.jar"/> 
     112  </target> 
     113 
     114  <target name="clean-proxies" description="clean C++ proxies"> 
     115    <delete dir="${proxies.dir}"/> 
    74116  </target> 
    75117 
Note: See TracChangeset for help on using the changeset viewer.