summaryrefslogtreecommitdiffstats
path: root/make/gluegen-cpptasks.xml
blob: d4b9002ac070a7b8a7149fa3d2caba580b1e61cc (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
<?xml version="1.0" encoding="UTF-8"?>
<!--
   - Ant project file which sets up cpptasks to compile native code
   - generated by GlueGen for multiple supported platforms. This Ant
   - project file is not intended to be executed standalone, but imported
   - by other projects which use GlueGen to generate native code and
   - need to compile that native code.
   - 
   - Before importing this file, the property "gluegen.root" must be
   - defined; this is the relative path from the current working
   - directory (e.g., from which the parent project's build.xml is being
   - executed) to the top of the checked-out GlueGen workspace.
   - 
   - This Ant project file depends on the following properties being set
   - externally:
   - 
   -   win32.c.compiler (required to be set on Windows):
   -       one of "vc6", "vc7", "vc8", or "mingw".
   -   c.compiler.debug:
   -       set to "true" if debug version of the compiled
   -       C code is desired.
   -   macosxfat:
   -       set to "true" if universal / fat binaries (both PowerPC
   -       and Intel code) are desired on Mac OS X. Requires
   -       support for cross-compilation from the underlying C
   -       compiler.
   - 
   - The gluegen.cpptasks.detect.os target sets the following
   - properties appropriately. They are only set to "true" if the OS/CPU
   - configuration is exactly as specified.
   - 
   -   isFreeBSD
   -   isHPUX
   -   isIA64
   -   isLinux
   -   isLinuxAMD64
   -   isLinuxIA64
   -   isLinuxX86
   -   isOSX
   -   isSolaris
   -   isUnix
   -   isWindows
   -   isX11
   - 
   - The gluegen.cpptasks.detect.compiler target sets the following
   - properties appropriately. They are only set to "true" if the OS/compiler
   - configuration is exactly as specified.
   - 
   -   isVC6
   -   isVC7
   -   isVC8
   -   isVC8_X64
   -   isVC8Family (= isVC8 || isVC8_X64)
   -   isMingW
  -->
<project name="GlueGen-cpptasks" basedir=".">
  <!-- import cpptasks -->
  <typedef resource="net/sf/antcontrib/cpptasks/antlib.xml" classpath="${gluegen.root}/make/lib/cpptasks.jar"/>

  <!-- Detect OS and compiler configuration -->
  <target name="gluegen.cpptasks.detect.os" unless="gluegen.cpptasks.detected.os">
    <condition property="isOSX">
      <and>
        <os family="mac"/>
        <os family="unix"/>
      </and>
    </condition>
    <condition property="isUnix">
      <and>
        <os family="unix" />
        <not>
          <os family="mac" />
        </not>
      </and>
    </condition>
    <condition property="isLinux">
      <os name="Linux" />
    </condition>
    <condition property="isSolaris">
      <os name="SunOS" />
    </condition>
    <condition property="isWindows">
      <os family="windows" />
    </condition>
    <condition property="isFreeBSD">
      <os name="FreeBSD" />
    </condition>
    <condition property="isHPUX">
      <os name="HP-UX" />
    </condition>
    <condition property="isLinuxX86">
      <and>
        <istrue value="${isLinux}" />
        <or>
          <os arch="i386" />
          <os arch="x86" />
        </or>
      </and>
    </condition>
    <condition property="isLinuxAMD64">
      <and>
        <istrue value="${isLinux}" />
        <or>
          <os arch="AMD64" />
          <os arch="x86_64" />
        </or>
      </and>
    </condition>
    <condition property="isLinuxIA64">
      <and>
        <istrue value="${isLinux}" />
        <os arch="IA64" />
      </and>
    </condition>
    <condition property="isIA64">
      <os arch="IA64" />
    </condition>
    <!-- Note: assumes X11 platform by default -->
    <condition property="isX11">
      <and>
        <isfalse value="${isWindows}" />
        <isfalse value="${isOSX}" />
      </and>
    </condition>

    <echo message="FreeBSD=${isFreeBSD}" />
    <echo message="HPUX=${isHPUX}" />
    <echo message="IA64=${isIA64}" />
    <echo message="Linux=${isLinux}" />
    <echo message="LinuxAMD64=${isLinuxAMD64}" />
    <echo message="LinuxIA64=${isLinuxIA64}" />
    <echo message="LinuxX86=${isLinuxX86}" />
    <echo message="OS X=${isOSX}" />
    <echo message="Solaris=${isSolaris}" />
    <echo message="Unix=${isUnix}" />
    <echo message="Windows=${isWindows}" />
    <echo message="X11=${isX11}" />

    <property name="gluegen.cpptasks.detected.os" value="true" />
  </target>

  <!-- Detect compiler setup, in particular on Windows; separated
     - out because this must sometimes be called late in the setup process
    -->
  <target name="gluegen.cpptasks.detect.compiler">
    <!-- Set up compiler selection on Windows -->
    <condition property="isVC6">
      <and>
        <istrue value="${isWindows}" />
        <equals arg1="${win32.c.compiler}" arg2="vc6" />
      </and>
    </condition>
    <condition property="isVC7">
      <and>
        <istrue value="${isWindows}" />
        <equals arg1="${win32.c.compiler}" arg2="vc7" />
      </and>
    </condition>
    <condition property="isVC8">
      <and>
        <istrue value="${isWindows}" />
        <equals arg1="${win32.c.compiler}" arg2="vc8" />
      </and>
    </condition>
    <condition property="isVC8_X64">
      <and>
        <istrue value="${isWindows}" />
        <equals arg1="${win32.c.compiler}" arg2="vc8_x64" />
      </and>
    </condition>
    <condition property="isVC8Family">
      <or>
        <istrue value="${isVC8}" />
        <istrue value="${isVC8_X64}" />
      </or>
    </condition>
    <condition property="isMingW">
      <and>
        <istrue value="${isWindows}" />
        <equals arg1="${win32.c.compiler}" arg2="mingw" />
      </and>
    </condition>
    <condition property="WindowsFailure">
      <and>
        <istrue  value="${isWindows}" />
        <isfalse value="${isVC6}" />
        <isfalse value="${isVC7}" />
        <isfalse value="${isVC8}" />
        <isfalse value="${isVC8_X64}" />
        <isfalse value="${isMingW}" />
      </and>
    </condition>
    <fail message="Must specify either win32.c.compiler in jogl.properties or use e.g. win32.vc6 build target" if="WindowsFailure" />
    <echo message="VC6=${isVC6}" />
    <echo message="VC7=${isVC7}" />
    <echo message="VC8=${isVC8}" />
    <echo message="MingW=${isMingW}" />

    <!-- NOTE: the value of the debug and optimise attributes will not be overridden if already set externally -->
    <property name="c.compiler.debug"     value="false" /> 
  </target>
</project>