comparison rakefile @ 29:4e5843b771cc

First snippets buildable on windows
author Frank Benoit <benoit@tionex.de>
date Sun, 22 Mar 2009 19:55:00 +0100
parents 69b1fa94a4a8
children 93b0e7382fd5
comparison
equal deleted inserted replaced
28:69b1fa94a4a8 29:4e5843b771cc
9 #DMD="c:\\project\\dmd-2.026\\dmd\\windows\\bin\\dmd.exe" 9 #DMD="c:\\project\\dmd-2.026\\dmd\\windows\\bin\\dmd.exe"
10 DMD="dmd" 10 DMD="dmd"
11 OBJDIR =File.expand_path("obj") 11 OBJDIR =File.expand_path("obj")
12 DIMPDIR =File.expand_path("imp") 12 DIMPDIR =File.expand_path("imp")
13 LIBDIR =File.expand_path("lib") 13 LIBDIR =File.expand_path("lib")
14 BINDIR =File.expand_path("bin")
14 RSPNAME =File.expand_path("rsp") 15 RSPNAME =File.expand_path("rsp")
15 ALL_RESDIRS= [ "base/res", "res" ] 16 ALL_RESDIRS= [ "base/res", "res" ]
16 17
17 LOG_STDOUT = File.expand_path("olog.txt") 18 LOG_STDOUT = File.expand_path("olog.txt")
18 LOG_STDERR = File.expand_path("elog.txt") 19 LOG_STDERR = File.expand_path("elog.txt")
199 200
200 desc "Clean, then build ALL" 201 desc "Clean, then build ALL"
201 task :default => [ :clean, :all ] 202 task :default => [ :clean, :all ]
202 203
203 204
205 desc "Build SWT Snippet Collection"
206 task :swtsnippets do
207
208 snps_browser = [ "Snippet128", "Snippet136" ]
209 snps_opengl = [ "Snippet174", "Snippet195" ]
210
211 snps_exclude = snps_browser + snps_opengl
212 allsnippets = FileList[ File.join("org.eclipse.swt.snippets", "src", "**/Snippet*.d" )]
213 allsnippets.each do | snp |
214 puts "Building #{snp}"
215 if snp =~ /.*(Snippet\w+)\.d$/
216 snpname = $1
217 if !snps_exclude.include? snpname
218 buildApp( "org.eclipse.swt.snippets", "src", "res", "", snpname )
219 end
220 else
221 puts snp
222 raise "Name does not match"
223 end
224 end
225 end
226
227 def buildApp( basedir, srcdir, resdir, dflags, appname, filelist=nil )
228 if filelist == nil
229 filelist = FileList[ "**/#{appname}.d" ]
230 end
231
232 srcdir_abs = File.expand_path( File.join( basedir, srcdir))
233 resdir_abs = File.expand_path( File.join( basedir, resdir))
234
235 rsp = File.new( RSPNAME, "w+" )
236 rsp.puts "-I#{srcdir_abs.to_path}"
237 rsp.puts "-I#{DIMPDIR.to_path}"
238 rsp.puts "-J#{resdir_abs.to_path}"
239 if dflags.size > 0 then
240 rsp.puts dflags
241 end
242 ALL_RESDIRS.each do | dir |
243 rsp.puts "-J#{File.expand_path(dir).to_path}"
244 end
245 rsp.print "-L"
246 rsp.print "+advapi32"
247 rsp.print "+comctl32"
248 rsp.print "+comdlg32"
249 rsp.print "+gdi32"
250 rsp.print "+kernel32"
251 rsp.print "+shell32"
252 rsp.print "+ole32"
253 rsp.print "+oleaut32"
254 rsp.print "+olepro32"
255 rsp.print "+oleacc"
256 rsp.print "+user32"
257 rsp.print "+usp10"
258 rsp.print "+msimg32"
259 rsp.print "+opengl32"
260 rsp.print "+shlwapi"
261 rsp.print "+tango-user-dmd.lib"
262 rsp.print "+zlib.lib"
263 rsp.print "+dwt-base.lib"
264 rsp.print "+org.eclipse.swt.win32.win32.x86.lib"
265 rsp.print "+#{LIBDIR.to_path}\\"
266 rsp.puts
267
268 rsp.puts "-op"
269 rsp.puts "-od#{OBJDIR.to_path}"
270 applfile = File.join(BINDIR,appname+EXEEXT)
271 rsp.puts "-of#{applfile.to_path}"
272 filelist.each do |path|
273 rsp.puts File.expand_path(path).to_path
274 end
275 rsp.close
276
277 Dir.chdir(basedir) do
278 if isWindows
279 cmd = "#{DMD} @#{RSPNAME.to_path}"
280 else
281 cmd = "cat #{RSPNAME.to_path} | xargs #{DMD}"
282 end
283 sh cmd, :verbose => false do |ok, res|
284 if !ok then
285 raise "compile error"
286 end
287 end
288 end
289
290 end
291
292
293