summaryrefslogtreecommitdiffstats
path: root/make/build-nativewindow.xml
blob: e682bc68e6698f729acc60963460d948a9b40050 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
<?xml version="1.0" encoding="UTF-8"?>
<!--
   - Ant build for the NativeWindow package.  This build has been tested with ANT 1.7.0.  The
   - optional.jar that contains the optional ANT tasks must be in the ANT
   - classpath (typically the ant/lib directory).
   -
   - A clean download of the NativeWindow sources is required for this build.
   -
   - This build has no dependence on environment variables; the needed
   - ones (e.g. java.home, ANT_HOME) are all set by the Ant wrapper shell
   - script, by the virtual machine, or elsewhere. However, on all platforms,
   - the C compiler and linker should be in the path. All other paths that
   - need to be set are in host.properties.
   -
   - NOTE:  because the GlueGen config files have their own relative paths
   -        which cannot be overridden by GlueGen, GlueGen MUST be run from
   -        the "make" directory. This also means that this build.xml MUST
   -        be run from the "make" directory.
   -
   - Public targets:
   -   all: (default; autodetects OS and chooses C compiler from gluegen.properties)
   -   clean:        clean all built
   -   javadoc:      create the standard developer Javadoc (recommended)
   -                 (Note: should build all first - may be dependence in the future)
   -   javadoc.spec: create the standard developer Javadoc but exclude com.jogamp.* classes
   -   javadoc.dev:  create the internal developer Javadoc.  This includes the
   -                       Java and C file generators. Note that it is only supported
   -                       to create the Javadoc for the platform on which you are
   -                       currently running.
   - 
   - Note: on Windows the "win32.c.compiler" property in gluegen.properties
   - is required to select the appropriate C compiler. See the example
   - gluegen.properties in the gluegen workspace for valid values. On Mac OS X
   - universal binaries may also be built by setting the "macosxfat"
   - property in gluegen.properties; again see the example file in this
   - directory.
   -   
   - Thanks to Rob Grzywinski and Artur Biesiadowski for the bulk of the
   - ANT build, including the GlueGen tasks, the building of
   - the Java generated sources, the first and second phase Java compiles, and
   - the building of the jar file. Thanks to Alex Radeski for the bulk of the
   - port to the ant-contrib CPPTask framework. Thanks to Athomas Goldberg for
   - the original OS detection code.
   -
   - Some environment defs affecting native compilation
       setup.noNativeAWT

   - Internal settings, may not be necessary to set them manually,
     since all JAR archives are orthogonal.
       setup.noAWT
   -->
