c7af692af79c9fa3dca15d3d34735491397cab5c
[scilab.git] / scilab / modules / scirenderer / build.xml
1         <project name="scirenderer" default="jar">
2     
3     
4     
5     <property file="scirenderer-version.properties"/>
6     
7     <!-- Scirenderer is built from Scilab itself -->
8     <condition property="dependencies.prop" value="../../scilab-lib.properties">
9         <isset property="fromScilab" />
10     </condition>
11     
12     <!-- Scirenderer is built as a thirdparty application -->
13     <condition property="dependencies.prop" value="scirenderer-libs.properties">
14         <not>
15             <isset property="fromScilab"/>
16         </not>
17     </condition>
18     
19     <property file="${dependencies.prop}"/>
20     
21     <!-- Scirenderer is built from Scilab itself -->
22     <property name="library.noversion.name" value="scirenderer.jar" />
23     
24     <!-- Scirenderer is built as a thirdparty application -->
25     <condition property="library.name" value="scirenderer-${version}.jar">
26         <not>
27             <isset property="fromScilab"/>
28         </not>
29     </condition>
30     
31     <echo message="Using:" />
32     <echo message="${thirdparty.dir}"/>
33     <echo message="${jogl2.jar}"/>
34     <echo message="${gluegen2.jar}"/>
35     <echo message="${jlatexmath.jar}"/>
36     
37     <description>
38         Build scirenderer
39     </description>
40     
41     <!-- Where the module should be created (modules/xxx/jar) -->
42     <property name="build.jar.dir"  value="jar/" />
43     
44     <property name="library.jar" value="${build.jar.dir}/${library.name}" />
45     <property name="library.noversion.jar" value="${build.jar.dir}/${library.noversion.name}" />
46     
47     <!-- The building directory -->
48     <property name="build.dir" location="build/"/>
49     
50     <!-- The building example directory -->
51     <property name="build.example.dir" location="build-example/"/>
52     
53     <!-- The building document directory -->
54     <property name="doc.dir" location="docs/"/>
55     
56     
57     <!-- The building test directory -->
58     <property name="build.test.dir" location="build/test"/>
59     
60     <!-- Where built classes will be generated -->
61     <property name="classes.dir" location="${build.dir}/classes" />
62     
63     <!-- Where built test classes will be generated -->
64     <property name="classes.test.dir" location="${build.test.dir}/" />
65     
66     <!-- Where we store cache files -->
67     <property name="cache.dir" location="${build.dir}/cachefile" />
68     
69     <!-- Where we can find the sources -->
70     <property name="src.dir"  location="src/" />
71     
72     <!-- Where we can find the sources -->
73     <property name="src.examples.dir"  location="examples/" />
74     
75     <path id="compile.classpath">
76         <pathelement location="${jogl2.jar}"/>
77         <pathelement location="${gluegen2.jar}"/>
78         <pathelement location="${jlatexmath.jar}"/>
79     </path>
80     
81     <target name="init">
82         <mkdir dir="${classes.dir}"/>
83         <mkdir dir="${classes.test.dir}"/>
84         <mkdir dir="${build.jar.dir}"/>
85         <!-- Create the time stamp -->
86         <tstamp/>
87     </target>
88     
89     <!-- Clean sources -->
90     <target name="clean" description="Clean built files" depends="clean-test">
91         <delete dir="${build.dir}"/>
92         <delete dir="${build.example.dir}"/>
93         <delete dir="${build.jar.dir}"/>
94         <delete dir="${doc.dir}"/>
95         <delete file="${library.jar}"/>
96     </target>
97     
98     <!-- Clean test -->
99     <target name="clean-test" description="Clean test files">
100         <delete dir="${build.test.dir}"/>
101     </target>
102     
103     <!-- Compile sources -->
104     <target name="compile" description="Build sources" depends="init">
105         <javac
106        srcdir="${src.dir}"
107        destdir="${classes.dir}"
108        classpathref="compile.classpath"
109        deprecation="on"
110        debug="off"
111        verbose="off"
112        listfiles="on"
113        includeAntRuntime="no"
114        source="6"
115        target="6"
116        >
117             <compilerarg value="-Xlint"/>
118         </javac>
119     </target>
120     
121     <!-- Compile examples -->
122     <target name="compile-examples" description="Build the examples" depends="compile">
123         <javac
124        srcdir="${src.examples.dir}"
125        destdir="${classes.dir}"
126        classpathref="compile.classpath"
127        deprecation="on"
128        debug="off"
129        verbose="off"
130        listfiles="on"
131        includeAntRuntime="no"
132        source="6"
133        target="6"
134        >
135             <compilerarg value="-Xlint"/>
136         </javac>
137     </target>
138     
139     <target name="existing-tests">
140         <available property="test-present"
141                file="${src.examples.dir}"
142                />
143     </target>
144     
145     <!-- Compile test sources -->
146     <target name="compile-test" description="Build tests" depends="existing-tests, jar" if="test-present">
147         <mkdir dir="${build.test.dir}"/>
148         
149         <!-- clean the test to make sure it will build properly -->
150         <javac
151        srcdir="${src.examples.dir}"
152        destdir="${classes.test.dir}"
153        deprecation="on"
154        debug="off"
155        verbose="off"
156        listfiles="on"
157        includeAntRuntime="no"
158        source="5"
159        >
160             <classpath>
161                 <path refid="compile.classpath" />
162                 <path location="${library.jar}" />
163             </classpath>
164         </javac>
165     </target>
166     
167     <!-- Create the jar -->
168     <target name="jar" description="Build the jar file" depends="compile">
169         
170         <jar destfile="${library.jar}" basedir="${classes.dir}">
171             <manifest>
172                 <attribute name="Class-Path" value="jogl2.jar gluegen2.jar"/>
173             </manifest>
174         </jar>
175     </target>
176     
177     <!-- Create the jar without the extension -->
178     <target name="noversion" description="Build the jar file without version" depends="compile">
179         
180         <antcall target="jar">
181             <param name="library.jar" value="${library.noversion.jar}"/>
182         </antcall>
183     </target>
184     
185     <target name="doc">
186         <javadoc
187            destdir="${doc.dir}"
188            author="true"
189            version="true"
190            use="true"
191            windowtitle="SciRenderer API">
192             <packageset dir="src" defaultexcludes="yes">
193                 <include name="org/**"/>
194             </packageset>
195         </javadoc>
196     </target>
197     
198     <target name="all" depends="jar, doc" />
199     
200     <target name="list-example" description="List all examples available">
201         <echo message="Examples available :"/>
202         <echo message=""/>
203         <echo message="    plot2d"/>
204         <echo message="    lightenedrotatingcube"/>
205         <echo message="    linerendering"/>
206         <echo message="    milkdrop"/>
207         <echo message="    simplerotatingcube"/>
208         <echo message="    clipping"/>
209         <echo message="    JLatexMath"/>
210     </target>
211     
212     <target name="all-examples" description="Launch all examples" depends="
213     example-lightened-cube,
214     example-plot2d,
215     example-chicken-pox-cube,
216     example-clipped-tetrahedron,
217     example-jLatex-math,
218     example-line-rendering,
219     example-milk-drop,
220     example-sprite,
221     example-rotatable-sprite,
222     example-ruler,
223     example-texture
224     "/>
225     
226     <target name="example-plot2d" description="Scilab Like Plot2d Example">
227         <antcall target="check">
228             <param name="ClassName" value="org.scilab.forge.scirenderer.examples.ScilabLikePlot2D"/>
229         </antcall>
230     </target>
231     
232     <target name="example-lightened-cube" description="Lightened Rotating Cube Example">
233         <antcall target="check">
234             <param name="ClassName" value="org.scilab.forge.scirenderer.examples.LightenedCube" />
235         </antcall>
236     </target>
237     
238     <target name="example-line-rendering" description="Line Rendering Example">
239         <antcall target="check">
240             <param name="ClassName" value="org.scilab.forge.scirenderer.examples.LineRendering" />
241         </antcall>
242     </target>
243     
244     <target name="example-milk-drop" description="Milk Drop Example">
245         <antcall target="check">
246             <param name="ClassName" value="org.scilab.forge.scirenderer.examples.MilkDrop" />
247         </antcall>
248     </target>
249     
250     <target name="example-chicken-pox-cube" description="Cube With Chicken Pox Example">
251         <antcall target="check">
252             <param name="ClassName" value="org.scilab.forge.scirenderer.examples.ChickenPoxCube" />
253         </antcall>
254     </target>
255     
256     <target name="example-clipped-tetrahedron" description="Clipping Example">
257         <antcall target="check">
258             <param name="ClassName" value="org.scilab.forge.scirenderer.examples.ClippedTetrahedron" />
259         </antcall>
260     </target>
261     
262     <target name="example-sprite" description="Sprite Example">
263         <antcall target="check">
264             <param name="ClassName" value="org.scilab.forge.scirenderer.examples.Sprites" />
265         </antcall>
266     </target>
267     
268     <target name="example-rotatable-sprite" description="Rotatable Sprite Example">
269         <antcall target="check">
270             <param name="ClassName" value="org.scilab.forge.scirenderer.examples.RotatableSprite" />
271         </antcall>
272     </target>
273     
274     <target name="example-jLatex-math" description="JLatexMath editor Example">
275         <antcall target="check">
276             <param name="ClassName" value="org.scilab.forge.scirenderer.examples.JLatexMath" />
277         </antcall>
278     </target>
279     
280     <target name="example-ruler" description="Ruler Example">
281         <antcall target="check">
282             <param name="ClassName" value="org.scilab.forge.scirenderer.examples.SimpleRuler" />
283         </antcall>
284     </target>
285     
286     <target name="example-texture" description="Texture Example">
287         <antcall target="check">
288             <param name="ClassName" value="org.scilab.forge.scirenderer.examples.TextureExample" />
289         </antcall>
290     </target>
291     
292     <target name="example-JScrollPane" description="JScrollPane Example">
293         <antcall target="check">
294             <param name="ClassName" value="org.scilab.forge.scirenderer.examples.JScrollPaneExample" />
295         </antcall>
296     </target>
297     
298     <target name="check" description="Launch some Examples" depends="jar, compile-test">
299         <fail unless="ClassName" message="check should not be called directly. Please use all-examples"/>
300         <java ClassName="${ClassName}" fork="yes">
301             <classpath>
302                 <pathelement path="${jogl2.jar}"/>
303                 <pathelement path="${gluegen2.jar}"/>
304                 <pathelement path="${jlatexmath.jar}"/>
305                 <pathelement path="${library.jar}"/>
306                 <pathelement path="${build.test.dir}"/>
307             </classpath>
308             <jvmarg value="-Djava.library.path=${jni.path}"/>
309         </java>
310     </target>
311     
312 </project>