Graphics library for Mercury, including OpenGL bindings, TGA image reading, and X11, Win32, and SDL2 windowing and input.
Revision | 7b99202bc532d1e36a7f0ea359d6bc42cd680d64 (tree) |
---|---|
Time | 2023-06-30 08:41:05 |
Author | AlaskanEmily <emily@alas...> |
Commiter | AlaskanEmily |
Add Ant build file, GLFW demo can now be run with demo/saffron_glfw_demo.sh --java \o/
@@ -0,0 +1,282 @@ | ||
1 | +<!-- Any copyright is dedicated to the Public Domain. | |
2 | +https://creativecommons.org/publicdomain/zero/1.0/ --> | |
3 | +<!-- This build file is part of the Saffron graphics framework. --> | |
4 | + | |
5 | +<project default="saffron"> | |
6 | + | |
7 | + <!-- Location of Mercury jars, if not specified on the command line --> | |
8 | + <property name="saffron.mercurydir" location="."/> | |
9 | + | |
10 | + <!-- Location of lwjgl jar location, if not specified on the command line --> | |
11 | + <property name="saffron.lwjgldir" location="."/> | |
12 | + <property name="saffron.lwjgljar" location="${saffron.lwjgldir}/lwjgl.jar"/> | |
13 | + | |
14 | + <!-- mmath location, could reasonably be supplied by a calling project --> | |
15 | + <property name="saffron.mmathdir" location="mmath"/> | |
16 | + <property name="saffron.mmathjar" location="${saffron.mmathdir}/mmath.jar"/> | |
17 | + | |
18 | + <property name="saffron.saffrontgadir" location="util/tga"/> | |
19 | + <property name="saffron.saffrontgajar" location="${saffron.saffrontgadir}/saffron_tga.jar"/> | |
20 | + | |
21 | + <property name="saffron.saffronwindowdir" location="util/window"/> | |
22 | + <property name="saffron.saffronwindowjar" location="${saffron.saffronwindowdir}/saffron_window.jar"/> | |
23 | + | |
24 | + <property name="saffron.saffrondelegatedir" location="util/delegate"/> | |
25 | + <property name="saffron.saffrondelegatejar" location="${saffron.saffrondelegatedir}/saffron_delegate.jar"/> | |
26 | + | |
27 | + <property name="saffron.saffronglfwdir" location="util/glfw"/> | |
28 | + <property name="saffron.saffronglfwjar" location="${saffron.saffronglfwdir}/saffron_glfw.jar"/> | |
29 | + | |
30 | + <property name="saffron.demodir" location="demo"/> | |
31 | + <!-- Mercury properties --> | |
32 | + <condition property="saffron.mercury.default_mmc" value="mmc"> | |
33 | + <os family="unix"/> | |
34 | + </condition> | |
35 | + <condition property="saffron.mercury.default_mmc" value="mercury"> | |
36 | + <not> | |
37 | + <os family="unix"/> | |
38 | + </not> | |
39 | + </condition> | |
40 | + <property name="saffron.mercury.mmc" value="${saffron.mercury.default_mmc}"/> | |
41 | + <property name="saffron.mercury.grade" value="java"/> | |
42 | + <property name="saffron.mercury.parallel" value="4"/> | |
43 | + <property name="saffron.mercury.optimize" value="7"/> | |
44 | + | |
45 | + <!-- Mercury standard jars. --> | |
46 | + <property name="saffron.merstdjar" location="${saffron.mercurydir}/mer_std.jar"/> | |
47 | + <property name="saffron.merrtjar" location="${saffron.mercurydir}/mer_rt.jar"/> | |
48 | + | |
49 | + <!-- lwjgl jars --> | |
50 | + <property name="saffron.lwjgljar" location="${saffron.lwjgldir}/lwjgl.jar"/> | |
51 | + | |
52 | + <!-- Mercury MMC call macro --> | |
53 | + <macrodef name="call-mmc"> | |
54 | + <attribute name="dir" default="."/> | |
55 | + <attribute name="classpath" default="."/> | |
56 | + <attribute name="failonerror" default="true"/> | |
57 | + <attribute name="target"/> | |
58 | + <element name="mmcargs" optional="true"/> | |
59 | + <sequential> | |
60 | + <exec executable="${saffron.mercury.mmc}" dir="@{dir}" failonerror="@{failonerror}"> | |
61 | + <!-- Set grade --> | |
62 | + <arg value="--grade"/> | |
63 | + <arg value="${saffron.mercury.grade}"/> | |
64 | + | |
65 | + <!-- Set parallel option --> | |
66 | + <arg value="-j"/> | |
67 | + <arg value="${saffron.mercury.parallel}"/> | |
68 | + | |
69 | + <!-- Set optimization level --> | |
70 | + <arg value="-O"/> | |
71 | + <arg value="${saffron.mercury.optimize}"/> | |
72 | + | |
73 | + <!-- Default Saffron options --> | |
74 | + <arg value="--use-grade-subdirs"/> | |
75 | + <arg value="--intermodule-optimization"/> | |
76 | + <arg value="--output-compile-error-lines"/> | |
77 | + <arg value="1024"/> | |
78 | + | |
79 | + <arg value="--java-classpath"/> | |
80 | + <arg path="@{classpath}"/> | |
81 | + | |
82 | + <mmcargs/> | |
83 | + | |
84 | + <!-- Make target --> | |
85 | + <arg value="--make"/> | |
86 | + <arg value="@{target}"/> | |
87 | + </exec> | |
88 | + </sequential> | |
89 | + </macrodef> | |
90 | + | |
91 | + <!-- Builds Saffron --> | |
92 | + <target name="mmath"> | |
93 | + <call-mmc target="libmmath" dir="${saffron.mmathdir}"/> | |
94 | + </target> | |
95 | + <target name="saffron" depends="mmath"> | |
96 | + <call-mmc target="libsaffron"> | |
97 | + <mmcargs> | |
98 | + <arg value="--search-lib-files-dir"/> | |
99 | + <arg path="${saffron.mmathdir}"/> | |
100 | + <arg value="--init-file"/> | |
101 | + <arg path="${saffron.mmathdir}/mmath.init"/> | |
102 | + <arg value="--java-classpath"/> | |
103 | + <arg path="${saffron.mmathjar}"/> | |
104 | + | |
105 | + <arg value="--java-classpath"/> | |
106 | + <arg path="${saffron.lwjgljar}"/> | |
107 | + </mmcargs> | |
108 | + </call-mmc> | |
109 | + </target> | |
110 | + | |
111 | + <target name="saffron_tga"> | |
112 | + <call-mmc target="libsaffron_tga" dir="${saffron.saffrontgadir}"/> | |
113 | + </target> | |
114 | + <target name="saffron_window"> | |
115 | + <call-mmc target="libsaffron_window" dir="${saffron.saffronwindowdir}"/> | |
116 | + </target> | |
117 | + <target name="saffron_delegate" depends="saffron_window"> | |
118 | + <call-mmc target="libsaffron_delegate" dir="${saffron.saffrondelegatedir}"> | |
119 | + <mmcargs> | |
120 | + <arg value="--search-lib-files-dir"/> | |
121 | + <arg path="${saffron.saffronwindowdir}"/> | |
122 | + <arg value="--init-file"/> | |
123 | + <arg path="${saffron.saffronwindowdir}/saffron_window.init"/> | |
124 | + | |
125 | + <arg value="--java-classpath"/> | |
126 | + <arg path="${saffron.saffronwindowjar}"/> | |
127 | + </mmcargs> | |
128 | + </call-mmc> | |
129 | + </target> | |
130 | + <target name="saffron_glfw" depends="saffron,saffron_window,saffron_delegate"> | |
131 | + <call-mmc target="libsaffron_glfw" dir="${saffron.saffronglfwdir}"> | |
132 | + <mmcargs> | |
133 | + <arg value="--search-lib-files-dir"/> | |
134 | + <arg path="."/> | |
135 | + <arg value="--init-file"/> | |
136 | + <arg path="saffron.init"/> | |
137 | + <arg value="--java-classpath"/> | |
138 | + <arg path="saffron.jar"/> | |
139 | + | |
140 | + <arg value="--search-lib-files-dir"/> | |
141 | + <arg path="${saffron.mmathdir}"/> | |
142 | + <arg value="--init-file"/> | |
143 | + <arg path="${saffron.mmathdir}/mmath.init"/> | |
144 | + <arg value="--java-classpath"/> | |
145 | + <arg path="${saffron.mmathjar}"/> | |
146 | + | |
147 | + <arg value="--search-lib-files-dir"/> | |
148 | + <arg path="${saffron.saffronwindowdir}"/> | |
149 | + <arg value="--init-file"/> | |
150 | + <arg path="${saffron.saffronwindowdir}/saffron_window.init"/> | |
151 | + <arg value="--java-classpath"/> | |
152 | + <arg path="${saffron.saffronwindowjar}"/> | |
153 | + | |
154 | + <arg value="--search-lib-files-dir"/> | |
155 | + <arg path="${saffron.saffrondelegatedir}"/> | |
156 | + <arg value="--init-file"/> | |
157 | + <arg path="${saffron.saffrondelegatedir}/saffron_delegate.init"/> | |
158 | + <arg value="--java-classpath"/> | |
159 | + <arg path="${saffron.saffrondelegatejar}"/> | |
160 | + | |
161 | + <arg value="--java-classpath"/> | |
162 | + <arg path="${saffron.lwjgljar}"/> | |
163 | + </mmcargs> | |
164 | + </call-mmc> | |
165 | + </target> | |
166 | + | |
167 | + <!-- Demo components... --> | |
168 | + <property name="saffron.democratetga" location="demo/res/crate.tga"/> | |
169 | + <target name="demo_files"> | |
170 | + <copy file="test/res/tga/crate.tga" tofile="${saffron.democratetga}"/> | |
171 | + </target> | |
172 | + | |
173 | + <!-- Tasks to install jars to the demo dir. --> | |
174 | + <target name="install_saffron" depends="saffron"> | |
175 | + <copy todir="${saffron.demodir}" file="saffron.jar"/> | |
176 | + </target> | |
177 | + <target name="install_mmath" depends="mmath"> | |
178 | + <copy todir="${saffron.demodir}" file="${saffron.mmathjar}"/> | |
179 | + </target> | |
180 | + <target name="install_saffron_window" depends="saffron_window"> | |
181 | + <copy todir="${saffron.demodir}" file="${saffron.saffronwindowjar}"/> | |
182 | + </target> | |
183 | + <target name="install_saffron_delegate" depends="saffron_delegate"> | |
184 | + <copy todir="${saffron.demodir}" file="${saffron.saffrondelegatejar}"/> | |
185 | + </target> | |
186 | + <target name="install_saffron_glfw" depends="saffron_glfw"> | |
187 | + <copy todir="${saffron.demodir}" file="${saffron.saffronglfwjar}"/> | |
188 | + </target> | |
189 | + <target name="install_saffron_tga" depends="saffron_tga"> | |
190 | + <copy todir="${saffron.demodir}" file="${saffron.saffrontgajar}"/> | |
191 | + </target> | |
192 | + <target name="install_lwjgl"> | |
193 | + <copy todir="${saffron.demodir}" file="${saffron.lwjgljar}"/> | |
194 | + </target> | |
195 | + <target name="install_mercury"> | |
196 | + <copy todir="${saffron.demodir}" file="${saffron.merstdjar}"/> | |
197 | + <copy todir="${saffron.demodir}" file="${saffron.merrtjar}"/> | |
198 | + </target> | |
199 | + | |
200 | + <!-- GLFW demo --> | |
201 | + <target name="saffron_glfw_demo" depends="demo_files,install_saffron,install_saffron_window,install_saffron_delegate,install_saffron_glfw,install_saffron_tga,install_mmath,install_lwjgl,install_mercury"> | |
202 | + <call-mmc target="saffron_glfw_demo" dir="${saffron.demodir}"> | |
203 | + <mmcargs> | |
204 | + <arg value="--search-lib-files-dir"/> | |
205 | + <arg path="."/> | |
206 | + <arg value="--init-file"/> | |
207 | + <arg path="saffron.init"/> | |
208 | + <arg value="--java-classpath"/> | |
209 | + <arg value="saffron.jar"/> | |
210 | + | |
211 | + <arg value="--search-lib-files-dir"/> | |
212 | + <arg path="${saffron.mmathdir}"/> | |
213 | + <arg value="--init-file"/> | |
214 | + <arg path="${saffron.mmathdir}/mmath.init"/> | |
215 | + <arg value="--java-classpath"/> | |
216 | + <arg value="mmath.jar"/> | |
217 | + | |
218 | + <arg value="--search-lib-files-dir"/> | |
219 | + <arg path="${saffron.saffronwindowdir}"/> | |
220 | + <arg value="--init-file"/> | |
221 | + <arg path="${saffron.saffronwindowdir}/saffron_window.init"/> | |
222 | + <arg value="--java-classpath"/> | |
223 | + <arg value="saffron_window.jar"/> | |
224 | + | |
225 | + <arg value="--search-lib-files-dir"/> | |
226 | + <arg path="${saffron.saffrondelegatedir}"/> | |
227 | + <arg value="--init-file"/> | |
228 | + <arg path="${saffron.saffrondelegatedir}/saffron_delegate.init"/> | |
229 | + <arg value="--java-classpath"/> | |
230 | + <arg value="saffron_delegate.jar"/> | |
231 | + | |
232 | + <arg value="--search-lib-files-dir"/> | |
233 | + <arg path="${saffron.saffronglfwdir}"/> | |
234 | + <arg value="--init-file"/> | |
235 | + <arg path="${saffron.saffronglfwdir}/saffron_glfw.init"/> | |
236 | + <arg value="--java-classpath"/> | |
237 | + <arg value="saffron_glfw.jar"/> | |
238 | + | |
239 | + <arg value="--search-lib-files-dir"/> | |
240 | + <arg path="${saffron.saffrontgadir}"/> | |
241 | + <arg value="--init-file"/> | |
242 | + <arg path="${saffron.saffrontgadir}/saffron_tga.init"/> | |
243 | + <arg value="--java-classpath"/> | |
244 | + <arg value="saffron_tga.jar"/> | |
245 | + | |
246 | + <arg value="--java-classpath"/> | |
247 | + <arg value="lwjgl.jar"/> | |
248 | + </mmcargs> | |
249 | + </call-mmc> | |
250 | + </target> | |
251 | + | |
252 | + <target name="all" depends="saffron,saffron_tga,saffron_window"/> | |
253 | + | |
254 | + <target name="clean"> | |
255 | + <parallel> | |
256 | + <delete file="saffron.jar" failonerror="false"/> | |
257 | + <delete file="saffron.init" failonerror="false"/> | |
258 | + <delete file="${saffron.democratetga}" failonerror="false"/> | |
259 | + <delete failonerror="false"> | |
260 | + <fileset dir="${saffron.demodir}" includes="*.jar"/> | |
261 | + </delete> | |
262 | + | |
263 | + <delete file="${saffron.mmathdir}/mmath.jar" failonerror="false"/> | |
264 | + <delete file="${saffron.mmathdir}/mmath.init" failonerror="false"/> | |
265 | + | |
266 | + <delete file="${saffron.saffrontgadir}/saffron_tga.jar" failonerror="false"/> | |
267 | + <delete file="${saffron.saffrontgadir}/saffron_tga.init" failonerror="false"/> | |
268 | + | |
269 | + <delete file="${saffron.saffronwindowdir}/saffron_window.jar" failonerror="false"/> | |
270 | + <delete file="${saffron.saffronwindowdir}/saffron_window.init" failonerror="false"/> | |
271 | + | |
272 | + <call-mmc target="mmath.clean" dir="${saffron.mmathdir}" failonerror="false"/> | |
273 | + <call-mmc target="saffron_tga.clean" dir="${saffron.saffrontgadir}"/> | |
274 | + <call-mmc target="saffron_window.clean" dir="${saffron.saffronwindowdir}"/> | |
275 | + <call-mmc target="saffron_delegate.clean" dir="${saffron.saffrondelegatedir}"/> | |
276 | + <call-mmc target="saffron_glfw.clean" dir="${saffron.saffronglfwdir}"/> | |
277 | + <call-mmc target="saffron.clean" failonerror="false"/> | |
278 | + </parallel> | |
279 | + </target> | |
280 | + | |
281 | +</project> | |
282 | + |