forked from jblas-project/jblas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
297 lines (274 loc) · 12.7 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2009, Mikio L. Braun
Copyright (c) 2008, Johannes Schaback
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of the Technische Universität Berlin nor the
names of its contributors may be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<project name="java-blas" basedir="." default="jar">
<description>
This is the build script to compile and deploy the java-blas project.
It also generates JavaDoc from source in ../doc.
</description>
<!-- Define directories -->
<property name="version" value="1.2.4-SNAPSHOT" />
<property name="src" value="${basedir}/src/main/java" />
<property name="test" value="${basedir}/src/test/java" />
<property name="bin" value="${basedir}/target/classes" />
<property name="native-libs" value="${basedir}/src/main/resources/lib" />
<property name="doc" value="${basedir}/javadoc" />
<property name="jar" value="${basedir}/target/jblas-${version}.jar" />
<property name="include" value="${basedir}/src/main/c" />
<property name="native" value="${basedir}/src/main/c" />
<property name="external" value="${basedir}/external" />
<property name="scripts" value="${basedir}/scripts" />
<property name="pkgbase" value="org.jblas" />
<property name="ruby" value="ruby" />
<!-- Macros -->
<macrodef name="class-to-float" description="generate a float version of a class">
<attribute name="class"/>
<attribute name="path" default="${src}"/>
<sequential>
<echo message="Generating float version of @{class}"/>
<exec executable="${ruby}">
<arg line="scripts/class_to_float.rb "@{path}" @{class}"/>
</exec>
</sequential>
</macrodef>
<macrodef name="static-class-to-float" description="Add float versions to a class">
<attribute name="class"/>
<sequential>
<echo message="Add float versions to class @{class}"/>
<exec executable="${ruby}">
<arg line="scripts/static_class_to_float.rb "${src}" @{class}"/>
</exec>
</sequential>
</macrodef>
<macrodef name="rjpp" description="Run the ruby-java preprocessor.">
<attribute name="file"/>
<sequential>
<exec executable="${ruby}">
<arg line="scripts/rjpp.rb "@{file}""/>
</exec>
</sequential>
</macrodef>
<macrodef name="create-jar" description="create jar file">
<attribute name="filename" />
<sequential>
<jar destfile="@{filename}">
<fileset dir="${bin}">
<include name="org/**" />
<include name="lib/**/lib*.so"/>
<include name="lib/**/*.dll"/>
<include name="lib/**/*.jnilib"/>
</fileset>
<manifest>
<attribute name="Built-By" value="IDA Group, TU Berlin" />
<attribute name="Main-Class" value="org.jblas.benchmark.Main" />
</manifest>
</jar>
</sequential>
</macrodef>
<macrodef name="rb-macro" description="Run the ruby macro precessor.">
<attribute name="definitions" />
<attribute name="file" />
<sequential>
<exec executable="${ruby}">
<arg line="-I templates scripts/macro.rb templates/@{definitions}.rb templates/@{file} src/@{file}" />
</exec>
</sequential>
</macrodef>
<!-- Organizational targets -->
<target name="clean" description="clean generated files">
<delete dir="${doc}" />
<delete dir="${bin}" />
</target>
<target name="clean-jars" description="delete all jar files">
<delete>
<fileset dir="." includes="*.jar" />
</delete>
</target>
<target name="prepare" description="create directories needed for compilation">
<mkdir dir="${bin}" />
</target>
<target name="compile" depends="prepare,generate-float" description="compile java code">
<javac destdir="${bin}" encoding="utf-8" source="1.6" debug="on" compiler="javac1.5" target="1.6" fork="yes" nowarn="yes">
<src path="${src}" />
</javac>
</target>
<target name="compile-test" depends="compile" description="compile java test code">
<javac destdir="${bin}" encoding="utf-8" source="1.6" debug="on" compiler="javac1.5" target="1.6" fork="yes" nowarn="yes">
<src path="${test}" />
<classpath>
<pathelement location="${external}/junit-4.8.2.jar" />
</classpath>
</javac>
</target>
<target name="javah" depends="prepare" description="run javah">
<javac destdir="${bin}" encoding="utf-8" source="1.6" debug="on" compiler="javac1.5" target="1.6" fork="yes" nowarn="yes">
<src path="${src}" />
<include name="**/NativeBlas.java" />
<include name="**/ArchFlavor.java" />
</javac>
<javah destdir="${include}" force="yes">
<class name="${pkgbase}.NativeBlas" />
<classpath>
<pathelement path="${bin}" />
</classpath>
</javah>
<javah destdir="${include}" force="yes">
<class name="org.jblas.util.ArchFlavor" />
<classpath>
<pathelement path="${bin}" />
</classpath>
</javah>
</target>
<target name="generate-float" depends="preprocess" description="generate float versions of classes">
<class-to-float class="${pkgbase}.DoubleMatrix"/>
<class-to-float class="${pkgbase}.DoubleFunction"/>
<class-to-float class="${pkgbase}.ComplexDouble"/>
<class-to-float path="${test}" class="${pkgbase}.TestDoubleMatrix"/>
<class-to-float path="${test}" class="${pkgbase}.TestBlasDouble"/>
<class-to-float class="${pkgbase}.ComplexDoubleMatrix"/>
<static-class-to-float class="${pkgbase}.SimpleBlas"/>
<static-class-to-float class="${pkgbase}.Solve"/>
<static-class-to-float class="${pkgbase}.Eigen"/>
<static-class-to-float class="${pkgbase}.Geometry"/>
<static-class-to-float class="${pkgbase}.MatrixFunctions"/>
<static-class-to-float class="${pkgbase}.JavaBlas"/>
<static-class-to-float class="${pkgbase}.Singular"/>
</target>
<target name="preprocess" description="run the ruby preprocessor on necessary files">
<rjpp file="${src}/org/jblas/DoubleMatrix.java"/>
<rjpp file="${test}/org/jblas/TestDoubleMatrix.java"/>
<rjpp file="${src}/org/jblas/MatrixFunctions.java"/>
<rjpp file="${src}/org/jblas/ComplexDoubleMatrix.java"/>
</target>
<target name="templates" description="Generate code from templates">
<rb-macro definitions="general" file="org/jblas/Matrix.java" />
</target>
<!-- jar files -->
<target name="dynamic-lean-jar" depends="compile" description="create jblas.jar (local system, dynamic)">
<delete dir="${bin}/lib" />
<copy todir="${bin}/lib">
<fileset dir="${native-libs}">
<include name="dynamic/${os.name}/${os.arch}/*" />
<include name="dynamic/${os.name}/${os.arch}/**/*" />
</fileset>
</copy>
<create-jar filename="jblas-dynamic-${os.name}-${os.arch}-${version}.jar" />
</target>
<target name="static-lean-jar" depends="compile" description="create jblas.jar (local system, static)">
<delete dir="${bin}/lib" />
<copy todir="${bin}/lib">
<fileset dir="${native-libs}">
<include name="static/${os.name}/${os.arch}/*" />
<include name="static/${os.name}/${os.arch}/**/*" />
</fileset>
</copy>
<create-jar filename="jblas-static-${os.name}-${os.arch}-${version}.jar" />
</target>
<target name="jar" depends="compile" description="create multiplatform.jar (everything in native-libs/static)">
<delete dir="${bin}/lib" />
<copy todir="${bin}/lib">
<fileset dir="${native-libs}">
<include name="static/**" />
</fileset>
</copy>
<create-jar filename="jblas-${version}.jar" />
</target>
<target name="minimal-jar" depends="compile" description="create jblas-lean.jar (local system, dynamic, without shared libs)" >
<delete dir="${bin}/lib" />
<create-jar filename="jblas-minimal-${version}.jar" />
</target>
<!-- javadoc -->
<target name="javadoc" depends="generate-float">
<mkdir dir="${doc}" />
<javadoc packagenames="org.jblas*.*" encoding="utf-8"
sourcepath="${src}" defaultexcludes="yes"
destdir="${doc}" author="true" version="true"
use="true" windowtitle="jblas" linksource="yes"
stylesheetfile="javadoc.css" overview="${src}/overview.html">
<doctitle>
<![CDATA[ <h1>jblas - Linear Algebra for Java (version ${version})</h1> ]]>
</doctitle>
<bottom>
<![CDATA[ © 2008-2013 by Mikio L. Braun and contributors ]]>
</bottom>
</javadoc>
</target>
<!-- testing -->
<target name="test" depends="compile-test,jar">
<junit printsummary="yes" haltonfailure="yes" showoutput="yes" fork="yes">
<classpath>
<pathelement location="${external}/junit-4.8.2.jar" />
<pathelement path="${bin}" />
</classpath>
<formatter type="plain" usefile="false" />
<!-- <test name="${pkgbase}.TestDoubleMatrix" />
<test name="${pkgbase}.TestEigen" />
<test name="${pkgbase}.ranges.IntervalRangeTest" />
<test name="${pkgbase}.TestDecompose" /> -->
<!-- <batchtest fork="yes" todir="${reports.tests}">
<fileset dir="${test}">
<include name="**/*Test*.java"/>
</fileset>
</batchtest>-->
<test name="${pkgbase}.TestBlasDoubleComplex" />
</junit>
</target>
<target name="all" depends="jar, javadoc">
</target>
<!-- taring everything up for distribution -->
<target name="tar" depends="javadoc">
<tar destfile="jblas-${version}.tgz" compression="gzip">
<tarfileset dir="${basedir}" prefix="jblas-${version}">
<include name="src/**" />
<include name="test/**" />
<exclude name="**/*.rjpp" />
<exclude name="**/semantic.cache" />
<include name="scripts/**" />
<exclude name="**/*~" />
<include name="build.xml" />
<include name="Makefile" />
<include name="config/*.rb" />
<include name="config/*.c" />
<include name="config/*.java" />
<include name="fortranwrapper.dump" />
<include name="README" />
<include name="INSTALL" />
<include name="COPYING" />
<include name="AUTHORS" />
<include name="javadoc.css" />
<include name="javadoc/**" />
<include name="nbproject/**" />
<include name="native/jblas_arch_flavor.c" />
</tarfileset>
<tarfileset dir="${basedir}" prefix="jblas-${version}" mode="755"
includes="configure" />
</tar>
</target>
</project>