<project name="NativeWindow" basedir="." default="all">

    <import file="build-common.xml"/>

	<!-- needed for outofdate task -->
    <taskdef resource="net/sf/antcontrib/antlib.xml">
      <classpath> <pathelement location="${ant-contrib.jar}"/> </classpath>
    </taskdef>

	<!-- ================================================================== -->
    <!-- 
       - Base initialization and detection of operating system.
      -->
    <target name="base.init" depends="common.init">

        <!-- partitioning -->

        <property name="java.part.core"
                  value="com/jogamp/nativewindow/* com/jogamp/nativewindow/util/* com/jogamp/nativewindow/egl/* com/jogamp/nativewindow/swt/** com/jogamp/nativewindow/javafx/** jogamp/nativewindow/*"/>

        <property name="java.part.swt"
                  value="com/jogamp/nativewindow/swt/*"/>

        <property name="java.part.awt"
                  value="com/jogamp/nativewindow/awt/* jogamp/nativewindow/jawt/** jogamp/nativewindow/**/awt/**"/>

        <property name="java.part.drm"
                  value="com/jogamp/nativewindow/drm/* jogamp/nativewindow/drm/*" />

        <property name="java.part.x11"
                  value="com/jogamp/nativewindow/x11/* jogamp/nativewindow/x11/*" />

        <property name="java.part.windows"
                  value="com/jogamp/nativewindow/windows/* jogamp/nativewindow/windows/*" />

        <property name="java.part.macosx"
                  value="com/jogamp/nativewindow/macosx/* jogamp/nativewindow/macosx/*" />

        <property name="java.part.ios"
                  value="com/jogamp/nativewindow/ios/* jogamp/nativewindow/ios/*" />

        <!-- condition excludes -->

        <condition property="java.excludes.awt" value="${java.part.awt}">
           <isset property="setup.noAWT"/> 
        </condition>

        <property name="java.excludes.all" value="${java.excludes.awt}" />
        <echo message="java.excludes.all: ${java.excludes.all}" />
    </target>


    <!-- ================================================================== -->
    <!-- 
       - Declare all paths and user defined variables.
      -->
    <target name="declare.common" description="Declare properties" depends="base.init">

        <property name="config.nativewindow" value="${config}/nativewindow" />

        <property name="rootrel.src" value="src/nativewindow" />
        <property name="rootrel.src.java" value="${rootrel.src}/classes" />
        <property name="rootrel.src.c" value="${rootrel.src}/native" />

        <property name="rootrel.src.generated" value="${rootrel.build}/nativewindow/gensrc" />
        <property name="rootrel.generated.c" value="${rootrel.src.generated}/native" />

        <!-- The source directories. -->
        <property name="src.java" value="${project.root}/${rootrel.src.java}" />
        <property name="src.c"    value="${project.root}/${rootrel.src.c}" />
        
        <!-- The generated source directories. -->
        <property name="src.generated" value="${build.nativewindow}/gensrc" />
        <property name="src.generated.java" value="${src.generated}/classes" />
        <property name="src.generated.c" value="${src.generated}/native" />
        
        <!-- The compiler output directories. -->
        <property name="classes" value="${build.nativewindow}/classes" />

        <!-- The headers from which Java files are generated -->
        <dirset id="stub.includes.fileset.all" dir=".">
            <include name="${stub.includes}/macosx/**" />
            <include name="${stub.includes}/win32/**" />
            <include name="${stub.includes}/x11/**" />
            <include name="${stub.includes}/khr/**" />
            <include name="${stub.includes.gluegen}/jni/**" />
        </dirset>
        <fileset id="stub.includes.dependencies.fileset.1" dir="${stub.includes}">
            <include name="macosx/**" />
            <include name="win32/**" />
            <include name="x11/**" />
            <include name="common/**" />
        </fileset>
        <fileset id="stub.includes.dependencies.fileset.2" file="${gluegen.jar}" />
        <fileset id="stub.includes.dependencies.fileset.3" dir="${config.nativewindow}">
            <include name="*.cfg" />
            <include name="*.java" />
            <include name="*.c" />
        </fileset>
        <fileset id="stub.includes.dependencies.fileset.4" dir="${stub.includes.gluegen}">
            <include name="jni/**" />
        </fileset>

        <!-- The javadoc dirs. -->
        <property name="javadoc" value="${project.root}/javadoc_nativewindow_public" />
        <property name="javadoc.spec" value="${project.root}/javadoc_nativewindow_spec" />
        <property name="javadoc.dev" value="${project.root}/javadoc_nativewindow_dev" />
        <property name="javadoc.windowtitle" value="Native Windowing Interface (NativeWindow) API -- ${jogamp.version.base} Specification" />
        <property name="javadoc.overview" value="../src/nativewindow/classes/com/jogamp/nativewindow/package.html" />
        <property name="javadoc.spec.packagenames" value="com.jogamp.nativewindow.*" />

        <property name="javadoc.packagenames" value="${javadoc.spec.packagenames}" />

        <property name="javadoc.dev.packagenames" value="${javadoc.packagenames},com.jogamp.nativewindow.util.*,jogamp.nativewindow.*,com.jogamp.gluegen,com.jogamp.gluegen.runtime" />
    <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;." />
    </target>
    
    <!-- ================================================================== -->
    <!-- 
       - Initialize all parameters required for the build and create any
       - required directories.
      -->
    <target name="init" depends="declare.common">
        <!-- Create the required output directories. -->
        <mkdir dir="${src.generated.java}" />
        <mkdir dir="${src.generated.c}" />
        <mkdir dir="${src.generated.c}/MacOSX" />
        <mkdir dir="${src.generated.c}/iOS" />
        <mkdir dir="${src.generated.c}/Windows" />
        <mkdir dir="${src.generated.c}/X11" />
        <mkdir dir="${classes}" />
        <mkdir dir="${obj.nativewindow}" />
    </target>

    <!--
       - Check to see whether we need to rebuild the generated sources.
      -->
    <target name="java.generate.check">
        <!-- Blow away all target files if any dependencies are violated
             (the uptodate task doesn't allow arbitrary source and target filesets but should) -->
             <!--
        <dependset>
            <srcfileset refid="stub.includes.dependencies.fileset.1" />
            <srcfileset refid="stub.includes.dependencies.fileset.2" />
            <srcfileset refid="stub.includes.dependencies.fileset.3" />
            <srcfileset refid="stub.includes.dependencies.fileset.4" />
            <targetfileset dir="${src.generated}">
                <include name="**/*.java" />
                <include name="**/*.c" />
            </targetfileset>
        </dependset>
        -->

        <!-- Now check for the presence of one well-known file -->
        <uptodate property="java.generate.skip.x11windowlib"
                  targetfile="${src.generated.java}/jogamp/nativewindow/x11/X11Lib.java">
            <srcfiles refid="stub.includes.dependencies.fileset.1" />
            <srcfiles refid="stub.includes.dependencies.fileset.2" />
            <srcfiles refid="stub.includes.dependencies.fileset.3" />
        </uptodate>
        <uptodate property="java.generate.skip.jawt"
                  targetfile="${src.generated.java}/jogamp/nativewindow/jawt/JAWT.java">
            <srcfiles refid="stub.includes.dependencies.fileset.1" />
            <srcfiles refid="stub.includes.dependencies.fileset.2" />
            <srcfiles refid="stub.includes.dependencies.fileset.3" />
            <srcfiles refid="stub.includes.dependencies.fileset.4" />
        </uptodate>

        <condition property="java.generate.skip">
          <and>
              <isset property="java.generate.skip.x11windowlib"/>
              <isset property="java.generate.skip.jawt"/>
          </and>
        </condition>

        <!--property name="java.generate.skip" value="true"/-->
    </target>

    <target name="java.generate.windowlib" if="windowlib.os.cfg">
        <echo message="Generating Windowing Lib implementation class" />
        <antcall target="java.generate.copy2temp" inheritRefs="true" />
        <gluegen src="${stub.includes}/${window.os.system}/window-lib.c"
                 outputRootDir="${build.nativewindow}"
                 config="${windowlib.os.cfg}"
                 includeRefid="stub.includes.fileset.platform"
                 literalInclude="${stub.includes.gluegen.gg}, ${stub.includes}/${window.os.system}/gluegen, ${src.c}/${window.os.system}"
                 emitter="com.jogamp.gluegen.JavaEmitter"
                 debug="false"
                 dumpCPP="false">
            <classpath refid="gluegen.classpath" />
        </gluegen>
    </target>

    <!-- target name="java.generate.jawt" unless="setup.noAWT" -->
    <target name="java.generate.jawt" if="jawt.cfg" unless="setup.noAWT">
        <!-- NOTE:  the "literalInclude" in this GlueGen call is simply to
           -        get around the fact that neither FileSet nor DirSet can
           -        handle different drives in an effective manner. -->
        <echo message="Generating JAWT interface class" />
        <echo message="java.home.dir=${java.home.dir}" />
        <antcall target="java.generate.copy2temp" inheritRefs="true" />
        <gluegen src="${jawt.platform.header}"
                 outputRootDir="${build.nativewindow}"
                 config="${jawt.cfg}"
                 includeRefid="stub.includes.fileset.platform"
                 literalInclude="${stub.includes.gluegen.gg}, ${stub.includes.gluegen}/jni, ${stub.includes.gluegen}/jni/${jni.platform.sub}, ${stub.includes}/${window.os.system}/gluegen"
                 emitter="com.jogamp.gluegen.JavaEmitter"
                 debug="false"
                 dumpCPP="false">
            <classpath refid="gluegen.classpath" />
        </gluegen>
    </target>

    <target name="java.generate.platforms" >
        <echo message="Generating platform-specifics: os: ${window.os.system}, cfgs: ${windowlib.os.cfg}, ${jawt.cfg}" />
        <dirset id="stub.includes.fileset.platform" dir="." includes="${stub.includes}/${window.os.system}/** ${stub.includes.gluegen}/gluegen/** ${stub.includes}/khr/**" />
        <antcall target="java.generate.windowlib" inheritRefs="true" />
        <antcall target="java.generate.jawt" inheritRefs="true" />
        <antcall target="java.generate.copy2temp" inheritRefs="true" />
    </target>

    <!--
       - Setup the generating ANT tasks and use it to generate the Java files 
       - from the C GL headers.  This involves setting the taskdef and creating
       - the classpath reference id then running the task on each header.
      -->
    <target name="java.generate" depends="init, common.gluegen.init, java.generate.check" unless="java.generate.skip">

        <!-- Use the GlueGen task to generate the Java files -->

        <antcall target="java.generate.cleantemp" inheritRefs="true" />

        <echo message="Generating platform-specifics: DRM" />
        <dirset id="stub.includes.fileset.drm" dir="." includes="${stub.includes}/drm/* ${stub.includes.gluegen}/gluegen/**" />
        <gluegen src="${stub.includes}/drm/drm-gbm-lib.c"
                 outputRootDir="${build.nativewindow}"
                 config="${config.nativewindow}/drm-gbm-lib.cfg"
                 includeRefid="stub.includes.fileset.drm"
                 literalInclude="${stub.includes.gluegen.gg}, ${stub.includes}/drm, ${src.c}/drm"
                 emitter="com.jogamp.gluegen.JavaEmitter"
                 debug="false"
                 dumpCPP="false">
            <classpath refid="gluegen.classpath" />
        </gluegen>

        <echo message="Generating platform-specifics: X11" />
        <antcall target="java.generate.platforms" inheritRefs="true">
            <param name="window.os.system"                       value="x11"/>
            <param name="windowlib.os.cfg"                       value="${config.nativewindow}/x11-lib.cfg" />
            <param name="jawt.cfg"                               value="${config.nativewindow}/jawt-x11.cfg" />
            <param name="jawt.platform.header"                   value="${stub.includes.gluegen}/jni/x11/jawt_md.h" />
            <param name="jni.platform.sub"                       value="x11" />
        </antcall>

        <echo message="Generating platform-specifics: Win32" />
        <antcall target="java.generate.platforms" inheritRefs="true">
            <param name="window.os.system"                       value="win32"/>
            <param name="windowlib.os.cfg"                       value="${config.nativewindow}/win32-lib.cfg" />
            <param name="jawt.cfg"                               value="${config.nativewindow}/jawt-win32.cfg" />
            <param name="jawt.platform.header"                   value="${stub.includes.gluegen}/jni/win32/jawt_md.h" />
            <param name="jni.platform.sub"                       value="win32" />
        </antcall>          

        <echo message="Generating platform-specifics: MacOSX" />
        <antcall target="java.generate.platforms" inheritRefs="true">
          <param name="window.os.system"                     value="macosx"/>
          <param name="jawt.cfg"                             value="${config.nativewindow}/jawt-macosx.cfg" />
          <param name="jawt.platform.header"                 value="${stub.includes.gluegen}/jni/macosx/jawt_md.h" />
          <param name="jni.platform.sub"                     value="macosx" />
        </antcall>
    
        <echo message="Generating platform-specifics: iOS (nop)" /> <!-- actually nothing gets generated -->
        <antcall target="java.generate.platforms" inheritRefs="true">
          <param name="window.os.system"                     value="ios"/>
          <!-- param name="jawt.cfg"                             value="${config.nativewindow}/jawt-ios.cfg" / --> <!-- n/a -->
          <!-- param name="jawt.platform.header"                 value="${stub.includes.gluegen}/jni/ios/jawt_md.h" / --> <!-- n/a -->
          <!-- param name="jni.platform.sub"                     value="ios" / --> <!-- n/a -->
        </antcall>
    
        <!-- Inform the user that the generators have successfully created 
           - the necessary Java files -->
        <echo message="" />
        <echo message="GlueGen has successfully generated files." />
    
    </target>      

    <!-- ================================================================== -->
    <!-- 
       - Compile the original and generated source.  The composable pipelines
       - will be generated.
      -->

    <!-- Perform the first pass: Native headers. -->
    <target name="javah.drmgbm" if="setup.addNativeDRMGBM">
        <javac srcdir="${src.java}:${src.generated.java}"
               destdir="${classes}"
               excludes="${java.excludes.all}"
               nativeheaderdir="${src.generated.c}/drm"
               fork="yes"
               includeAntRuntime="false"
               memoryMaximumSize="${javac.memorymax}"
               encoding="UTF-8"
               source="${target.sourcelevel}" 
               target="${target.targetlevel}"
               bootclasspath="${target.rt.jar}"
               debug="${javacdebug}" debuglevel="${javacdebuglevel}">
            <classpath refid="swt_gluegen.classpath"/>
            <include name="jogamp/nativewindow/drm/DRMLib.java" />
            <include name="jogamp/nativewindow/drm/DRMUtil.java" />
          <compilerarg value="-implicit:none" />
        </javac>
    </target>
    <target name="javah.x11" if="isX11">
        <javac srcdir="${src.java}:${src.generated.java}"
               destdir="${classes}"
               excludes="${java.excludes.all}"
               nativeheaderdir="${src.generated.c}/X11"
               fork="yes"
               includeAntRuntime="false"
               memoryMaximumSize="${javac.memorymax}"
               encoding="UTF-8"
               source="${target.sourcelevel}" 
               target="${target.targetlevel}"
               bootclasspath="${target.rt.jar}"
               debug="${javacdebug}" debuglevel="${javacdebuglevel}">
            <classpath refid="swt_gluegen.classpath"/>
            <include name="jogamp/nativewindow/x11/X11Lib.java" />
            <include name="jogamp/nativewindow/x11/X11Util.java" />
          <compilerarg value="-implicit:none" />
        </javac>
    </target>
    <target name="javah.windows" if="isWindows">
        <javac srcdir="${src.java}:${src.generated.java}"
               destdir="${classes}"
               excludes="${java.excludes.all}"
               nativeheaderdir="${src.generated.c}/Windows"
               fork="yes"
               includeAntRuntime="false"
               memoryMaximumSize="${javac.memorymax}"
               encoding="UTF-8"
               source="${target.sourcelevel}" 
               target="${target.targetlevel}"
               bootclasspath="${target.rt.jar}"
               debug="${javacdebug}" debuglevel="${javacdebuglevel}">
            <classpath refid="swt_gluegen.classpath"/>
            <include name="jogamp/nativewindow/windows/GDI.java" />
            <include name="jogamp/nativewindow/windows/GDIUtil.java" />
          <compilerarg value="-implicit:none" />
        </javac>
    </target>
    <target name="javah.macos" if="isOSX">
        <javac srcdir="${src.java}:${src.generated.java}"
               destdir="${classes}"
               excludes="${java.excludes.all}"
               nativeheaderdir="${src.generated.c}/MacOSX"
               fork="yes"
               includeAntRuntime="false"
               memoryMaximumSize="${javac.memorymax}"
               encoding="UTF-8"
               source="${target.sourcelevel}" 
               target="${target.targetlevel}"
               bootclasspath="${target.rt.jar}"
               debug="${javacdebug}" debuglevel="${javacdebuglevel}">
            <classpath refid="swt_gluegen.classpath"/>
            <include name="jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java" />
            <include name="jogamp/nativewindow/macosx/OSXUtil.java" />
          <compilerarg value="-implicit:none" />
        </javac>
    </target>
    <target name="javah.ios" if="isIOS">
        <javac srcdir="${src.java}:${src.generated.java}"
               destdir="${classes}"
               excludes="${java.excludes.all}"
               nativeheaderdir="${src.generated.c}/iOS"
               fork="yes"
               includeAntRuntime="false"
               memoryMaximumSize="${javac.memorymax}"
               encoding="UTF-8"
               source="${target.sourcelevel}" 
               target="${target.targetlevel}"
               bootclasspath="${target.rt.jar}"
               debug="${javacdebug}" debuglevel="${javacdebuglevel}">
            <classpath refid="swt_gluegen.classpath"/>
            <include name="jogamp/nativewindow/ios/IOSUtil.java" />
          <compilerarg value="-implicit:none" />
        </javac>
    </target>

    <target name="java.compile.javase" depends="java.generate, javah.drmgbm, javah.x11, javah.windows, javah.macos, javah.ios">
        <!-- Perform the second pass Java compile; everything. -->
        <javac destdir="${classes}"
               excludes="${java.excludes.all}"
               fork="yes"
               includeAntRuntime="false"
               memoryMaximumSize="${javac.memorymax}"
               encoding="UTF-8"
               source="${target.sourcelevel}" 
               target="${target.targetlevel}" 
               bootclasspath="${target.rt.jar}"
               debug="${javacdebug}" debuglevel="${javacdebuglevel}">
            <classpath refid="swt_gluegen.classpath"/>
            <src path="${src.java}" />
            <src path="${src.generated.java}" />
        </javac>
    </target>

    <target name="java.compile" depends="java.compile.javase" />

    <!-- ================================================================== -->
    <!-- 
       - Compile the native C code for JOGL (and optionally the Cg binding).
      -->

    <target name="c.configure.1" depends="gluegen.cpptasks.detect.os,gluegen.cpptasks.setup.compiler">
      <!-- compiler configuration -->

      <!-- Note that we can use the base setups in the gluegen-cpptasks for most of these -->
      <compiler id="compiler.cfg.freebsd.nativewindow" extends="compiler.cfg.freebsd">
        <!-- Need to force X11R6 headers on to include path after stub_includes -->
        <includepath path="/usr/local/include" />
      </compiler>

      <compiler id="compiler.cfg.linux.armv6.nativewindow.x11" extends="compiler.cfg.linux.armv6">
        <!-- Need to force /usr/include headers on to include path (after all others), due to crosscompiler usage -->
        <compilerarg value="-idirafter" />
        <compilerarg value="/usr/include" />
      </compiler>

      <compiler id="compiler.cfg.linux.aarch64.nativewindow.x11" extends="compiler.cfg.linux.aarch64">
        <!-- Need to force /usr/include headers on to include path (after all others), due to crosscompiler usage -->
        <compilerarg value="-idirafter" />
        <compilerarg value="/usr/include" />
      </compiler>

      <compiler id="compiler.cfg.solaris.nativewindow.x11" extends="compiler.cfg.solaris">
        <compilerarg value="-I/usr/X11R6/include" />
      </compiler>

      <compiler id="compiler.cfg.solaris.nativewindow.x11.sparcv9" extends="compiler.cfg.solaris.sparcv9">
        <compilerarg value="-I/usr/X11R6/include" />
      </compiler>

      <compiler id="compiler.cfg.solaris.nativewindow.x11.amd64" extends="compiler.cfg.solaris.amd64">
        <compilerarg value="-I/usr/X11R6/include" />
      </compiler>

      <compiler id="compiler.cfg.macosx.nativewindow" extends="compiler.cfg.macosx">
      </compiler>

      <compiler id="compiler.cfg.ios.amd64.nativewindow" extends="compiler.cfg.ios.amd64">
        <!-- compilerarg value="-v" / -->
      </compiler>

      <compiler id="compiler.cfg.ios.arm64.nativewindow" extends="compiler.cfg.ios.arm64">
        <!-- compilerarg value="-v" / -->
      </compiler>

      <!-- linker configuration -->

      <linker id="linker.cfg.freebsd.nativewindow.x11" extends="linker.cfg.freebsd">
        <syslibset dir="/usr/local/lib" libs="X11"/>
        <syslibset dir="/usr/local/lib" libs="Xxf86vm" />
        <syslibset dir="/usr/local/lib" libs="Xrender"/>
      </linker>

      <linker id="linker.cfg.freebsd.amd64.nativewindow.x11" extends="linker.cfg.freebsd.amd64">
        <syslibset dir="/usr/local/lib" libs="X11" />
        <syslibset dir="/usr/local/lib" libs="Xxf86vm" />
        <syslibset dir="/usr/local/lib" libs="Xrender"/>
      </linker>

      <linker id="linker.cfg.linux.nativewindow.drm" extends="linker.cfg.linux">
        <syslibset libs="drm"/>
        <syslibset libs="gbm"/>
      </linker>

      <linker id="linker.cfg.linux.x86.nativewindow.drm" extends="linker.cfg.linux.x86">
        <syslibset libs="drm"/>
        <syslibset libs="gbm"/>
      </linker>

      <linker id="linker.cfg.linux.amd64.nativewindow.drm" extends="linker.cfg.linux.amd64">
        <syslibset libs="drm"/>
        <syslibset libs="gbm"/>
      </linker>

      <linker id="linker.cfg.linux.armv6.nativewindow.drm" extends="linker.cfg.linux.armv6">
        <syslibset dir="${TARGET_PLATFORM_USRLIBS}" libs="drm" />
        <syslibset dir="${TARGET_PLATFORM_USRLIBS}" libs="gbm" />
      </linker>

      <linker id="linker.cfg.linux.aarch64.nativewindow.drm" extends="linker.cfg.linux.aarch64">
        <syslibset dir="${TARGET_PLATFORM_USRLIBS}" libs="drm" />
        <syslibset dir="${TARGET_PLATFORM_USRLIBS}" libs="gbm" />
      </linker>

      <linker id="linker.cfg.linux.nativewindow.x11" extends="linker.cfg.linux">
        <syslibset libs="X11"/>
        <syslibset libs="Xxf86vm" />
        <syslibset libs="Xrender"/>
      </linker>

      <linker id="linker.cfg.linux.x86.nativewindow.x11" extends="linker.cfg.linux.x86">
        <syslibset libs="X11"/>
        <syslibset libs="Xxf86vm" />
        <syslibset libs="Xrender"/>
      </linker>

      <linker id="linker.cfg.linux.amd64.nativewindow.x11" extends="linker.cfg.linux.amd64">
        <syslibset libs="X11"/>
        <syslibset libs="Xxf86vm" />
        <syslibset libs="Xrender"/>
      </linker>

      <linker id="linker.cfg.linux.armv6.nativewindow.x11" extends="linker.cfg.linux.armv6">
        <syslibset dir="${TARGET_PLATFORM_USRLIBS}" libs="X11" />
        <syslibset dir="${TARGET_PLATFORM_USRLIBS}" libs="Xxf86vm" />
        <syslibset dir="${TARGET_PLATFORM_USRLIBS}" libs="Xrender" />
      </linker>

      <linker id="linker.cfg.linux.aarch64.nativewindow.x11" extends="linker.cfg.linux.aarch64">
        <syslibset dir="${TARGET_PLATFORM_USRLIBS}" libs="X11" />
        <syslibset dir="${TARGET_PLATFORM_USRLIBS}" libs="Xxf86vm" />
        <syslibset dir="${TARGET_PLATFORM_USRLIBS}" libs="Xrender" />
      </linker>

      <linker id="linker.cfg.solaris.nativewindow.x11" extends="linker.cfg.solaris">
        <linkerarg value="-L/usr/sfw/lib"/>
        <syslibset libs="X11"/>
        <syslibset libs="Xxf86vm" />
        <syslibset libs="Xrender"/>
      </linker>

      <linker id="linker.cfg.solaris.sparcv9.nativewindow.x11" extends="linker.cfg.solaris.sparcv9">
        <linkerarg value="-L/usr/lib/sparcv9"/>
        <linkerarg value="-L/usr/sfw/lib/sparcv9"/>
        <syslibset libs="X11"/>
        <syslibset libs="Xxf86vm" />
        <syslibset libs="Xrender"/>
      </linker>

      <linker id="linker.cfg.solaris.amd64.nativewindow.x11" extends="linker.cfg.solaris.amd64">
        <linkerarg value="-L/usr/lib/amd64"/>
        <linkerarg value="-L/usr/sfw/lib/amd64"/>
        <syslibset libs="X11"/>
        <syslibset libs="Xxf86vm" />
        <syslibset libs="Xrender"/>
      </linker>

      <linker id="linker.cfg.win32.mingw.nativewindow" extends="linker.cfg.win32.mingw">
        <linkerarg value="-Wl,--kill-at" />        <!-- remove @ from function names -->
        <syslibset libs="gdi32, kernel32"/>
      </linker>

      <linker id="linker.cfg.win64.mingw.nativewindow" extends="linker.cfg.win64.mingw">
        <linkerarg value="-Wl,--kill-at" />        <!-- remove @ from function names -->
        <syslibset libs="gdi32, kernel32"/>
      </linker>

      <linker id="linker.cfg.win32.msvc.nativewindow" extends="linker.cfg.win32.msvc">
        <syslibset libs="gdi32, user32, kernel32" />
      </linker>
      
      <linker id="linker.cfg.macosx.nativewindow" extends="linker.cfg.macosx">
        <linkerarg value="-weak_framework" />
        <linkerarg value="AppKit" />
        <linkerarg value="-weak_framework" />
        <linkerarg value="QuartzCore" />
        <linkerarg value="-weak_framework" />
        <linkerarg value="Cocoa" />
      </linker>

      <linker id="linker.cfg.ios.amd64.nativewindow" extends="linker.cfg.ios.amd64">
        <!-- linkerarg value="-v" / -->
        <linkerarg value="-weak_framework" />
        <linkerarg value="UIKit" />
        <linkerarg value="-weak_framework" />
        <linkerarg value="QuartzCore" />
        <linkerarg value="-weak_framework" />
        <linkerarg value="OpenGLES" /> <!-- hack to inject CAEAGLLayer.self into UIView's layerClass -->
      </linker>

      <linker id="linker.cfg.ios.arm64.nativewindow" extends="linker.cfg.ios.arm64">
        <!-- linkerarg value="-v" / -->
        <linkerarg value="-weak_framework" />
        <linkerarg value="UIKit" />
        <linkerarg value="-weak_framework" />
        <linkerarg value="QuartzCore" />
        <linkerarg value="-weak_framework" />
        <linkerarg value="OpenGLES" /> <!-- hack to inject CAEAGLLayer.self into UIView's layerClass -->
      </linker>

      <linker id="linker.cfg.hpux.nativewindow" extends="linker.cfg.hpux">
        <syslibset dir="/usr/lib" libs="X11"/>
        <syslibset dir="/usr/lib" libs="Xrender"/>
      </linker>
    </target>

    <target name="c.configure.win32.vc" if="isVCFamily">
      <echo message="Win32.VC" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.win32.msvc" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.win32.msvc.nativewindow" />
    </target>
    
    <target name="c.configure.win32.mingw" if="isMingW32">
      <echo message="Win32.MingW" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.win32.mingw" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.win32.mingw.nativewindow" />
    </target>

    <target name="c.configure.win64.mingw" if="isMingW64">
      <echo message="Win64.MingW" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.win64.mingw" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.win64.mingw.nativewindow" />
    </target>

    <target name="c.configure.linux.x86" if="isLinuxX86">
      <echo message="Linux.x86" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.linux.x86" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.x86.nativewindow.x11" />
      <property name="linker.cfg.id.drm"                    value="linker.cfg.linux.x86.nativewindow.drm" />
    </target>
    
    <target name="c.configure.linux.amd64" if="isLinuxAMD64">
      <echo message="Linux.AMD64" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.linux.amd64" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.amd64.nativewindow.x11" />
      <property name="linker.cfg.id.drm"                    value="linker.cfg.linux.amd64.nativewindow.drm" />
    </target>
    
    <target name="c.configure.linux.armv6" if="isLinuxARMv6">
      <echo message="Linux.armv6" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.linux.armv6.nativewindow.x11" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.armv6.nativewindow.x11" />
      <property name="linker.cfg.id.drm"                    value="linker.cfg.linux.armv6.nativewindow.drm" />
    </target>
    
    <target name="c.configure.linux.aarch64" if="isLinuxARM64">
      <echo message="Linux.aarch64" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.linux.aarch64.nativewindow.x11" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.aarch64.nativewindow.x11" />
      <property name="linker.cfg.id.drm"                    value="linker.cfg.linux.aarch64.nativewindow.drm" />
    </target>
    
    <target name="c.configure.linux.ia64" if="isLinuxIA64">
      <echo message="Linux.IA64" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.linux" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.nativewindow.x11" />
      <property name="linker.cfg.id.drm"                    value="linker.cfg.linux.nativewindow.drm" />
    </target>

    <target name="c.configure.linux.hppa" if="isLinuxHppa">
      <echo message="Linux.HPPA" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.linux" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.nativewindow.x11" />
      <property name="linker.cfg.id.drm"                    value="linker.cfg.linux.nativewindow.drm" />
    </target>

    <target name="c.configure.linux.mips" if="isLinuxMips">
      <echo message="Linux.MIPS" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.linux" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.nativewindow.x11" />
      <property name="linker.cfg.id.drm"                    value="linker.cfg.linux.nativewindow.drm" />
    </target>

    <target name="c.configure.linux.mipsel" if="isLinuxMipsel">
      <echo message="Linux.MIPSEL" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.linux" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.nativewindow.x11" />
      <property name="linker.cfg.id.drm"                    value="linker.cfg.linux.nativewindow.drm" />
    </target>

    <target name="c.configure.linux.ppc" if="isLinuxPpc">
      <echo message="Linux.PPC" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.linux" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.nativewindow.x11" />
      <property name="linker.cfg.id.drm"                    value="linker.cfg.linux.nativewindow.drm" />
    </target>

    <target name="c.configure.linux.s390" if="isLinuxs390">
      <echo message="Linux.S390" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.linux" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.nativewindow.x11" />
      <property name="linker.cfg.id.drm"                    value="linker.cfg.linux.nativewindow.drm" />
    </target>

    <target name="c.configure.linux.sparc" if="isLinuxSparc">
      <echo message="Linux.SPARC" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.linux" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.nativewindow.x11" />
      <property name="linker.cfg.id.drm"                    value="linker.cfg.linux.nativewindow.drm" />
    </target>

    <target name="c.configure.linux" depends="c.configure.linux.armv6,c.configure.linux.aarch64,c.configure.linux.x86,c.configure.linux.amd64,c.configure.linux.ia64,c.configure.linux.hppa,c.configure.linux.mips,c.configure.linux.mipsel,c.configure.linux.ppc,c.configure.linux.s390,c.configure.linux.sparc,c.configure.x11" if="isLinux" />

    <target name="c.configure.android" if="isAndroid">
      <echo message="Android" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.android" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.android" />
    </target>
    
    <target name="c.configure.solaris32" depends="c.configure.x11" if="isSolaris32Bit">
      <echo message="Solaris" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.solaris.nativewindow.x11" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.solaris.nativewindow.x11" />
    </target>
  
 
    <target name="c.configure.solaris.sparcv9" depends="c.configure.x11" if="isSolarisSparcv9">
      <echo message="SolarisSparcv9" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.solaris.nativewindow.x11.sparcv9" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.solaris.sparcv9.nativewindow.x11" />
    </target>
   

    <target name="c.configure.solaris.amd64" depends="c.configure.x11" if="isSolarisAMD64">
      <echo message="SolarisAMD64" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.solaris.nativewindow.x11.amd64" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.solaris.amd64.nativewindow.x11" />
    </target>
   
    <target name="c.configure.freebsd.x86" if="isFreeBSDX86">
      <echo message="FreeBSD.x86" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.freebsd.nativewindow" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.freebsd.nativewindow.x11" />
    </target>
    
    <target name="c.configure.freebsd.amd64" if="isFreeBSDAMD64">
      <echo message="FreeBSD.AMD64" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.freebsd.nativewindow" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.freebsd.amd64.nativewindow.x11" />
    </target>
    
    <target name="c.configure.freebsd" depends="c.configure.freebsd.x86,c.configure.freebsd.amd64,c.configure.x11" if="isFreeBSD" />

    <target name="c.configure.hpux" depends="c.configure.x11" if="isHPUX">
      <echo message="HP-UX" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.hpux" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.hpux.nativewindow.x11" />
    </target>

    <target name="c.configure.win32" depends="c.configure.win32.vc,c.configure.win32.mingw,c.configure.win64.mingw" if="isWindows" />

    <target name="c.configure.x11" if="isX11" />

    <target name="c.configure.macosx" if="isOSX">
      <property name="compiler.cfg.id"                      value="compiler.cfg.macosx.nativewindow" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.macosx.nativewindow" />
    </target>
    
    <target name="c.configure.ios.amd64" if="isIOSAmd64">
      <property name="compiler.cfg.id"                      value="compiler.cfg.ios.amd64.nativewindow" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.ios.amd64.nativewindow" />
    </target>
    
    <target name="c.configure.ios.arm64" if="isIOSArm64">
      <property name="compiler.cfg.id"                      value="compiler.cfg.ios.arm64.nativewindow" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.ios.arm64.nativewindow" />
    </target>
    
    <target name="c.configure.2" depends="c.configure.win32,c.configure.linux,c.configure.android,c.configure.solaris32,c.configure.solaris.sparcv9,c.configure.solaris.amd64,c.configure.macosx,c.configure.ios.amd64,c.configure.ios.arm64,c.configure.freebsd,c.configure.hpux" />

    <target name="c.configure" depends="c.configure.1,c.configure.2" />

    <target name="rename.mingw.dll" if="isMingW">
        <move file="${src}" tofile="${dest}" />
    </target>

    <macrodef name="c.build">
      <attribute name="c.compiler.src.files" />
      <attribute name="compiler.cfg.id" />
      <attribute name="linker.cfg.id" />
      <attribute name="output.lib.name" />
      <attribute name="c.compiler.use-jawt" default="false"/>
      <sequential>
        <echo message="Output lib name = @{output.lib.name}" />

        <!-- NOTE: the value of the debug and optimise attributes will not be overridden if already set externally -->
        <property name="c.compiler.debug"     value="false" /> 
        <!-- Optimise flags one of { none, size, speed, minimal, full, aggressive, extreme, unsafe } --> 
        <property name="c.compiler.optimise"  value="none" /> 

        <condition property="c.compiler.use-debug"><istrue value="${c.compiler.debug}"/></condition>

        <!-- since properties are immutable, we need one for each target -->
        <condition property="@{output.lib.name}.useLibJAWT">
            <istrue value="@{c.compiler.use-jawt}" />
        </condition>
        <echo message="c.compiler.use-jawt @{c.compiler.use-jawt}"/>
        <echo message="@{output.lib.name}.useLibJAWT ${@{output.lib.name}.useLibJAWT}"/>

        <condition property="@{output.lib.name}.useLibJVM">
          <and>
            <isset property="isHPUX"/>
            <isset property="@{output.lib.name}.useLibJAWT"/>
          </and>
        </condition> 

        <patternset id="c.src.files.awt">
          <include name="${rootrel.src.c}/JAWT*.c"/>
          <include name="${rootrel.generated.c}/X11/JAWT*.c" if="isX11"/>
          <include name="${rootrel.generated.c}/MacOSX/JAWT*.c" if="isOSX"/>
          <include name="${rootrel.generated.c}/Windows/JAWT*.c" if="isWindows"/>
        </patternset>

        <patternset id="c.src.files.drmgbm">
          <include name="${rootrel.generated.c}/drm/DRMLib_JNI.c"/>
          <include name="${rootrel.generated.c}/drm/drm*.c"/>
          <include name="${rootrel.src.c}/drm/DRMmisc.c"/>
          <include name="${rootrel.src.c}/NativewindowCommon.c"/>
          <include name="${rootrel.src.c}/JVM_JNI8.c"/>
        </patternset>

        <patternset id="c.src.files.x11">
          <include name="${rootrel.generated.c}/X11/X11*.c"/>
          <include name="${rootrel.src.c}/x11/Xmisc.c"/>
          <include name="${rootrel.src.c}/x11/XineramaHelper.c"/>
          <include name="${rootrel.src.c}/NativewindowCommon.c"/>
          <include name="${rootrel.src.c}/JVM_JNI8.c"/>
        </patternset>

        <patternset id="c.src.files.windows">
          <include name="${rootrel.generated.c}/Windows/GDI*.c"/>
          <include name="${rootrel.src.c}/win32/GDImisc.c"/>
          <include name="${rootrel.src.c}/win32/WindowsDWM.c"/>
          <include name="${rootrel.src.c}/NativewindowCommon.c"/>
          <include name="${rootrel.src.c}/JVM_JNI8.c"/>
        </patternset>

        <patternset id="c.src.files.macosx">
          <include name="${rootrel.src.c}/macosx/OSXmisc.m"/>
          <include name="${rootrel.src.c}/NativewindowCommon.c"/>
          <include name="${rootrel.src.c}/JVM_JNI8.c"/>
        </patternset>

        <patternset id="c.src.files.ios">
          <include name="${rootrel.src.c}/ios/CAEAGLLayered.m"/>
          <include name="${rootrel.src.c}/ios/IOSmisc.m"/>
          <include name="${rootrel.src.c}/NativewindowCommon.c"/>
          <include name="${rootrel.src.c}/JVM_JNI8.c"/>
        </patternset>

        <echo message="Compiling @{output.lib.name}" />
        <echo message="java.lib.dir.platform: ${java.lib.dir.platform}" />      

        <!-- have to wrap cc task with outofdate, because otherwise cc links a new library
             even when no files have been compiled -->
      	<outofdate>
          <sourcefiles>
            <fileset dir="${project.root}"><patternset refid="@{c.compiler.src.files}"/></fileset>
          </sourcefiles>
          <targetfiles>
            <fileset dir="${obj.nativewindow}" includes="${native.library.prefix}@{output.lib.name}.${native.library.suffix}"/>
          </targetfiles>
          <sequential>
            <cc outtype="${output.lib.type}" 
                usehighleveltool="true"
                writesoname="true"
                objdir="${obj.nativewindow}" 
                outfile="${obj.nativewindow}/@{output.lib.name}"
                optimize="${c.compiler.optimise}" 
                debug="${c.compiler.debug}"
                multithreaded="true" 
                exceptions="false" 
                rtti="false">   
      
              <fileset dir="${project.root}"><patternset refid="@{c.compiler.src.files}"/></fileset>
      
              <compiler extends="@{compiler.cfg.id}" >
                <sysincludepath path="${java.includes.dir}"/>
                <sysincludepath path="${java.includes.dir.platform}"/>
                <sysincludepath path="${stub.includes.gluegen.cc}"/>
                <!-- This is for the generated headers for handwritten C code -->
                <includepath path="${src.generated.c}" />
                <includepath path="${src.generated.c}/X11"     if="isX11"/>
                <includepath path="${src.generated.c}/MacOSX"  if="isOSX"/>
                <includepath path="${src.generated.c}/iOS"     if="isIOS"/>
                <includepath path="stub_includes/win32"        if="isWindows"/>
                <includepath path="${src.generated.c}/Windows" if="isWindows"/>
                <includepath path="${src.c}/x11"               if="isX11"/>
                <includepath path="${src.c}/macosx"            if="isOSX"/>
                <includepath path="${src.c}/ios"               if="isIOS"/>
                <includepath path="${src.c}/win32"             if="isWindows"/>
                <includepath path="${src.c}"/>
                <includepath path="${src.generated.c}/drm"     if="setup.addNativeDRMGBM" />
                <includepath path="stub_includes/drm"          if="setup.addNativeDRMGBM" />
      
                <!-- This must come last to not override real include paths -->
                <!-- includepath path="stub_includes/macosx" if="isOSX" / -->
              </compiler>
      
              <linker extends="@{linker.cfg.id}">
                <syslibset dir="${java.lib.dir.platform}" libs="jawt" if="@{output.lib.name}.useLibJAWT"/>
                <syslibset dir="${java.lib.dir.platform}/server" libs="jvm" if="@{output.lib.name}.useLibJVM"/>
              </linker>
            </cc>

            <!-- FIXME: this is a hack; the cpptask should have an option to change the
                 suffix or at least understand the override from so to dll -->
            <antcall target="rename.mingw.dll" inheritRefs="true">
                <param name="src"  value="${obj.nativewindow}/lib@{output.lib.name}.so" />
                <param name="dest" value="${obj.nativewindow}/@{output.lib.name}.dll" />
            </antcall>

            <gluegen.make.libsymbols builddir="${build}" 
                nativelib="${obj.nativewindow}/${native.library.prefix}@{output.lib.name}.${native.library.suffix}"
                symbolsfile="${obj.nativewindow}/${native.library.prefix}@{output.lib.name}.symbols"/>

            <!-- this stripping may be called more than once on the same library dir,
                 but that should cause no harm, and doing it here inside outofdate
                 prevents the JARs from always being rebuilt even if no source code changes -->
            <antcall target="gluegen.cpptasks.striplibs" inheritRefs="true">
                <param name="libdir" value="${obj.nativewindow}"/>
            </antcall>

          </sequential>
      	</outofdate>
      </sequential>
    </macrodef>  

    <target name="c.build.nativewindow.awt" unless="setup.noNativeAWT">
      <c.build c.compiler.src.files="c.src.files.awt"
               c.compiler.use-jawt="true"
               output.lib.name="nativewindow_awt"
               compiler.cfg.id="${compiler.cfg.id}"
               linker.cfg.id="${linker.cfg.id.oswin}"/>
    </target>

    <target name="c.build.nativewindow.windowlib.drmgbm" if="setup.addNativeDRMGBM">
      <c.build c.compiler.src.files="c.src.files.drmgbm"
               output.lib.name="nativewindow_drm"
               compiler.cfg.id="${compiler.cfg.id}"
               linker.cfg.id="${linker.cfg.id.drm}"/>
    </target>

    <target name="c.build.nativewindow.windowlib.x11" if="isX11">
      <c.build c.compiler.src.files="c.src.files.x11"
               output.lib.name="nativewindow_x11"
               compiler.cfg.id="${compiler.cfg.id}"
               linker.cfg.id="${linker.cfg.id.oswin}"/>
    </target>

    <target name="c.build.nativewindow.windowlib.windows" if="isWindows">
      <c.build c.compiler.src.files="c.src.files.windows"
               output.lib.name="nativewindow_win32"
               compiler.cfg.id="${compiler.cfg.id}"
               linker.cfg.id="${linker.cfg.id.oswin}"/>
    </target>

    <target name="c.build.nativewindow.windowlib.macosx" if="isOSX">
      <c.build c.compiler.src.files="c.src.files.macosx"
               output.lib.name="nativewindow_macosx"
               compiler.cfg.id="${compiler.cfg.id}"
               linker.cfg.id="${linker.cfg.id.oswin}"/>
    </target>

    <target name="c.build.nativewindow.windowlib.ios" if="isIOS">
      <c.build c.compiler.src.files="c.src.files.ios"
               output.lib.name="nativewindow_ios"
               compiler.cfg.id="${compiler.cfg.id}"
               linker.cfg.id="${linker.cfg.id.oswin}"/>
    </target>

    <target name="c.build.nativewindow.windowlib" depends="c.build.nativewindow.windowlib.drmgbm, c.build.nativewindow.windowlib.x11, c.build.nativewindow.windowlib.windows, c.build.nativewindow.windowlib.macosx, c.build.nativewindow.windowlib.ios"/>

    <target name="c.manifest" if="isVC8Family">
      <!-- exec mt, the Microsoft Manifest Tool, to include DLL manifests in order to resolve the location of msvcr80.dll -->
      <msvc.manifest objdir="${obj.nativewindow}" dllname="nativewindow_awt" />
      <msvc.manifest objdir="${obj.nativewindow}" dllname="nativewindow_win32" />
    </target>

    <target name="c.build.nativewindow" depends="c.configure,c.build.nativewindow.windowlib,c.build.nativewindow.awt">
      <antcall target="c.manifest" inheritRefs="true" />
    </target>

    <!-- ================================================================== -->
    <!--
       - Build the nativewindow.jar files.
      -->
    <target name="build-jars" depends="gluegen.cpptasks.detect.os,build-jars-javase" />

    <target name="setup-manifestfile">
        <property name="manifestfile" value="nativewindowversion"/>
        <copy file="${manifestfile}"
          tofile="${build.nativewindow}/manifest.mf"
          overwrite="true">
          <filterset>
              <filter token="VERSION" value="${jogamp.version}"/>
              <filter token="BUILD_VERSION" value="${jogl.version}"/>
              <filter token="SCM_BRANCH" value="${jogl.build.branch}"/>
              <filter token="SCM_COMMIT" value="${jogl.build.commit}"/>
              <filter token="BASEVERSION" value="${jogamp.version.base}"/>
              <filter token="JAR_CODEBASE_TAG" value="${jogamp.jar.codebase}"/>
          </filterset>
        </copy>
        <copy file="${manifestfile}-natives"
          tofile="${build.nativewindow}/manifest-natives.mf"
          overwrite="true">
          <filterset>
              <filter token="VERSION" value="${jogamp.version}"/>
              <filter token="BUILD_VERSION" value="${jogl.version}"/>
              <filter token="SCM_BRANCH" value="${jogl.build.branch}"/>
              <filter token="SCM_COMMIT" value="${jogl.build.commit}"/>
              <filter token="BASEVERSION" value="${jogamp.version.base}"/>
              <filter token="JAR_CODEBASE_TAG" value="${jogamp.jar.codebase}"/>
          </filterset>
        </copy>
    </target>

    <target name="build-jars-swt" depends="setup-manifestfile">
        <jar manifest="${build.nativewindow}/manifest.mf" destfile="${nativewindow-swt.jar}" filesonly="true">
            <fileset dir="${classes}"
                     includes="${java.part.swt}" />
        </jar>
    </target>

    <target name="build-jars-awt" depends="setup-manifestfile" unless="setup.noAWT">
        <jar manifest="${build.nativewindow}/manifest.mf" destfile="${nativewindow-awt.jar}" filesonly="true">
            <fileset dir="${classes}"
                     includes="${java.part.awt}"
                     excludes="${java.excludes.awt}"/>
        </jar>
    </target>

    <target name="build-jars-drm" depends="setup-manifestfile">
        <jar manifest="${build.nativewindow}/manifest.mf" destfile="${nativewindow-os-drm.jar}" filesonly="true">
            <fileset dir="${classes}"
                     includes="${java.part.drm}" />
        </jar>
    </target>

    <target name="build-jars-x11" depends="setup-manifestfile">
        <jar manifest="${build.nativewindow}/manifest.mf" destfile="${nativewindow-os-x11.jar}" filesonly="true">
            <fileset dir="${classes}"
                     includes="${java.part.x11}" />
        </jar>
    </target>

    <target name="build-jars-windows" depends="setup-manifestfile">
        <jar manifest="${build.nativewindow}/manifest.mf" destfile="${nativewindow-os-win.jar}" filesonly="true">
            <fileset dir="${classes}"
                     includes="${java.part.windows}" />
        </jar>
    </target>

    <target name="build-jars-macosx" depends="setup-manifestfile">
        <jar manifest="${build.nativewindow}/manifest.mf" destfile="${nativewindow-os-osx.jar}" filesonly="true">
            <fileset dir="${classes}"
                     includes="${java.part.macosx}" />
        </jar>
    </target>

    <target name="build-jars-ios" depends="setup-manifestfile">
        <jar manifest="${build.nativewindow}/manifest.mf" destfile="${nativewindow-os-ios.jar}" filesonly="true">
            <fileset dir="${classes}"
                     includes="${java.part.ios}" />
        </jar>
    </target>

    <target name="build-jars-javase" depends="setup-manifestfile,build-jars-swt,build-jars-awt,build-jars-drm,build-jars-x11,build-jars-windows,build-jars-macosx,build-jars-ios">
        <jar manifest="${build.nativewindow}/manifest.mf" destfile="${nativewindow.jar}" filesonly="true">
            <fileset dir="${classes}"
                     includes="${java.part.core}"
                     excludes="${java.part.swt} ${java.part.awt} ${java.part.drm} ${java.part.x11} ${java.part.windows}"/>
        </jar>
        <native.tag.jar objdir="${obj.nativewindow}"
                        nativejarfile="${build.nativewindow}/nativewindow-natives-${os.and.arch}.jar"
                        manifestfile="${build.nativewindow}/manifest-natives.mf"
                        module="nativewindow"
                        includelibs="*.${native.library.suffix}" />
    </target>

    <!-- ================================================================== -->
    <!--
       - Build the Javadocs for the sources.
       - NOTE:  these are not entirely correct as the javadoc targets depend 
       -        on the platform specific build targets.  To circumvent any 
       -        errors, ensure that the source is built first.
      -->
    <target name="javadoc" depends="init">
        <!-- Build the general public Javadoc -->
        <javadoc packagenames="${javadoc.packagenames}"
                 excludepackagenames="${java.excludes.javadoc.packagenames}"
                 sourcepath="${src.java};${src.generated.java}"        
                 classpath="${gluegen-rt.jar}"
                 destdir="${javadoc}" windowtitle="${javadoc.windowtitle}"
                 overview="${javadoc.overview}" 
                 source="${target.sourcelevel}"
                 maxmemory="${javac.memorymax}"
                 linkoffline="${javadoc.link} 142-packages"
         bottom="${javadoc.bottom}" >
          <arg value="${javadoc.xarg1}"/>
        </javadoc>
    </target>

    <target name="javadoc.spec" depends="init">
        <!-- Build the specification Javadoc -->
        <javadoc packagenames="${javadoc.spec.packagenames}"
                 excludepackagenames="${java.excludes.javadoc.packagenames}"
                 sourcepath="${src.java};${src.generated.java}"
                 classpath="${gluegen-rt.jar}"
                 destdir="${javadoc.spec}" windowtitle="${javadoc.windowtitle}"
                 overview="${javadoc.overview}"
                 source="${target.sourcelevel}"
                 maxmemory="${javac.memorymax}"
                 linkoffline="${javadoc.link} 142-packages"
                 bottom="${javadoc.bottom}" >
          <arg value="${javadoc.xarg1}"/>
        </javadoc>
    </target>
                                                                                                                                   
    <target name="javadoc.dev" depends="init">
        <!-- Build the internal developer Javadoc -->
        <javadoc packagenames="${javadoc.dev.packagenames}"
                 excludepackagenames="${java.excludes.javadoc.packagenames}"
                 sourcepath="${src.java};${src.generated.java}"        
                 classpath="${gluegen-rt.jar}"
                 destdir="${javadoc.dev}" windowtitle="${javadoc.windowtitle}"
                 overview="${javadoc.overview}" 
                 source="${target.sourcelevel}"
                 maxmemory="${javac.memorymax}"
                 linkoffline="${javadoc.link} 142-packages"
         bottom="${javadoc.bottom}" >
          <arg value="${javadoc.xarg1}"/>
        </javadoc>
    </target>

    <target name="all.doc" description="Build NativeWindow docs" depends="init,javadoc,javadoc.spec,javadoc.dev" />

    <!-- ================================================================== -->
    <!--
       - Clean up all that is built.
      -->
    <target name="clean" description="Remove all build products" depends="declare.common">
        <delete includeEmptyDirs="true" quiet="true">
            <fileset dir="${tempdir}" />
            <fileset dir="${build.nativewindow}" />
            <fileset dir="${javadoc}" />
            <fileset dir="${javadoc.spec}" />
            <fileset dir="${javadoc.dev}" />
        </delete>
        <antcall target="java.generate.cleantemp" inheritRefs="true" />
    </target>

    <target name="java.generate.cleantemp">
        <delete includeEmptyDirs="true" quiet="true">
            <fileset dir="${tempdir}/gensrc" />
        </delete>
    </target>

    <target name="java.generate.copy2temp">
        <copy todir="${tempdir}">
            <fileset dir="${build.nativewindow}"
                     includes="gensrc/classes/**" />
        </copy>
    </target>

    <!-- ================================================================== -->
    <!--
       - Build everything.
      -->
    <target name="all" description="Build NativeWindow JAR file(s) and native libraries." depends="init,java.compile,c.build.nativewindow,build-jars,generate.version.txt" />

    <target name="generate.version.txt" depends="init">
        <!-- Create a version.txt file indicating which version we just built -->
        <echo message="${jogl.version}" file="${build.nativewindow}/version.txt" />
    </target>

</project>