Mercurial > projects > dwt2
diff 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 |
line wrap: on
line diff
--- a/rakefile Sun Mar 22 15:17:04 2009 +0100 +++ b/rakefile Sun Mar 22 19:55:00 2009 +0100 @@ -11,6 +11,7 @@ OBJDIR =File.expand_path("obj") DIMPDIR =File.expand_path("imp") LIBDIR =File.expand_path("lib") +BINDIR =File.expand_path("bin") RSPNAME =File.expand_path("rsp") ALL_RESDIRS= [ "base/res", "res" ] @@ -201,3 +202,92 @@ task :default => [ :clean, :all ] +desc "Build SWT Snippet Collection" +task :swtsnippets do + + snps_browser = [ "Snippet128", "Snippet136" ] + snps_opengl = [ "Snippet174", "Snippet195" ] + + snps_exclude = snps_browser + snps_opengl + allsnippets = FileList[ File.join("org.eclipse.swt.snippets", "src", "**/Snippet*.d" )] + allsnippets.each do | snp | + puts "Building #{snp}" + if snp =~ /.*(Snippet\w+)\.d$/ + snpname = $1 + if !snps_exclude.include? snpname + buildApp( "org.eclipse.swt.snippets", "src", "res", "", snpname ) + end + else + puts snp + raise "Name does not match" + end + end +end + +def buildApp( basedir, srcdir, resdir, dflags, appname, filelist=nil ) + if filelist == nil + filelist = FileList[ "**/#{appname}.d" ] + end + + srcdir_abs = File.expand_path( File.join( basedir, srcdir)) + resdir_abs = File.expand_path( File.join( basedir, resdir)) + + rsp = File.new( RSPNAME, "w+" ) + rsp.puts "-I#{srcdir_abs.to_path}" + rsp.puts "-I#{DIMPDIR.to_path}" + rsp.puts "-J#{resdir_abs.to_path}" + if dflags.size > 0 then + rsp.puts dflags + end + ALL_RESDIRS.each do | dir | + rsp.puts "-J#{File.expand_path(dir).to_path}" + end + rsp.print "-L" + rsp.print "+advapi32" + rsp.print "+comctl32" + rsp.print "+comdlg32" + rsp.print "+gdi32" + rsp.print "+kernel32" + rsp.print "+shell32" + rsp.print "+ole32" + rsp.print "+oleaut32" + rsp.print "+olepro32" + rsp.print "+oleacc" + rsp.print "+user32" + rsp.print "+usp10" + rsp.print "+msimg32" + rsp.print "+opengl32" + rsp.print "+shlwapi" + rsp.print "+tango-user-dmd.lib" + rsp.print "+zlib.lib" + rsp.print "+dwt-base.lib" + rsp.print "+org.eclipse.swt.win32.win32.x86.lib" + rsp.print "+#{LIBDIR.to_path}\\" + rsp.puts + + rsp.puts "-op" + rsp.puts "-od#{OBJDIR.to_path}" + applfile = File.join(BINDIR,appname+EXEEXT) + rsp.puts "-of#{applfile.to_path}" + filelist.each do |path| + rsp.puts File.expand_path(path).to_path + end + rsp.close + + Dir.chdir(basedir) do + if isWindows + cmd = "#{DMD} @#{RSPNAME.to_path}" + else + cmd = "cat #{RSPNAME.to_path} | xargs #{DMD}" + end + sh cmd, :verbose => false do |ok, res| + if !ok then + raise "compile error" + end + end + end + +end + + +