Jogamp
Adapt to joal.jar location in ${joal.build}/jar/joal.jar
[joal-demos.git] / make / build.xml
CommitLineData
dd335a25 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">
5254fe67
SG
13 <property name="project.root" value=".." />
14
15 <condition property="rootrel.build" value="build">
0535d507
SG
16 <not>
17 <isset property="rootrel.build"/>
18 </not>
5254fe67
SG
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}" />
ad55cb01
SG
24 <!-- Pull in GlueGen cpptasks build file -->
25 <import file="${gluegen.root}/make/gluegen-cpptasks.xml" />
2221eac3 26 <import file="${gluegen.root}/make/jogamp-archivetasks.xml" />
3a1658a3 27 <import file="${gluegen.root}/make/jogamp-env.xml" />
5254fe67 28
3c93ac46
SG
29 <property name="joal.root" value="${project.root}/../joal" />
30 <property name="joal.build" value="${joal.root}/${rootrel.build}" />
31
5254fe67
SG
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"/>
0535d507 37
dd335a25 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
3a1658a3 58 <target name="init" depends="jogamp.env.init, gluegen.cpptasks.detect.os, java.class.path.validate, gluegen.cpptasks.detect.os">
4cbde3c7
SG
59 <property name="joal-demos.version" value="${jogamp.version.base}-${version.timestamp}" />
60
3c93ac46 61 <property name="gluegen-rt.jar" value="${gluegen.build}/gluegen-rt.jar" />
9a86b8e9 62 <property name="joal.jar" value="${joal.build}/jar/joal.jar" />
df97090f 63
c284d929 64 <property name="src.dir" value="../src/java" />
5254fe67
SG
65 <property name="classes.dir" value="${build}/classes" />
66 <property name="joal.demos.jar" value="${build}/joal-demos.jar" />
5254fe67 67
ad55cb01 68 <property name="archive.name" value="joal-demos-${joal-demos.version}-${os.and.arch}" />
5254fe67 69 <property name="archive" value="${build}/${archive.name}" />
3c93ac46
SG
70
71 <property name="obj.all.paths" value="${gluegen.build}/obj${path.separator}${joal.build}/obj" />
dd335a25 72 </target>
73
5254fe67
SG
74 <target name="all" depends="jar, tag.build, developer-zip-archive"/>
75
76 <!-- Build binary zip archives for developers -->
34fc1a7b 77 <target name="developer-zip-archive" depends="init" if="build.archiveon">
5254fe67
SG
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>
c99640cc 94 <archive.7z destfile="${build}/${archive.name}.7z"
5254fe67
SG
95 basedir="${build}"
96 includes="${archive.name}/**" />
97 <!-- Clean up after ourselves -->
98 <delete includeEmptyDirs="true" quiet="true" dir="${archive}" failonerror="false" />
99 </target>
df97090f 100
5254fe67
SG
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"/>
dd335a25 107 </target>
108
df97090f 109 <target name="jar" depends="compile" description="Build JOAL demos jar file">
e97c3336 110 <jar manifest="manifest.mf" destfile="${joal.demos.jar}">
df97090f 111 <fileset dir="${classes.dir}" />
c284d929 112 <fileset dir="${src.dir}">
df97090f 113 <include name="demos/data/**" />
114 </fileset>
115 </jar>
116 </target>
117
118 <target name="compile" depends="init">
119 <mkdir dir="${classes.dir}" />
120
5254fe67 121 <copy todir="${build}">
c284d929 122 <fileset dir="${src.dir}/demos/lib" includes="j-ogg-*.jar" />
5254fe67 123 </copy>
df97090f 124
125 <path id="joal.classpath">
126 <pathelement path="${classpath}" />
127 <pathelement location="${joal.jar}" />
5254fe67
SG
128 <pathelement location="${build}/j-ogg-oggd.jar" />
129 <pathelement location="${build}/j-ogg-vorbisd.jar" />
df97090f 130 </path>
8eda2ed6
SG
131 <javac destdir="${classes.dir}"
132 includeantruntime="false"
133 memoryMaximumSize="${javac.memorymax}"
ee2b3822 134 encoding="UTF-8"
8eda2ed6
SG
135 source="${target.sourcelevel}"
136 target="${target.targetlevel}"
137 bootclasspath="${target.rt.jar}"
138 debug="${javacdebug}" debuglevel="${javacdebuglevel}">
df97090f 139 <src path="${src.dir}" />
140 <classpath refid="joal.classpath" />
141 </javac>
142 </target>
143
dd335a25 144 <target name="clean" depends="init">
145 <delete includeEmptyDirs="true" quiet="true">
0535d507 146 <fileset dir="../${rootrel.build}" />
dd335a25 147 </delete>
148 </target>
df97090f 149
150 <target name="lesson1" depends="jar" description="Run lesson1 (Single Static Source)">
151 <java classname="demos.devmaster.lesson1.SingleStaticSource" fork="true">
3c93ac46
SG
152 <env key="${system.env.library.path}" path="${obj.all.paths}"/>
153 <jvmarg value="-Djava.library.path=${obj.all.paths}"/>
df97090f 154 <classpath>
3c93ac46 155 <pathelement location="${gluegen-rt.jar}" />
5254fe67
SG
156 <pathelement location="${joal.jar}" />
157 <pathelement location="${joal.demos.jar}" />
df97090f 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">
3c93ac46
SG
164 <env key="${system.env.library.path}" path="${obj.all.paths}"/>
165 <jvmarg value="-Djava.library.path=${obj.all.paths}"/>
df97090f 166 <classpath>
3c93ac46 167 <pathelement location="${gluegen-rt.jar}" />
5254fe67
SG
168 <pathelement location="${joal.jar}" />
169 <pathelement location="${joal.demos.jar}" />
df97090f 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">
3c93ac46
SG
176 <env key="${system.env.library.path}" path="${obj.all.paths}"/>
177 <jvmarg value="-Djava.library.path=${obj.all.paths}"/>
df97090f 178 <classpath>
3c93ac46 179 <pathelement location="${gluegen-rt.jar}" />
5254fe67
SG
180 <pathelement location="${joal.jar}" />
181 <pathelement location="${joal.demos.jar}" />
df97090f 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">
3c93ac46
SG
188 <env key="${system.env.library.path}" path="${obj.all.paths}"/>
189 <jvmarg value="-Djava.library.path=${obj.all.paths}"/>
df97090f 190 <classpath>
3c93ac46 191 <pathelement location="${gluegen-rt.jar}" />
5254fe67
SG
192 <pathelement location="${joal.jar}" />
193 <pathelement location="${joal.demos.jar}" />
df97090f 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">
3c93ac46
SG
200 <env key="${system.env.library.path}" path="${obj.all.paths}"/>
201 <jvmarg value="-Djava.library.path=${obj.all.paths}"/>
df97090f 202 <classpath>
3c93ac46 203 <pathelement location="${gluegen-rt.jar}" />
5254fe67
SG
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" />
df97090f 208 </classpath>
209 </java>
210 </target>
dd335a25 211 </project>
5254fe67 212
http://JogAmp.org git info: FAQ, tutorial and man pages.