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