source: trunk/components/bio-formats-jace/build.xml @ 4822

Revision 4822, 3.8 KB checked in by curtis, 11 years ago (diff)

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

Line 
1<!--
2build.xml
3
4Ant build file for the Bio-Formats C++ bindings.
5Download Apache Ant from http://ant.apache.org/.
6Type "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.
10-->
11
12<project name="bfcpp" default="compile" basedir=".">
13  <description>
14    Build file for Bio-Formats C++ bindings
15  </description>
16  <property file="base.properties"/>
17  <import file="${root.dir}/common.xml"/>
18  <property file="build.properties"/>
19
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/
28
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>
40  </target>
41
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>
55  </target>
56
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}"/>
91      <arg value=".."/>
92    </exec>
93  </target>
94
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}"/>
116  </target>
117
118</project>
Note: See TracBrowser for help on using the repository browser.