forked from fathominfo/processing-p5js-mode
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
executable file
·263 lines (215 loc) · 8.52 KB
/
build.xml
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
<project name="esp-mode" default="install">
<!-- Sets properties for macosx/windows/linux depending on current system -->
<condition property="platform" value="macosx">
<os family="mac" />
</condition>
<condition property="platform" value="windows">
<os family="windows" />
</condition>
<condition property="platform" value="linux">
<and>
<os family="unix" />
<not>
<os family="mac" />
</not>
</and>
</condition>
<property file="local.properties" />
<condition property="props.present">
<available file="local.properties" />
</condition>
<fail unless="props.present"
message=" ${line.separator}Missing file.
${line.separator}Create a file named local.properties inside the dist folder,
${line.separator}and write a line that reads:
${line.separator}processing.dir=/path/to/processing-git
${line.separator}with the path to where you have the code for processing checked out
${line.separator}and another line that reads:
${line.separator}sketchbook.dir=/path/to/your/sketchbook
${line.separator}and another line that reads:
${line.separator}esp.dir=/path/to/esp-git" />
<property name="me" value="ESPMode" />
<property name="install.dir"
value="${sketchbook.dir}/modes/${me}" />
<property name="jar.path"
value="mode/${me}.jar" />
<property name="dist.path"
value="${me}.zip" />
<property name="ofVersion" value="v0.9.3" />
<condition property="ofFile" value="of_${ofVersion}_osx_release">
<os family="mac" />
</condition>
<condition property="ofFile" value="of_${ofVersion}_vs_release">
<os family="windows" />
</condition>
<condition property="ofFile" value="of_${ofVersion}_linux64_release">
<os family="unix" />
</condition>
<condition property="ofZipFile" value="${ofFile}.tar.gz" else="${ofFile}.zip">
<os family="unix" />
</condition>
<condition property="ofZipFile.present">
<available file="${ofZipFile}" />
</condition>
<condition property="of.present">
<available file="core/library/openFrameworks" />
</condition>
<target name="download.of" unless="ofZipFile.present">
<get src="http://openframeworks.cc/versions/${ofVersion}/${ofZipFile}"
dest="${ofZipFile}" verbose="on" />
</target>
<target name="macosx-install.of">
<unzip src="${ofZipFile}" dest="core/library" />
<move file="core/library/${ofFile}" tofile="core/library/openFrameworks" />
</target>
<target name="windows-install.of">
<unzip src="${ofZipFile}" dest="core/library" />
<move file="core/library/${ofFile}" tofile="core/library/openFrameworks" />
</target>
<target name="linux-install.of">
<untar src="${ofZipFile}" dest="core/library" compression="gzip" />
<move file="core/library/${ofFile}" tofile="core/library/openFrameworks" />
</target>
<target name="install.of" depends="download.of" unless="of.present">
<antcall target="${platform}-install.of" />
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<target name="macosx-install.libs">
<copy file="${esp.dir}/Xcode/ESP/bin/libesp.a" todir="core/library" />
<copy file="${esp.dir}/Xcode/ESP/libgrt.dylib" todir="core/library" />
</target>
<target name="windows-install.libs">
<copy file="${esp.dir}/third-party/openFrameworks/libs/openFrameworksCompiled/lib/vs/Win32/openframeworksLib_debug.lib" todir="core/library" />
<copy file="${esp.dir}/Xcode/ESP/bin/ESPlib_debug.lib" todir="core/library" />
<copy file="${esp.dir}/Xcode/ESP/grt.lib" todir="core/library" />
</target>
<target name="linux-install.libs">
<copy file="${esp.dir}/third-party/grt/build/tmp/libgrt.so" todir="core/library" />
<copy file="${esp.dir}/build/libesp.a" todir="core/library" />
<copy file="${esp.dir}/third-party/openFrameworks/libs/openFrameworksCompiled/lib/linux64/libopenFrameworksDebug.a" todir="core/library" />
</target>
<target name="install.libs">
<antcall target="${platform}-install.libs" />
</target>
<target name="install.includes">
<copy todir="core/include/ESP">
<fileset dir="${esp.dir}/Xcode/ESP/src">
<include name="**/*.h" />
</fileset>
</copy>
<copy todir="core/include/GRT">
<fileset dir="${esp.dir}/third-party/grt/GRT">
<include name="**/*.h" />
</fileset>
</copy>
<copy todir="core/include/ofxDatGui">
<fileset dir="${esp.dir}/third-party/ofxDatGui/src">
<include name="**/*.h" />
</fileset>
</copy>
<copy todir="core/include/ofxGrt">
<fileset dir="${esp.dir}/third-party/ofxGrt/src">
<include name="**/*.h" />
</fileset>
</copy>
<copy todir="core/include/ofxParagraph">
<fileset dir="${esp.dir}/third-party/ofxParagraph/src">
<include name="**/*.h" />
</fileset>
</copy>
</target>
<target name="install.data">
<copy todir="core/data">
<fileset file="${esp.dir}/Xcode/ESP/bin/data/**" />
</copy>
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<target name="examples">
<delete dir="examples" />
<copy todir="examples/ESP">
<fileset dir="${esp.dir}/Xcode/ESP/src/examples" includes="*.cpp" />
<regexpmapper from="(.*).cpp" to="\1/\1.cpp" />
</copy>
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<target name="build" depends="install.of,install.libs,install.includes,install.data,examples">
<!-- Locate the JDT compiler, since we know processing.dir must exist and
using the JDT allows us to build the PDE with only a JRE on Windows
and Linux. If something goes wrong, javac (the "modern" compiler)
will be used instead. (Logic from processing/core/build.xml) -->
<property name="jdt.jar"
value="${processing.dir}/java/mode/org.eclipse.jdt.core.jar" />
<condition property="build.compiler"
value="org.eclipse.jdt.core.JDTCompilerAdapter"
else="modern">
<available file="${jdt.jar}" />
</condition>
<!--<echo message="compiler is ${build.compiler}" />-->
<mkdir dir="bin" />
<javac source="1.8"
target="1.8"
encoding="UTF-8"
includeAntRuntime="false"
debug="true"
srcdir="src"
destdir="bin"
classpath="${processing.dir}/core/bin;
${processing.dir}/app/bin;
${processing.dir}/java/bin"
nowarn="true">
<!-- kinda gross, but if not using the JDT, this just ignored anyway -->
<compilerclasspath path="${jdt.jar}; ${processing.dir}/java/mode/jdtCompilerAdapter.jar" />
</javac>
<!-- make sure this exists -->
<mkdir dir="mode" />
<jar destfile="${jar.path}">
<fileset dir="bin" />
</jar>
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<target name="install" depends="build">
<copy todir="${install.dir}/core">
<fileset dir="core" />
</copy>
<copy todir="${install.dir}/examples">
<fileset dir="examples" />
</copy>
<copy todir="${install.dir}/mode">
<fileset dir="mode" />
</copy>
<copy todir="${install.dir}/template">
<fileset dir="template" />
</copy>
<copy todir="${install.dir}">
<fileset file="mode.properties" />
<fileset file="keywords.txt" />
</copy>
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<target name="clean">
<delete dir="${install.dir}" />
<delete dir="bin" />
<delete file="${jar.path}" />
<delete dir="mode" />
<delete file="${me}.zip" />
<delete file="${me}.txt" />
<delete dir="examples" />
<delete dir="core/include" />
<delete dir="core/library" />
<delete dir="core/Resources" />
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<target name="dist" depends="build">
<zip destfile="${dist.path}">
<!-- This can probably be done more efficiently, no? How about a PR? -->
<zipfileset dir="." prefix="ESPMode" includes="core/**" />
<zipfileset dir="." prefix="ESPMode" includes="examples/**" />
<zipfileset dir="." prefix="ESPMode" includes="keywords.txt" />
<zipfileset dir="." prefix="ESPMode" includes="libraries/**" />
<zipfileset dir="." prefix="ESPMode" includes="mode/**" />
<zipfileset dir="." prefix="ESPMode" includes="mode.properties" />
<zipfileset dir="." prefix="ESPMode" includes="template/**" />
</zip>
<copy file="mode.properties" tofile="${me}.txt" />
</target>
</project>