Jogamp
0bbcf2ccdddc9fb640e22efa0e7e3c1e3aab7859
[jogl.git] / make / build-newt.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3    - Ant build for NEWT.  This build has been tested with ANT 1.7.0.  The
4    - optional.jar that contains the optional ANT tasks must be in the ANT
5    - classpath (typically the ant/lib directory).
6    -
7    - A clean download of NEWT is required for this build.
8    -
9    - This build has no dependence on environment variables; the needed
10    - ones (e.g. java.home, ANT_HOME) are all set by the Ant wrapper shell
11    - script, by the virtual machine, or elsewhere. However, on all platforms,
12    - the C compiler and linker should be in the path. All other paths that
13    - need to be set are in host.properties.
14    -
15    - NOTE:  because the GlueGen config files have their own relative paths
16    -        which cannot be overridden by GlueGen, GlueGen MUST be run from
17    -        the "make" directory. This also means that this build.xml MUST
18    -        be run from the "make" directory.
19    -
20    - Public targets:
21    -   all: (default; autodetects OS and chooses C compiler from newt.properties)
22    -   clean:        clean all built
23    -   javadoc:      create the standard developer Javadoc (recommended)
24    -                 (Note: should build all first - may be dependence in the future)
25    -   javadoc.spec: create the standard developer Javadoc but exclude com.sun.* classes
26    -   javadoc.dev:  create the internal developer Javadoc.  This includes the
27    -                       Java and C file generators. Note that it is only supported
28    -                       to create the Javadoc for the platform on which you are
29    -                       currently running.
30    -
31    - Note: on Windows the "win32.c.compiler" property in newt.properties
32    - is required to select the appropriate C compiler. See the example
33    - newt.properties in this directory for valid values. On Mac OS X
34    - universal binaries may also be built by setting the "macosxfat"
35    - property in newt.properties; again see the example file in this
36    - directory.
37    -
38    - Thanks to Rob Grzywinski and Artur Biesiadowski for the bulk of the
39    - ANT build, including the GlueGen and StaticGLInfo tasks, the building of
40    - the Java generated sources, the first and second phase Java compiles, and
41    - the building of the jar file. Thanks to Alex Radeski for the bulk of the
42    - port to the ant-contrib CPPTask framework. Thanks to Athomas Goldberg for
43    - the original OS detection code.
44    -
45    - Some environment defs affecting compilation
46
47    - Internal settings, may not be necessary to set them manually,
48      since all JAR archives are orthogonal.
49        setup.noCDC
50        setup.noAWT
51        setup.noOpenGL
52
53    - setup.nodesktop is set iff:
54         !isWindows && !isOSX && !isX11
55
56    -->
57 <project name="NEWT" basedir="." default="all">
58
59   <import file="versions.xml" />
60
61   <!-- Pull in GlueGen cpptasks build file -->
62   <property name="gluegen.root" value="../../gluegen" />
63   <import file="${gluegen.root}/make/gluegen-cpptasks.xml" />
64
65     <!-- ================================================================== -->
66     <!--
67        - Base initialization and detection of operating system.
68       -->
69     <target name="base.init" depends="gluegen.cpptasks.detect.os">
70
71         <property name="javac.bootclasspath-cdc.jar" value="${gluegen.root}/make/lib/cdc_fp.jar"/>
72
73         <condition property="setup.nodesktop">
74             <and>
75                 <isfalse value="${isWindows}" />
76                 <isfalse value="${isOSX}" />
77                 <isfalse value="${isX11}" />
78             </and>
79         </condition>
80
81         <condition property="setup.noall">
82             <isset property="setup.noAWT"/>
83         </condition>
84
85         <condition property="setup.nonatives">
86             <and>
87                 <isfalse value="${isWindows}" />
88                 <isfalse value="${isOSX}" />
89                 <isfalse value="${isX11}" />
90                 <isfalse value="${useKD}" />
91                 <isfalse value="${useIntelGDL}" />
92                 <isfalse value="${useBroadcomEGL}" />
93             </and>
94         </condition>
95
96         <echo message="setup.nonatives: ${setup.nonatives}" />
97         <echo message="setup.nodesktop: ${setup.nodesktop}" />
98         <echo message="setup.noall: ${setup.noall}" />
99         <echo message="setup.noCDC: ${setup.noCDC}" />
100         <echo message="setup.noAWT: ${setup.noAWT}" />
101         <echo message="setup.noOpenGL: ${setup.noOpenGL}" />
102         <echo message="javac.bootclasspath-cdc.jar: ${javac.bootclasspath-cdc.jar}" />
103         <echo message="isX11: ${isX11}" />
104         <echo message="useKD: ${useKD}" />
105         <echo message="useIntelGDL: ${useIntelGDL}" />
106         <echo message="useBroadcomEGL: ${useBroadcomEGL}" />
107
108         <!-- partitioning -->
109
110         <property name="java.part.core"
111                   value="com/jogamp/javafx/newt/*, com/jogamp/javafx/newt/util/*, com/jogamp/javafx/newt/impl/*, com/jogamp/javafx/newt/intel/gdl/*"/>
112
113         <property name="java.part.x11"
114                   value="com/jogamp/javafx/newt/x11/*"/>
115
116         <property name="java.part.windows"
117                   value="com/jogamp/javafx/newt/windows/*"/>
118
119         <property name="java.part.macosx"
120                   value="com/jogamp/javafx/newt/macosx/*"/>
121
122         <property name="java.part.opengl"
123                   value="com/jogamp/javafx/newt/opengl/*, com/jogamp/javafx/newt/opengl/kd/*"/>
124
125         <property name="java.part.broadcomegl"
126                   value="com/jogamp/javafx/newt/opengl/broadcom/egl/*"/>
127
128         <property name="java.part.awt"
129                   value="com/jogamp/javafx/newt/awt/*"/>
130
131         <!-- condition excludes -->
132
133         <condition property="java.excludes.awt"
134                    value="${java.part.awt}">
135            <isset property="setup.noAWT"/>
136         </condition>
137
138         <condition property="java.excludes.opengl"
139                    value="${java.part.opengl} ${java.part.broadcomegl}">
140            <isset property="setup.noOpenGL"/>
141         </condition>
142
143         <property name="java.excludes.cdcfp" value="${java.part.awt}"/>
144
145         <condition property="java.excludes.desktop"
146                    value="${java.part.x11} ${java.part.windows}, ${java.part.macosx}, ${java.part.awt}">
147            <isset property="setup.nodesktop"/>
148         </condition>
149
150         <property name="java.excludes.all" value="${java.excludes.awt}, ${java.excludes.opengl} ${java.excludes.desktop}" />
151         <echo message="java.excludes.all: ${java.excludes.all}" />
152
153
154         <!-- Set the project root directory to be up one directory. -->
155         <property name="project.root" value=".." />
156
157         <!-- Set the configuration and build files to this directory. -->
158         <property name="make" value="." />
159     </target>
160
161     <target name="base.init.sourcelevel.1">
162         <property name="newt.sourcelevel" value="1.4" />
163     </target>
164
165     <!--target name="base.init.sourcelevel.2" if="gluegen.nsig">
166         <property name="newt.sourcelevel" value="1.5" />
167     </target-->
168
169     <!-- ================================================================== -->
170     <!--
171        - Load user properties which override build defaults.
172       -->
173     <target name="load.user.properties" depends="base.init,base.init.sourcelevel.1" unless="user.properties.file">
174         <!-- Load the user specified properties file that defines various host
175            - specific paths.  The user will be notified if this is does not
176            - exist. -->
177         <property name="user.properties.file" value="${user.home}/newt.properties" />
178         <property file="${user.properties.file}" />
179         <echo message="Loaded ${user.properties.file}." />
180         <property file="${user.home}/gluegen.properties" />
181         <echo message="Loaded ${user.home}/gluegen.properties." />
182     </target>
183
184     <!-- ================================================================== -->
185     <!--
186        - Declare all paths and user defined variables.
187       -->
188     <target name="declare.common" description="Declare properties" depends="load.user.properties">
189         <!-- The location and name of the configuration ANT file that will
190            - validate to ensure that all user-define variables are set. -->
191         <property name="validate.user.properties" value="${make}/validate-properties.xml" />
192
193         <!-- NOTE: the value of the debug and optimise attributes will not be overridden if already set externally -->
194         <property name="javacdebug"       value="true" />
195         <property name="javacdebuglevel"  value="source,lines" />
196
197         <!-- Names of directories relative to the project root.
198              Some of these are used in FileMappers later for dependence information
199              and need exact string matching, which is why they use file.separator
200              instead of "/". -->
201         <condition property="rootrel.build" value="build">
202           <not>
203               <isset property="rootrel.build"/>
204           </not>
205         </condition>
206         <property name="rootrel.build.newt" value="${rootrel.build}/newt" />
207         <property name="rootrel.src" value="src/newt" />
208         <property name="rootrel.src.java" value="${rootrel.src}/classes" />
209         <property name="rootrel.src.c" value="${rootrel.src}/native" />
210         <property name="rootrel.obj" value="${rootrel.build.newt}/obj" />
211
212         <property name="gluegen-rt.jar" value="${gluegen.root}/${rootrel.build}/gluegen-rt.jar" />
213         <property name="nativewindow.core.jar" value="../${rootrel.build}/nativewindow/nativewindow.core.jar" />
214         <property name="nativewindow.x11.jar" value="../${rootrel.build}/nativewindow/nativewindow.x11.jar" />
215         <property name="nativewindow.awt.jar" value="../${rootrel.build}/nativewindow/nativewindow.awt.jar" />
216         <property name="jogl.core.jar" value="../${rootrel.build}/jogl/jogl.core.jar" />
217         <property name="jogl.egl.jar" value="../${rootrel.build}/jogl/jogl.egl.jar" />
218
219         <property name="gluegen-rt-cdc.jar" value="${gluegen.root}/${rootrel.build}/gluegen-rt-cdc.jar" />
220         <property name="nativewindow.core.cdc.jar" value="../${rootrel.build}/nativewindow/nativewindow.core.cdc.jar" />
221         <property name="nativewindow.x11.cdc.jar" value="../${rootrel.build}/nativewindow/nativewindow.x11.cdc.jar" />
222         <property name="jogl.core.cdc.jar" value="../${rootrel.build}/jogl/jogl.core.cdc.jar" />
223         <property name="jogl.egl.cdc.jar" value="../${rootrel.build}/jogl/jogl.egl.cdc.jar" />
224
225         <!-- The source directories. -->
226         <property name="src.java" value="${project.root}/${rootrel.src.java}" />
227         <property name="src.c"    value="${project.root}/${rootrel.src.c}" />
228         <property name="build"    value="${project.root}/${rootrel.build.newt}" />
229
230         <!-- The generated source directories. -->
231         <property name="src.generated" value="${build}/gensrc" />
232         <property name="src.generated.c" value="${src.generated}/native/newt" />
233
234         <!-- The compiler output directories. -->
235         <property name="classes" value="${build}/classes" />
236         <property name="classes-cdc" value="${build}/classes-cdc" />
237         <property name="obj"      value="${project.root}/${rootrel.obj}" />
238
239         <path id="nativewindow_gluegen_jogl.classpath">
240             <pathelement location="${gluegen-rt.jar}" />
241             <pathelement location="${nativewindow.core.jar}" />
242             <pathelement location="${nativewindow.x11.jar}" />
243             <pathelement location="${nativewindow.awt.jar}" />
244             <pathelement location="${jogl.core.jar}" />
245             <pathelement location="${jogl.egl.jar}" />
246         </path>
247
248         <path id="nativewindow_gluegen_jogl.classpath-cdc">
249             <pathelement location="${gluegen-rt-cdc.jar}" />
250             <pathelement location="${nativewindow.core.cdc.jar}" />
251             <pathelement location="${nativewindow.x11.cdc.jar}" />
252             <pathelement location="${jogl.core.cdc.jar}" />
253             <pathelement location="${jogl.egl.cdc.jar}" />
254         </path>
255
256         <!-- The resulting newt.jar. -->
257         <property name="newt.core.jar" value="${build}/newt.core.jar" />
258         <property name="newt.x11.jar"  value="${build}/newt.x11.jar" />
259         <property name="newt.win.jar"  value="${build}/newt.win.jar" />
260         <property name="newt.osx.jar"  value="${build}/newt.osx.jar" />
261         <property name="newt.ogl.jar"  value="${build}/newt.ogl.jar" />
262         <property name="newt.broadcomegl.jar"  value="${build}/newt.broadcomegl.jar" />
263         <property name="newt.awt.jar"  value="${build}/newt.awt.jar" />
264         <property name="newt.all.jar"  value="${build}/newt.all.jar" />
265         <property name="newt.all-noawt.jar"  value="${build}/newt.all-noawt.jar" />
266
267         <property name="newt.core.cdc.jar" value="${build}/newt.core.cdc.jar" />
268         <property name="newt.x11.cdc.jar"  value="${build}/newt.x11.cdc.jar" />
269         <property name="newt.win.cdc.jar"  value="${build}/newt.win.cdc.jar" />
270         <property name="newt.osx.cdc.jar"  value="${build}/newt.osx.cdc.jar" />
271         <property name="newt.ogl.cdc.jar"  value="${build}/newt.ogl.cdc.jar" />
272         <property name="newt.broadcomegl.cdc.jar"  value="${build}/newt.broadcomegl.cdc.jar" />
273         <property name="newt.all.cdc.jar" value="${build}/newt.all.cdc.jar" />
274
275         <!-- The javadoc dirs. -->
276         <property name="javadoc" value="${project.root}/javadoc_newt_public" />
277         <property name="javadoc.spec" value="${project.root}/javadoc_newt_spec" />
278         <property name="javadoc.dev" value="${project.root}/javadoc_newt_dev" />
279         <property name="javadoc.link" value="http://java.sun.com/j2se/1.4.2/docs/api/" />
280         <property name="javadoc.windowtitle" value="NEWT API -- ${newt_base_version} Specification" />
281         <property name="javadoc.overview" value="spec-overview.html" />
282         <property name="javadoc.spec.packagenames" value="com.jogamp.javafx.newt, com.jogamp.javafx.newt.opengl" />
283
284         <property name="javadoc.packagenames" value="${javadoc.spec.packagenames}" />
285
286         <property name="javadoc.dev.packagenames" value="${javadoc.packagenames},com.jogamp.javafx.newt.*" />
287     <property name="javadoc.bottom" value="Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to &lt;a href=&quot;http://jcp.org/en/jsr/detail?id=231&quot;&gt;license terms&lt;/a&gt;." />
288     </target>
289
290     <!-- ================================================================== -->
291     <!--
292        - Initialize all parameters required for the build and create any
293        - required directories.
294       -->
295     <target name="init" depends="declare.common">
296         <!-- Call the external config validator script to make sure the config is ok and consistent -->
297         <ant antfile="${validate.user.properties}" inheritall="true"/>
298
299         <mkdir dir="${src.generated.c}" />
300         <mkdir dir="${src.generated.c}/X11" />
301         <mkdir dir="${src.generated.c}/MacOSX" />
302         <mkdir dir="${src.generated.c}/Windows" />
303         <mkdir dir="${src.generated.c}/KD" />
304         <mkdir dir="${src.generated.c}/IntelGDL" />
305         <mkdir dir="${src.generated.c}/BroadcomEGL" />
306         <mkdir dir="${classes}" />
307         <mkdir dir="${classes-cdc}" />
308         <mkdir dir="${obj}" />
309     </target>
310
311     <!-- ================================================================== -->
312     <!--
313        - Compile the original and generated source.
314       -->
315     <target name="java.compile.javase">
316         <!-- Perform the second pass Java compile; everything. -->
317         <javac destdir="${classes}"
318                excludes="${java.excludes.all}"
319                source="${newt.sourcelevel}"
320                fork="yes"
321                memoryMaximumSize="128m"
322                debug="${javacdebug}" debuglevel="${javacdebuglevel}">
323             <src path="${src.java}" />
324             <classpath refid="nativewindow_gluegen_jogl.classpath"/>
325         </javac>
326     </target>
327
328     <target name="java.compile.javacdc" unless="setup.noCDC">
329         <!-- Perform the first pass Java compile; everything -->
330         <javac destdir="${classes-cdc}"
331                excludes="${java.excludes.all} ${java.excludes.cdcfp}"
332                source="${newt.sourcelevel}"
333                bootclasspath="${javac.bootclasspath-cdc.jar}"
334                fork="yes"
335                memoryMaximumSize="128m"
336                debug="${javacdebug}" debuglevel="${javacdebuglevel}">
337             <classpath refid="nativewindow_gluegen_jogl.classpath-cdc"/>
338             <src path="${src.java}" />
339         </javac>
340     </target>
341
342     <target name="java.compile" depends="java.compile.javase,java.compile.javacdc" />
343
344     <!-- ================================================================== -->
345     <!--
346        - Compile the native C code for JOGL (and optionally the Cg binding).
347       -->
348
349     <target name="c.configure.1" depends="gluegen.cpptasks.detect.os,gluegen.cpptasks.setup.compiler">
350       <!-- compiler configuration -->
351       <!-- Note that we can use the base setups in the gluegen-cpptasks for most of these -->
352
353       <compiler id="compiler.cfg.freebsd.newt" extends="compiler.cfg.freebsd">
354         <!-- Need to force X11R6 headers on to include path after stub_includes -->
355         <includepath path="/usr/X11R6/include" />
356       </compiler>
357
358       <!-- linker configuration -->
359
360       <linker id="linker.cfg.linux.newt.broadcom_egl" extends="linker.cfg.linux">
361         <syslibset dir="/nfsroot/lg/lib" libs="EGL"/>
362         <syslibset dir="/nfsroot/lg/lib" libs="GLES_CM"/>
363       </linker>
364
365       <linker id="linker.cfg.linux.newt.x11" extends="linker.cfg.linux">
366         <syslibset dir="/usr/X11R6/lib" libs="X11"/>
367         <syslibset dir="/usr/X11R6/lib" libs="Xxf86vm" />
368       </linker>
369
370       <linker id="linker.cfg.linux.amd64.newt.x11" extends="linker.cfg.linux.amd64">
371         <syslibset dir="/usr/X11R6/lib64" libs="X11"/>
372         <syslibset dir="/usr/X11R6/lib64" libs="Xxf86vm" />
373       </linker>
374
375       <linker id="linker.cfg.solaris.newt.x11" extends="linker.cfg.solaris">
376         <syslibset libs="X11"/>
377       </linker>
378
379       <linker id="linker.cfg.solaris.sparcv9.newt.x11" extends="linker.cfg.solaris.sparcv9">
380         <syslibset dir="/usr/lib/sparcv9" libs="X11"/>
381       </linker>
382
383       <linker id="linker.cfg.solaris.amd64.newt.x11" extends="linker.cfg.solaris.amd64">
384         <syslibset dir="/usr/lib/amd64" libs="X11"/>
385       </linker>
386
387       <linker id="linker.cfg.win32.mingw.newt" extends="linker.cfg.win32.mingw">
388         <linkerarg value="-Wl,--kill-at" />        <!-- remove @ from function names -->
389         <syslibset libs="gdi32, kernel32"/>
390       </linker>
391
392       <linker id="linker.cfg.win32.msvc.newt" extends="linker.cfg.win32.msvc">
393         <syslibset libs="gdi32, user32, kernel32" />
394       </linker>
395
396       <linker id="linker.cfg.macosx.newt" extends="linker.cfg.macosx">
397         <linkerarg value="-framework" />
398         <linkerarg value="Cocoa" />
399       </linker>
400
401       <linker id="linker.cfg.hpux.newt" extends="linker.cfg.hpux">
402         <syslibset dir="/usr/lib" libs="X11"/>
403       </linker>
404     </target>
405
406     <target name="c.configure.win32.vc" if="isVCFamily">
407       <echo message="Win32.VC" />
408       <property name="compiler.cfg.id"                      value="compiler.cfg.win32.msvc" />
409       <property name="linker.cfg.id.core"                   value="linker.cfg.win32.msvc" />
410       <property name="linker.cfg.id.oswin"                  value="linker.cfg.win32.msvc.newt" />
411     </target>
412
413     <target name="c.configure.win32.mingw" if="isMingW">
414       <echo message="Win32.MingW" />
415       <property name="compiler.cfg.id"                      value="compiler.cfg.win32.mingw" />
416       <property name="linker.cfg.id.core"                   value="linker.cfg.win32.mingw" />
417       <property name="linker.cfg.id.oswin"                  value="linker.cfg.win32.mingw.newt" />
418     </target>
419
420     <target name="c.configure.linux.x86" if="isLinuxX86">
421       <echo message="Linux.x86" />
422       <property name="compiler.cfg.id"                      value="compiler.cfg.linux" />
423       <property name="linker.cfg.id.core"                   value="linker.cfg.linux" />
424       <condition property="linker.cfg.id.oswin"             value="linker.cfg.linux.newt.x11"
425                                                             else="linker.cfg.linux">
426           <isset property="isX11" />
427       </condition>
428       <echo message="linker.cfg.id.oswin ${linker.cfg.id.oswin}" />
429     </target>
430
431     <target name="c.configure.linux.amd64" if="isLinuxAMD64">
432       <echo message="Linux.AMD64" />
433       <property name="compiler.cfg.id"                      value="compiler.cfg.linux.amd64" />
434       <property name="linker.cfg.id.core"                   value="linker.cfg.linux.amd64" />
435       <condition property="linker.cfg.id.oswin"             value="linker.cfg.linux.amd64.newt.x11"
436                                                             else="linker.cfg.linux.amd64">
437           <isset property="isX11" />
438       </condition>
439       <echo message="linker.cfg.id.oswin ${linker.cfg.id.oswin}" />
440     </target>
441
442     <target name="c.configure.linux.ia64" if="isLinuxIA64">
443       <echo message="Linux.IA64" />
444       <property name="compiler.cfg.id"                      value="compiler.cfg.linux" />
445       <property name="linker.cfg.id.core"                   value="linker.cfg.linux" />
446       <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.newt.x11" />
447     </target>
448
449     <target name="c.configure.linux" depends="c.configure.linux.x86,c.configure.linux.amd64,c.configure.linux.ia64,c.configure.x11" if="isLinux"/>
450
451     <target name="c.configure.solaris32" depends="c.configure.x11" if="isSolaris32Bit">
452       <echo message="Solaris" />
453       <property name="compiler.cfg.id"                      value="compiler.cfg.solaris" />
454       <property name="linker.cfg.id.core"                   value="linker.cfg.solaris" />
455       <property name="linker.cfg.id.oswin"                  value="linker.cfg.solaris.newt.x11" />
456     </target>
457
458
459     <target name="c.configure.solaris.sparcv9" depends="c.configure.x11" if="isSolarisSparcv9">
460       <echo message="SolarisSparcv9" />
461       <property name="compiler.cfg.id"                      value="compiler.cfg.solaris.sparcv9" />
462       <property name="linker.cfg.id.core"                   value="linker.cfg.solaris.sparcv9" />
463       <property name="linker.cfg.id.oswin"                  value="linker.cfg.solaris.sparcv9.newt.x11" />
464     </target>
465
466
467     <target name="c.configure.solaris.amd64" depends="c.configure.x11" if="isSolarisAMD64">
468       <echo message="SolarisAMD64" />
469       <property name="compiler.cfg.id"                      value="compiler.cfg.solaris.amd64" />
470       <property name="linker.cfg.id.core"                   value="linker.cfg.solaris.amd64" />
471       <property name="linker.cfg.id.oswin"                  value="linker.cfg.solaris.amd64.newt.x11" />
472     </target>
473
474     <target name="c.configure.freebsd" depends="c.configure.x11" if="isFreeBSD">
475       <echo message="FreeBSD" />
476       <property name="compiler.cfg.id"                      value="compiler.cfg.freebsd.newt" />
477       <property name="linker.cfg.id.core"                   value="linker.cfg.linux" />
478       <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.newt.x11" />
479     </target>
480
481     <target name="c.configure.hpux" depends="c.configure.x11" if="isHPUX">
482       <echo message="HP-UX" />
483       <property name="compiler.cfg.id"                      value="compiler.cfg.hpux" />
484       <property name="linker.cfg.id.core"                   value="linker.cfg.hpux" />
485       <property name="linker.cfg.id.oswin"                  value="linker.cfg.hpux.newt.x11" />
486     </target>
487
488     <target name="c.configure.win32" depends="c.configure.win32.vc,c.configure.win32.mingw" if="isWindows" />
489
490     <target name="c.configure.x11" if="isX11" />
491
492     <target name="c.configure.macosx" if="isOSX">
493       <property name="compiler.cfg.id"                      value="compiler.cfg.macosx" />
494       <property name="linker.cfg.id.core"                   value="linker.cfg.macosx" />
495       <property name="linker.cfg.id.oswin"                  value="linker.cfg.macosx.newt" />
496     </target>
497
498     <target name="c.configure.2" depends="c.configure.win32,c.configure.linux,c.configure.solaris32,c.configure.solaris.sparcv9,c.configure.solaris.amd64,c.configure.macosx,c.configure.freebsd,c.configure.hpux" />
499
500     <target name="c.configure" depends="c.configure.1,c.configure.2" />
501
502     <target name="rename.mingw.dll" if="isMingW">
503         <move file="${src}" tofile="${dest}" />
504     </target>
505
506     <target name="rename.dylib" if="isOSX">
507         <move file="${src}" tofile="${dest}" />
508         <copy file="${dest}" tofile="${dest-cdc}" />
509     </target>
510
511     <macrodef name="c.build">
512       <attribute name="c.compiler.src.files" />
513       <attribute name="compiler.cfg.id" />
514       <attribute name="linker.cfg.id" />
515       <attribute name="output.lib.name" />
516       <attribute name="c.compiler.use-jawt" default="false"/>
517       <sequential>
518         <echo message="Output lib name = @{output.lib.name}" />
519
520         <!-- NOTE: the value of the debug and optimise attributes will not be overridden if already set externally -->
521         <property name="c.compiler.debug"     value="false" />
522         <!-- Optimise flags one of { none, size, speed, minimal, full, aggressive, extreme, unsafe } -->
523         <property name="c.compiler.optimise"  value="none" />
524
525         <condition property="c.compiler.use-debug"><istrue value="${c.compiler.debug}"/></condition>
526
527         <patternset id="c.src.files.newt">
528           <include name="${rootrel.src.c}/WindowsWindow.c" if="isWindows"/>
529           <include name="${rootrel.src.c}/*.m" if="isOSX"/>
530           <include name="${rootrel.src.c}/X11Window.c" if="isX11"/>
531           <include name="${rootrel.src.c}/KDWindow.c"  if="useKD"/>
532           <include name="${rootrel.src.c}/IntelGDL.c"  if="useIntelGDL"/>
533           <include name="${rootrel.src.c}/BroadcomEGL.c"  if="useBroadcomEGL"/>
534         </patternset>
535
536         <echo message="Compiling @{output.lib.name}" />
537
538         <cc outtype="shared"
539             objdir="${obj}"
540             outfile="${obj}/@{output.lib.name}"
541             optimize="${c.compiler.optimise}"
542             debug="${c.compiler.debug}"
543             multithreaded="true"
544             exceptions="false"
545             rtti="false">
546
547           <!-- TODO: versioninfo  companyname="java.net"
548                         legalcopyright="Copyright"
549                         productname="JOGL"
550                         productversion="x.y.z"
551                         description="Description"
552                         fileversion="x.y.z"
553                         filecomments="File Comment" /-->
554
555           <fileset dir="${project.root}"><patternset refid="@{c.compiler.src.files}"/></fileset>
556
557           <compiler extends="@{compiler.cfg.id}" >
558             <sysincludepath path="${java.includes.dir}"/>
559             <sysincludepath path="${java.includes.dir.platform}"/>
560             <includepath path="stub_includes/egl"/>
561             <!-- This is for the generated headers for handwritten C code -->
562             <includepath path="${src.generated.c}" />
563             <includepath path="${src.generated.c}/X11" if="isX11"/>
564             <includepath path="${src.generated.c}/MacOSX" if="isOSX"/>
565             <includepath path="${src.generated.c}/Windows" if="isWindows"/>
566             <includepath path="${src.generated.c}/KD" if="useKD" />
567             <includepath path="${src.generated.c}/IntelGDL" if="useIntelGDL" />
568             <includepath path="stub_includes/embedded/IntelGDL" if="useIntelGDL" />
569             <includepath path="${src.generated.c}/BroadcomEGL" if="useBroadcomEGL" />
570
571             <!-- This must come last to not override real include paths -->
572             <!-- includepath path="stub_includes/macosx" if="isOSX" / -->
573           </compiler>
574
575           <linker extends="@{linker.cfg.id}">
576             <syslibset dir="${java.lib.dir.platform}" libs="jawt" if="@{output.lib.name}.useLibJAWT"/>
577             <syslibset dir="${java.lib.dir.platform}/server" libs="jvm" if="@{output.lib.name}.useLibJVM"/>
578           </linker>
579         </cc>
580
581         <!-- FIXME: this is a hack; the cpptask should have an option to change the
582              suffix or at least understand the override from dylib to jnilib -->
583         <antcall target="rename.dylib" inheritRefs="true">
584             <param name="src"  value="${build}/obj/lib@{output.lib.name}.dylib" />
585             <param name="dest" value="${build}/obj/lib@{output.lib.name}.jnilib" />
586             <param name="dest-cdc" value="${build}/obj/lib@{output.lib.name}.so" />
587         </antcall>
588
589         <!-- FIXME: this is a hack; the cpptask should have an option to change the
590              suffix or at least understand the override from dylib to jnilib -->
591         <antcall target="rename.mingw.dll" inheritRefs="true">
592             <param name="src"  value="${build}/obj/lib@{output.lib.name}.so" />
593             <param name="dest" value="${build}/obj/@{output.lib.name}.dll" />
594         </antcall>
595       </sequential>
596     </macrodef>
597
598     <target name="c.build.newt.prepare.KD" if="useKD">
599       <javah destdir="${src.generated.c}/KD" classpath="${classes}" class="com.jogamp.javafx.newt.opengl.kd.KDWindow" />
600     </target>
601
602     <target name="c.build.newt.prepare.IntelGDL" if="useIntelGDL">
603       <javah destdir="${src.generated.c}/IntelGDL" classpath="${classes}" class="com.jogamp.javafx.newt.intel.gdl.Display" />
604       <javah destdir="${src.generated.c}/IntelGDL" classpath="${classes}" class="com.jogamp.javafx.newt.intel.gdl.Screen" />
605       <javah destdir="${src.generated.c}/IntelGDL" classpath="${classes}" class="com.jogamp.javafx.newt.intel.gdl.Window" />
606     </target>
607
608     <target name="c.build.newt.prepare.BroadcomEGL" if="useBroadcomEGL">
609       <javah destdir="${src.generated.c}/BroadcomEGL" classpath="${classes}" class="com.jogamp.javafx.newt.opengl.broadcom.egl.Window" />
610     </target>
611
612     <target name="c.build.newt.prepare.desktop" unless="setup.nodesktop">
613       <javah destdir="${src.generated.c}/Windows" classpath="${classes}" class="com.jogamp.javafx.newt.windows.WindowsWindow" />
614       <javah destdir="${src.generated.c}/MacOSX" classpath="${classes}" class="com.jogamp.javafx.newt.macosx.MacWindow" />
615       <javah destdir="${src.generated.c}/X11" classpath="${classes}" class="com.jogamp.javafx.newt.x11.X11Window" />
616     </target>
617
618     <target name="c.build.newt.prepare" depends="c.build.newt.prepare.KD,c.build.newt.prepare.IntelGDL,c.build.newt.prepare.BroadcomEGL,c.build.newt.prepare.desktop" />
619
620     <target name="c.build.newt.windowlib" unless="setup.nonatives">
621       <c.build c.compiler.src.files="c.src.files.newt"
622                output.lib.name="newt"
623                compiler.cfg.id="${compiler.cfg.id}"
624                linker.cfg.id="${linker.cfg.id.oswin}"/>
625     </target>
626
627     <target name="c.manifest" if="isVC8Family">
628       <!-- exec mt, the Microsoft Manifest Tool, to include DLL manifests in order to resolve the location of msvcr80.dll -->
629       <msvc.manifest objdir="${obj}" dllname="newt" />
630     </target>
631
632     <target name="c.build.newt.natives" depends="c.build.newt.windowlib" unless="setup.nonatives">
633     </target>
634
635     <target name="c.build.newt" depends="c.configure,c.build.newt.prepare,c.build.newt.natives">
636       <antcall target="c.manifest" inheritRefs="true" />
637       <!-- Create the Java Web Start jar file for the built native code -->
638       <jar destfile="${build}/newt-natives-${os.and.arch}.jar" filesonly="true">
639         <fileset dir="${obj}">
640           <include name="*.${native.library.suffix}" />
641         </fileset>
642       </jar>
643       <jar destfile="${build}/newt-natives-${os.and.arch}-cdc.jar" filesonly="true">
644         <fileset dir="${obj}">
645           <include name="*.${native.library.suffix-cdc}" />
646         </fileset>
647       </jar>
648     </target>
649
650     <!-- ================================================================== -->
651     <!--
652        - Build the newt.jar files.
653       -->
654     <target name="jar" depends="java.compile,build-jars-javase,build-jars-cdc"/>
655
656     <target name="setup-manifestfile">
657         <condition property="manifestfile" value="newtRIversion">
658           <isset property="newt.ri" />
659         </condition>
660         <condition property="manifestfile" value="newtversion">
661           <not>
662             <isset property="newt.ri" />
663           </not>
664         </condition>
665         <tstamp>
666              <format property="timestamp" pattern="yyyyMMdd-HH:mm:ss"/>
667         </tstamp>
668         <copy file="${manifestfile}"
669           tofile="tempversion"
670           overwrite="true">
671           <filterset>
672               <filter token="VERSION" value="${newt_base_version}-pre-${timestamp}"/>
673               <filter token="BASEVERSION" value="${newt_base_version}"/>
674           </filterset>
675         </copy>
676     </target>
677
678     <target name="setup-manifestfile-cdc">
679         <condition property="manifestfile" value="newtRIversion-cdc">
680           <isset property="newt.ri" />
681         </condition>
682         <condition property="manifestfile" value="newtversion-cdc">
683           <not>
684             <isset property="newt.ri" />
685           </not>
686         </condition>
687         <tstamp>
688              <format property="timestamp" pattern="yyyyMMdd-HH:mm:ss"/>
689         </tstamp>
690         <copy file="${manifestfile}"
691           tofile="tempversion-cdc"
692           overwrite="true">
693           <filterset>
694               <filter token="VERSION" value="${newt_base_version}-pre-${timestamp}"/>
695               <filter token="BASEVERSION" value="${newt_base_version}"/>
696           </filterset>
697         </copy>
698     </target>
699
700     <target name="build-jars-awt" depends="setup-manifestfile" unless="setup.noAWT">
701         <jar manifest="tempversion" destfile="${newt.awt.jar}" filesonly="true">
702             <fileset dir="${classes}"
703                      includes="${java.part.awt}"/>
704         </jar>
705     </target>
706
707     <target name="build-jars-opengl" depends="setup-manifestfile" unless="setup.noOpenGL">
708         <jar manifest="tempversion" destfile="${newt.ogl.jar}" filesonly="true">
709             <fileset dir="${classes}"
710                      includes="${java.part.opengl}"/>
711         </jar>
712         <jar manifest="tempversion" destfile="${newt.broadcomegl.jar}" filesonly="true">
713             <fileset dir="${classes}"
714                      includes="${java.part.broadcomegl}"/>
715         </jar>
716     </target>
717
718     <target name="build-jars-opengl-cdc" depends="setup-manifestfile-cdc" unless="setup.noOpenGL">
719         <jar manifest="tempversion-cdc" destfile="${newt.ogl.cdc.jar}" filesonly="true">
720             <fileset dir="${classes-cdc}"
721                      includes="${java.part.opengl}"/>
722         </jar>
723         <jar manifest="tempversion-cdc" destfile="${newt.broadcomegl.cdc.jar}" filesonly="true">
724             <fileset dir="${classes-cdc}"
725                      includes="${java.part.broadcomegl}"/>
726         </jar>
727     </target>
728
729     <target name="build-jars-desktop" depends="setup-manifestfile" unless="setup.nodesktop">
730         <jar manifest="tempversion" destfile="${newt.x11.jar}" filesonly="true">
731             <fileset dir="${classes}"
732                      includes="${java.part.x11}"/>
733         </jar>
734         <jar manifest="tempversion" destfile="${newt.win.jar}" filesonly="true">
735             <fileset dir="${classes}"
736                      includes="${java.part.windows}"/>
737         </jar>
738         <jar manifest="tempversion" destfile="${newt.osx.jar}" filesonly="true">
739             <fileset dir="${classes}"
740                      includes="${java.part.macosx}"/>
741         </jar>
742     </target>
743
744     <target name="build-jars-desktop-cdc" depends="setup-manifestfile-cdc" unless="setup.nodesktop">
745         <jar manifest="tempversion-cdc" destfile="${newt.x11.cdc.jar}" filesonly="true">
746             <fileset dir="${classes-cdc}"
747                      includes="${java.part.x11}"/>
748         </jar>
749         <jar manifest="tempversion-cdc" destfile="${newt.win.cdc.jar}" filesonly="true">
750             <fileset dir="${classes-cdc}"
751                      includes="${java.part.windows}"/>
752         </jar>
753         <jar manifest="tempversion-cdc" destfile="${newt.osx.cdc.jar}" filesonly="true">
754             <fileset dir="${classes-cdc}"
755                      includes="${java.part.macosx}"/>
756         </jar>
757     </target>
758
759     <target name="build-jars-all-awt" depends="setup-manifestfile" unless="setup.noall">
760         <jar manifest="tempversion" destfile="${newt.all.jar}" filesonly="true">
761             <fileset dir="${classes}"
762                      includes="com/jogamp/javafx/newt/**" />
763         </jar>
764     </target>
765
766     <target name="build-jars-all-noawt" depends="setup-manifestfile">
767         <jar manifest="tempversion" destfile="${newt.all-noawt.jar}" filesonly="true">
768             <fileset dir="${classes}"
769                      includes="com/jogamp/javafx/newt/**"
770                      excludes="${java.part.awt}" />
771         </jar>
772     </target>
773
774     <target name="build-jars-all-cdc" depends="setup-manifestfile-cdc">
775         <jar manifest="tempversion-cdc" destfile="${newt.all.cdc.jar}" filesonly="true">
776             <fileset dir="${classes-cdc}"
777                      includes="com/jogamp/javafx/newt/**"
778                      excludes="${java.excludes.cdcfp}" />
779         </jar>
780     </target>
781
782     <target name="build-jars-javase" depends="setup-manifestfile,build-jars-awt,build-jars-opengl,build-jars-all-noawt,build-jars-all-awt,build-jars-desktop">
783         <jar manifest="tempversion" destfile="${newt.core.jar}" filesonly="true">
784             <fileset dir="${classes}"
785                      includes="${java.part.core}"/>
786         </jar>
787         <delete file="tempversion"/>
788     </target>
789
790     <target name="build-jars-cdc" depends="setup-manifestfile-cdc,build-jars-opengl-cdc,build-jars-all-cdc,build-jars-desktop-cdc" unless="setup.noCDC">
791         <jar manifest="tempversion-cdc" destfile="${newt.core.cdc.jar}" filesonly="true">
792             <fileset dir="${classes-cdc}"
793                      includes="${java.part.core}"/>
794         </jar>
795     </target>
796
797     <!-- ================================================================== -->
798     <!--
799        - Build the Javadocs for the sources.
800        - NOTE:  these are not entirely correct as the javadocs targets depend
801        -        on the platform specific build targets.  To circumvent any
802        -        errors, ensure that the source is built first.
803       -->
804     <target name="javadoc" depends="load.user.properties,init">
805         <!-- Build the general Javadoc -->
806         <javadoc packagenames="${javadoc.packagenames}"
807                  excludepackagenames="${java.excludes.javadoc.packagenames}"
808                  sourcepath="${src.java};${src.generated.java}"
809                  destdir="${javadoc}" windowtitle="${javadoc.windowtitle}"
810                  overview="${javadoc.overview}"
811                  source="1.4"
812                  linkoffline="${javadoc.link} 142-packages"
813          bottom="${javadoc.bottom}" >
814          <classpath refid="nativewindow_gluegen_jogl.classpath"/>
815         </javadoc>
816     </target>
817
818     <target name="javadoc.spec" depends="load.user.properties,init">
819         <!-- Build the general Javadoc -->
820         <javadoc packagenames="${javadoc.spec.packagenames}"
821                  excludepackagenames="${java.excludes.javadoc.packagenames}"
822                  sourcepath="${src.java};${src.generated.java}"
823                  destdir="${javadoc.spec}" windowtitle="${javadoc.windowtitle}"
824                  overview="${javadoc.overview}"
825                  source="1.4"
826                  linkoffline="${javadoc.link} 142-packages"
827                  bottom="${javadoc.bottom}" >
828          <classpath refid="nativewindow_gluegen_jogl.classpath"/>
829         </javadoc>
830     </target>
831
832     <target name="javadoc.dev" depends="load.user.properties,init">
833         <!-- Build the internal developer Javadoc -->
834         <javadoc packagenames="${javadoc.dev.packagenames}"
835                  excludepackagenames="${java.excludes.javadoc.packagenames}"
836                  sourcepath="${src.java};${src.generated.java}"
837                  destdir="${javadoc.dev}" windowtitle="${javadoc.windowtitle}"
838                  overview="${javadoc.overview}"
839                  source="1.4"
840                  linkoffline="${javadoc.link} 142-packages"
841          bottom="${javadoc.bottom}" >
842          <classpath refid="nativewindow_gluegen_jogl.classpath"/>
843         </javadoc>
844     </target>
845
846     <target name="all.doc" description="Build NEWT docs" depends="init,javadoc,javadoc.spec,javadoc.dev" />
847
848     <!-- ================================================================== -->
849     <!--
850        - Clean up all that is built.
851       -->
852     <target name="clean" description="Remove all build products" depends="declare.common">
853         <delete includeEmptyDirs="true" quiet="true">
854             <fileset dir="${build}" />
855             <fileset dir="${javadoc}" />
856             <fileset dir="${javadoc.spec}" />
857             <fileset dir="${javadoc.dev}" />
858         </delete>
859     </target>
860
861     <!-- ================================================================== -->
862     <!--
863        - Build everything.
864       -->
865     <target name="all" description="Build NEWT JAR file(s) and native libraries." depends="load.user.properties,init,jar,c.build.newt,generate.version.txt" />
866
867     <target name="setup-version-RI" if="newt.ri">
868         <property name="tmp.version" value="${newt_base_version}" />
869     </target>
870
871     <target name="setup-version-non-RI" unless="newt.ri">
872         <tstamp>
873              <format property="version.timestamp" pattern="yyyyMMdd"/>
874         </tstamp>
875         <property name="tmp.version" value="${newt_base_version}-pre-${version.timestamp}" />
876     </target>
877
878     <target name="generate.version.txt" depends="setup-version-RI,setup-version-non-RI">
879         <!-- Create a version.txt file indicating which version we just built -->
880         <echo message="${tmp.version}" file="${build}/version.txt" />
881     </target>
882
883     <!-- ================================================================== -->
884     <!--
885        - Build everything and use Sun's Implementation tag in the manifest to
886        - indicate this is the Reference Implementation.
887       -->
888     <target name="RI">
889         <!-- Set property for using the RI manifest file so newt.jar is versioned
890            - properly
891           -->
892           <property name="newt.ri" value="true" />
893           <antcall target="all" inheritRefs="true" />
894     </target>
895 </project>
http://JogAmp.org git info: FAQ, tutorial and man pages.