Jogamp
Adapt to joal.jar location in ${joal.build}/jar/joal.jar
[joal-demos.git] / make / build.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3    - Ant build for the JOAL demos. This build has been tested with ANT 1.5.3.
4    -
5    - In order for this build to succeed the resulting jar files from this build
6    - (joal-demos.jar) must not be on the CLASSPATH.
7    -
8    - This build requires that the joal project has been checked out into a sibling
9    - directory to the joal-demos top-level directory and that the joal.jar has been
10    - built into its build directory.
11    -->
12 <project name="JOAL.demos" default="all">
13     <property name="project.root"  value=".." />
14
15     <condition property="rootrel.build" value="build">
16       <not>
17           <isset property="rootrel.build"/>
18       </not>
19     </condition>
20     <property name="build" location="${project.root}/${rootrel.build}" />
21
22     <property name="gluegen.root"  value="${project.root}/../gluegen" />
23     <property name="gluegen.build" value="${gluegen.root}/${rootrel.build}" />
24     <!-- Pull in GlueGen cpptasks build file -->
25     <import file="${gluegen.root}/make/gluegen-cpptasks.xml" />
26     <import file="${gluegen.root}/make/jogamp-archivetasks.xml" />
27     <import file="${gluegen.root}/make/jogamp-env.xml" />
28
29     <property name="joal.root"     value="${project.root}/../joal" />
30     <property name="joal.build"    value="${joal.root}/${rootrel.build}" />
31
32     <property file="${build}/artifact.properties"/>
33     <property name="joal-demos.build.number" value="manual-build"/>
34     <property name="joal-demos.build.id"     value="${version.timestamp}"/>
35     <property name="joal-demos.build.branch" value="master"/>
36     <property name="joal-demos.build.commit" value="manual"/>
37
38     <!-- 
39        - Make sure that joal-demos.jar is not on the CLASSPATH; this can
40        - cause builds to fail since if this Java process has the jar file
41        - open we can not overwrite it.
42       -->
43     <target name="test.for.joal.demos.jar">
44         <available property="joal.demos.jar.on.class.path" classname="demos.devmaster.lesson1.SingleStaticSource" />
45     </target>
46     <target name="java.class.path.validate" depends="test.for.joal.demos.jar" if="joal.demos.jar.on.class.path">
47         <fail>
48         
49     ******************************************************************
50     ** Your CLASSPATH environment variable appears to be set (some  **
51     ** JOAL demos' classes are currently visible to the build.)     **
52     ** This can cause the build to fail. Please unset your          **
53     ** CLASSPATH variable and restart the build.                    **
54     ******************************************************************
55         </fail>
56     </target>
57
58     <target name="init" depends="jogamp.env.init, gluegen.cpptasks.detect.os, java.class.path.validate, gluegen.cpptasks.detect.os">
59         <property name="joal-demos.version"  value="${jogamp.version.base}-${version.timestamp}" />
60
61         <property name="gluegen-rt.jar"      value="${gluegen.build}/gluegen-rt.jar" />
62         <property name="joal.jar"            value="${joal.build}/jar/joal.jar" />
63
64         <property name="src.dir"             value="../src/java" />
65         <property name="classes.dir"         value="${build}/classes" />
66         <property name="joal.demos.jar"      value="${build}/joal-demos.jar" />
67
68         <property name="archive.name"        value="joal-demos-${joal-demos.version}-${os.and.arch}" />
69         <property name="archive"             value="${build}/${archive.name}" />
70
71         <property name="obj.all.paths"        value="${gluegen.build}/obj${path.separator}${joal.build}/obj" />
72     </target>
73
74     <target name="all" depends="jar, tag.build, developer-zip-archive"/>
75
76     <!-- Build binary zip archives for developers -->
77     <target name="developer-zip-archive" depends="init" if="build.archiveon">
78         <!-- Clean up and create temporary directory -->
79         <delete includeEmptyDirs="true" quiet="true" dir="${archive}" failonerror="false" />
80         <mkdir dir="${archive}" />
81         <copy file="${build}/artifact.properties" todir="${archive}"/>
82         <mkdir dir="${archive}/jar" />
83         <copy todir="${archive}/jar">
84             <fileset dir="${build}" includes="*.jar"/>
85         </copy>
86         <mkdir dir="${archive}/jnlp-files" />
87         <copy todir="${archive}/jnlp-files">
88             <fileset dir="${project.root}/jnlp-files" includes="*" />
89         </copy>
90         <mkdir dir="${archive}/www" />
91         <copy todir="${archive}/www">
92             <fileset dir="${project.root}/www" includes="*" />
93         </copy>
94         <archive.7z destfile="${build}/${archive.name}.7z"
95              basedir="${build}"
96              includes="${archive.name}/**" />
97         <!-- Clean up after ourselves -->
98         <delete includeEmptyDirs="true" quiet="true" dir="${archive}" failonerror="false" />
99     </target>
100
101     <target name="tag.build">
102         <copy file="${gluegen.build}/artifact.properties" todir="${build}" overwrite="true"/>
103         <echo message='joal-demos.build.number=${joal-demos.build.number}${line.separator}' file="${build}/artifact.properties" append="true"/>
104         <echo message='joal-demos.build.id=${joal-demos.build.id}${line.separator}'         file="${build}/artifact.properties" append="true"/>
105         <echo message='joal-demos.build.branch=${joal-demos.build.branch}${line.separator}' file="${build}/artifact.properties" append="true"/>
106         <echo message='joal-demos.build.commit=${joal-demos.build.commit}${line.separator}' file="${build}/artifact.properties" append="true"/>
107     </target>
108
109     <target name="jar" depends="compile" description="Build JOAL demos jar file">
110         <jar manifest="manifest.mf" destfile="${joal.demos.jar}">
111             <fileset dir="${classes.dir}" />
112             <fileset dir="${src.dir}">
113                <include name="demos/data/**" />
114             </fileset>
115         </jar>
116     </target>
117
118     <target name="compile" depends="init">
119         <mkdir dir="${classes.dir}" />
120
121         <copy todir="${build}">
122             <fileset dir="${src.dir}/demos/lib" includes="j-ogg-*.jar" />
123         </copy>
124
125         <path id="joal.classpath">
126             <pathelement path="${classpath}" />
127             <pathelement location="${joal.jar}" />
128             <pathelement location="${build}/j-ogg-oggd.jar" />
129             <pathelement location="${build}/j-ogg-vorbisd.jar" />
130         </path>
131         <javac destdir="${classes.dir}" 
132                includeantruntime="false"
133                memoryMaximumSize="${javac.memorymax}"
134                encoding="UTF-8"
135                source="${target.sourcelevel}" 
136                target="${target.targetlevel}" 
137                bootclasspath="${target.rt.jar}"
138                debug="${javacdebug}" debuglevel="${javacdebuglevel}">
139             <src path="${src.dir}" />
140             <classpath refid="joal.classpath" />
141         </javac>
142     </target>
143
144     <target name="clean" depends="init">
145         <delete includeEmptyDirs="true" quiet="true">
146             <fileset dir="../${rootrel.build}" />
147         </delete>
148     </target>
149
150     <target name="lesson1" depends="jar" description="Run lesson1 (Single Static Source)">
151         <java classname="demos.devmaster.lesson1.SingleStaticSource" fork="true">
152             <env key="${system.env.library.path}" path="${obj.all.paths}"/>
153             <jvmarg value="-Djava.library.path=${obj.all.paths}"/>
154             <classpath>
155                 <pathelement location="${gluegen-rt.jar}" />
156                 <pathelement location="${joal.jar}" />
157                 <pathelement location="${joal.demos.jar}" />
158             </classpath>
159         </java>
160     </target>
161
162     <target name="lesson2" depends="jar" description="Run lesson2 (Looping and Fade Away)">
163         <java classname="demos.devmaster.lesson2.LoopingAndFadeaway" fork="true">
164             <env key="${system.env.library.path}" path="${obj.all.paths}"/>
165             <jvmarg value="-Djava.library.path=${obj.all.paths}"/>
166             <classpath>
167                 <pathelement location="${gluegen-rt.jar}" />
168                 <pathelement location="${joal.jar}" />
169                 <pathelement location="${joal.demos.jar}" />
170             </classpath>
171         </java>
172     </target>
173
174     <target name="lesson3" depends="jar" description="Run lesson3 (Multiple Sources)">
175         <java classname="demos.devmaster.lesson3.MultipleSources" fork="true">
176             <env key="${system.env.library.path}" path="${obj.all.paths}"/>
177             <jvmarg value="-Djava.library.path=${obj.all.paths}"/>
178             <classpath>
179                 <pathelement location="${gluegen-rt.jar}" />
180                 <pathelement location="${joal.jar}" />
181                 <pathelement location="${joal.demos.jar}" />
182             </classpath>
183         </java>
184     </target>
185
186     <target name="lesson5" depends="jar" description="Run lesson5 (Sources Sharing Buffers)">
187         <java classname="demos.devmaster.lesson5.SourcesSharingBuffers" fork="true">
188             <env key="${system.env.library.path}" path="${obj.all.paths}"/>
189             <jvmarg value="-Djava.library.path=${obj.all.paths}"/>
190             <classpath>
191                 <pathelement location="${gluegen-rt.jar}" />
192                 <pathelement location="${joal.jar}" />
193                 <pathelement location="${joal.demos.jar}" />
194             </classpath>
195         </java>
196     </target>
197
198     <target name="lesson8" depends="jar" description="Run lesson8 (Ogg/Vorbis Streaming)">
199         <java classname="demos.devmaster.lesson8.OggStreamer" fork="true">
200             <env key="${system.env.library.path}" path="${obj.all.paths}"/>
201             <jvmarg value="-Djava.library.path=${obj.all.paths}"/>
202             <classpath>
203                 <pathelement location="${gluegen-rt.jar}" />
204                 <pathelement location="${joal.jar}" />
205                 <pathelement location="${joal.demos.jar}" />
206                 <pathelement location="${build}/j-ogg-oggd.jar" />
207                 <pathelement location="${build}/j-ogg-vorbisd.jar" />
208             </classpath>
209         </java>
210     </target>
211  </project>
212
http://JogAmp.org git info: FAQ, tutorial and man pages.