-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathbuild.xml
171 lines (157 loc) · 9.01 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<project default="jar">
<path id="project.class.path">
<pathelement path="${java.class.path}/"/>
<pathelement path="thirdparty/junit-4.10.jar"/>
<pathelement path="thirdparty/jna-4.1.0.jar"/>
</path>
<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="mac"><and><os family="Unix" /><contains string="${os.name}" substring="Mac OS" /></and></condition>
<condition property="build.dir.os" value="linux"><os family="Unix" /></condition>
<echo message="os.arch: ${os.arch} os.family ${os.family} os.name ${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}" />
<property name="onefat.unzip.dir" value="build/onefat-unzip" />
<property name="onefat.staging.dir" value="build/onefat-staging" />
</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" />
<!-- <fileset file="${cmakeoutdir}/*.so" />
<fileset file="${cmakeoutdir}/*.dll" />-->
</copy>
<copy tofile="${build.dir}/classes/jeigen-${build.dir.os}-${jvm.word.size}.dll" failonerror="false" quiet="true" file="${cmakeoutdir}/jeigen.dll" overwrite="true" />
<copy tofile="${build.dir}/classes/libjeigen-${build.dir.os}-${jvm.word.size}.so" failonerror="false" quiet="true" file="${cmakeoutdir}/libjeigen.so" overwrite="true" />
<copy tofile="${build.dir}/classes/libjeigen-${build.dir.os}-${jvm.word.size}.dylib" failonerror="false" quiet="true" file="${cmakeoutdir}/libjeigen.dylib" overwrite="true" />
<copy todir="${build.dir}" >
<fileset file="thirdparty/jna-4.1.0.jar" />
</copy>
</target>
<condition property="isWin">
<os family="Windows"/>
</condition>
<target name="download-win-runtime" depends="compile" if="isWin">
<echo message="downloading win runtime" />
<get src="http://deepcl.hughperkins.com/vc2010redist.zip" usetimestamp="true" dest="${build.dir}/vc2010redist.zip" />
<unzip src="${build.dir}/vc2010redist.zip" dest="${build.dir}/vc2010redist" />
<copy tofile="${build.dir}/classes/msvc-redist/${build.dir.os}-${jvm.word.size}/msvcp100.dll" file="${build.dir}/vc2010redist/vc2010redist/${build.dir.os}${jvm.word.size}/msvcp100.dll" />
<copy tofile="${build.dir}/classes/msvc-redist/${build.dir.os}-${jvm.word.size}/msvcr100.dll" file="${build.dir}/vc2010redist/vc2010redist/${build.dir.os}${jvm.word.size}/msvcr100.dll" />
</target>
<target name="jar" depends="compile,download-win-runtime">
<jar destfile="${build.dir}/Jeigen-${build.dir.os}-${jvm.word.size}.jar" basedir="${build.dir}/classes" />
</target>
<target name="test" depends="jar">
<echo message="cmakeoutdir: ${cmakeoutdir}" />
<junit printsummary="withOutAndErr" fork="on" haltonerror="on" haltonfailure="on" showoutput="withOutAndErr" >
<classpath>
<pathelement location="${build.dir}/Jeigen-${build.dir.os}-${jvm.word.size}.jar" />
<pathelement path="${build.dir}/jna-4.1.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" />
<sysproperty key="jna.nosys" value="true" />
<test name="jeigen.TestJeigen" todir="${build.dir}"/>
<test name="jeigen.TestEigenvalues" todir="${build.dir}"/>
<test name="jeigen.TestDenseAggregator" todir="${build.dir}"/>
<test name="jeigen.TestUnsupported" todir="${build.dir}"/>
<test name="jeigen.TestDenseSorter" todir="${build.dir}"/>
</junit>
</target>
<target name="clean" >
<delete dir="build" />
<delete dir="${user.home}/.jeigen" />
</target>
<target name="package" depends="jar">
<zip destfile="build/jeigen-${build.dir.os}-${jvm.word.size}.zip" basedir="build/${build.dir.os}-${jvm.word.size}"
includes="*.jar,${cmakeoutdir}/*.so,${cmakeoutdir}/*.dll,${cmakeoutdir}/*.dylib" />
</target>
<target name="package-onefat" depends="compile,getinfo" >
<!-- copy across class files -->
<copy todir="${onefat.staging.dir}" >
<fileset dir="${build.dir}/classes" />
</copy>
<!-- extract the zips, to get the jeigen jars -->
<!-- <unzip src="build/jeigen-linux-32.zip" dest="${onefat.unzip.dir}" >-->
<!-- <patternset><include name="Jeigen-linux-32.jar" /></patternset>-->
<!-- </unzip>-->
<!-- <unzip src="build/jeigen-linux-64.zip" dest="${onefat.unzip.dir}" >-->
<!-- <patternset><include name="Jeigen-linux-64.jar" /></patternset>-->
<!-- </unzip>-->
<!-- <unzip src="build/jeigen-win-32.zip" dest="${onefat.unzip.dir}" >-->
<!-- <patternset><include name="Jeigen-win-32.jar" /></patternset>-->
<!-- </unzip>-->
<!-- <unzip src="build/jeigen-win-64.zip" dest="${onefat.unzip.dir}" >-->
<!-- <patternset><include name="Jeigen-win-64.jar" /></patternset>-->
<!-- </unzip>-->
<!-- extract the jars, to get the native shared objects -->
<unzip src="build/Jeigen-linux-32.jar" dest="${onefat.staging.dir}" >
<patternset><include name="libjeigen-linux-32.so" /></patternset>
</unzip>
<unzip src="build/Jeigen-linux-64.jar" dest="${onefat.staging.dir}" >
<patternset><include name="libjeigen-linux-64.so" /></patternset>
</unzip>
<unzip src="build/Jeigen-win-32.jar" dest="${onefat.staging.dir}" >
<patternset><include name="**/*.dll" /></patternset>
</unzip>
<unzip src="build/Jeigen-win-64.jar" dest="${onefat.staging.dir}" >
<patternset><include name="**/*.dll" /></patternset>
</unzip>
<unzip src="build/Jeigen-mac-64.jar" dest="${onefat.staging.dir}" >
<patternset><include name="*.dylib" /></patternset>
</unzip>
<!-- make the jar :-) -->
<jar destfile="build/Jeigen-onefat.jar" basedir="${onefat.staging.dir}" />
</target>
<target name="test-onefat" depends="getinfo" >
<mkdir dir="build/test-onefat" />
<javac srcdir="." destdir="build/test-onefat" debug="true" includeantruntime="false" includes="TestSimple.java"
classpath="build/Jeigen-win-linux-32-64.jar" />
<java classname="jeigen.TestSimple" fork="true" failonerror="true" >
<classpath>
<pathelement path="build/test-onefat" />
<pathelement location="build/Jeigen-win-linux-32-64.jar" />
<pathelement location="thirdparty/jna-4.1.0.jar" />
</classpath>
</java>
</target>
<target name="publish" depends="getinfo" > <!-- just for my use really, to make publishing binaries easy :-) -->
<!-- <exec failonerror="true" command="scp-vpc1-upload.sh ${build.dir}/* ~/jeigen/${build.dir}" /> -->
<exec failonerror="true" executable="scp-vpc1-upload.sh">
<arg value="${build.dir}/*"/>
<arg value="~/jeigen/${build.dir}" />
</exec>
</target>
</project>