Permalink
Fetching contributors…
Cannot retrieve contributors at this time
298 lines (274 sloc) 12.7 KB
<?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.3-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 &quot;@{path}&quot; @{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 &quot;${src}&quot; @{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 &quot;@{file}&quot;"/>
</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.5" debug="on" compiler="javac1.5" target="1.5" 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.5" debug="on" compiler="javac1.5" target="1.5" 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.5" debug="on" compiler="javac1.5" target="1.5" 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[ &copy; 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>