forked from hughperkins/jeigen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
82 lines (73 loc) · 3.55 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<project default="jar">
<property name="generator" value="Unix Makefiles" />
<property name="cmake_home" value="/usr" />
<path id="project.class.path">
<pathelement path="${java.class.path}/"/>
<pathelement path="thirdparty/junit-4.10.jar"/>
<pathelement path="thirdparty/jna-4.0.0.jar"/>
</path>
<!-- sets ${build-dir} = win-32 win-64 linux-32 or linux-64 -->
<target name="getinfo">
<condition property="jvm.word.size" value="32" ><os arch="i386" /></condition>
<condition property="jvm.word.size" value="32" ><os arch="x86" /></condition>
<property name="jvm.word.size" value="64" />
<condition property="build.dir.os" value="win"><os family="Windows" /></condition>
<condition property="build.dir.os" value="linux"><os family="Unix" /></condition>
<echo message="os.arch: ${os.arch} os.family ${os.name} jvm.word.size ${jvm.word.size}" />
<echo message="build.dir.os ${build.dir.os}" />
<!-- check generator matches word size. only applies to visual studio -->
<fail message="Using 64-bit generator on 32-bit jvm">
<condition>
<and>
<equals arg1="${jvm.word.size}" arg2="32" />
<contains string="${generator}" substring="Visual Studio" />
<contains string="${generator}" substring="Win64" />
</and>
</condition>
</fail>
<fail message="Using 32-bit generator on 64-bit jvm">
<condition>
<and>
<equals arg1="${jvm.word.size}" arg2="64" />
<contains string="${generator}" substring="Visual Studio" />
<not><contains string="${generator}" substring="Win64" /></not>
</and>
</condition>
</fail>
<property name="build.dir" value="build/${build.dir.os}-${jvm.word.size}" />
<echo message="build.dir ${build.dir}" />
</target>
<target name="compile" depends="getinfo">
<taskdef name="cmake" classname="CMake" classpath="thirdparty/cmake-for-ant.jar" />
<mkdir dir="${build.dir}/native" />
<cmake cmakehome="${cmake_home}" releasetype="Release" generator="${generator}"
srcdir="src/native" builddir="${build.dir}/native" artifactdirproperty="cmakeoutdir" />
<mkdir dir="${build.dir}/classes"/>
<javac srcdir="src/java" destdir="${build.dir}/classes" debug="true" includeantruntime="false" >
<classpath refid="project.class.path" />
</javac>
<copy todir="${build.dir}/classes" >
<fileset dir="src/java" />
</copy>
</target>
<target name="jar" depends="compile">
<jar destfile="${build.dir}/Jeigen.jar" basedir="${build.dir}/classes" />
</target>
<target name="test" depends="jar">
<echo message="cmakeoutdir: ${cmakeoutdir}" />
<junit printsummary="on" fork="on" haltonerror="on" haltonfailure="on" showoutput="withOutAndErr" >
<classpath>
<pathelement location="${build.dir}/Jeigen.jar" />
<pathelement path="thirdparty/jna-4.0.0.jar"/>
<pathelement path="thirdparty/junit-4.10.jar"/>
</classpath>
<formatter type="xml"/>
<sysproperty key="java.library.path" value="${cmakeoutdir}" />
<sysproperty key="jna.debug_load" value="true" />
<test name="jeigen.TestJeigen" todir="${build.dir}"/>
</junit>
</target>
<target name="clean" >
<delete dir="build" />
</target>
</project>