require 'rake/testtask' require 'rake/rdoctask' require 'rake/contrib/sshpublisher' require 'rake/gempackagetask' require 'platform' require 'lib/rake/project_builder' task :default => :test OGRE_RB_VERSION = "0.1" Rake::TestTask.new do |t| t.libs << "test" t.test_files = FileList["test/**/*_test.rb"] t.verbose = true end ########################### # Project Managment tasks # ########################### RDOC_INCLUDES = %w( README doc_src/**/*.rb lib/application.rb lib/application_frame_listener.rb lib/application_loading_bar.rb lib/constants.rb lib/method_fixes.rb ) RDOC_OPTIONS = ['-S', '-t Ogre.rb Documentation'] Rake::RDocTask.new do |t| t.main = "README" t.rdoc_files.include(RDOC_INCLUDES) t.options += RDOC_OPTIONS end RUBYFORGE_USERNAME = "jameskilton" PROJECT_WEB_PATH = "/var/www/gforge-projects/ogrerb" desc "Update the website" task :upload_web => :rdoc do |t| unless File.directory?("publish") mkdir "publish" mkdir "publish/docs" end sh "svn export --force website publish/" sh "cp -r html/* publish/docs/" Rake::SshDirPublisher.new("#{RUBYFORGE_USERNAME}@rubyforge.org", PROJECT_WEB_PATH, "publish").upload rm_rf "publish" end ## Gem Compilation ## ogre_rb_spec = Gem::Specification.new do |s| s.platform = Gem::Platform::CURRENT lib_files = "" if Platform.windows? lib_files = %w(lib/ogre.dll lib/ruby_ois.dll) elsif Platform.mac? lib_files = %w(lib/ogre.bundle lib/ruby_ois.bundle) else # Posix environment lib_files = %w(lib/ogre.so lib/ruby_ois.so) end s.name = 'ogre.rb' s.version = OGRE_RB_VERSION s.summary = "Ruby wrapper for Ogre 3D" s.description = %q{Ogre.rb is a SWIG wrapper to allow access to the Ogre 3D API from Ruby.} s.author = "Jason Roelofs" s.email = "jameskilton@gmail.com" s.rubyforge_project = 'ogrerb' s.homepage = 'http://ogrerb.rubyforge.org' s.require_path = '.' s.required_ruby_version = '>= 1.8.4' # Inform of the need to have Ogre installed and OGRE_HOME set s.requirements << "Ogre Einhort (1.4)" s.requirements << "Environment variable OGRE_HOME set" #s.has_rdoc = false #s.extra_rdoc_files += RDOC_INCLUDES #s.rdoc_options += RDOC_OPTIONS files = FileList.new %w( README platform.rb ogre.rb Rakefile lib/*.rb samples/**/* doc_src/**/* ) do |fl| fl.exclude(/navi/) end files += lib_files s.files = files end desc 'Package as gem & zip' Rake::GemPackageTask.new(ogre_rb_spec) do |p| p.gem_spec = ogre_rb_spec end ############################# # Project compilation tasks # ############################# desc "Build rubyw on the mac platform, needed for ogrerb to run properly." task :build_mac_rubyw do if Platform.mac? sh "ruby=`which ruby`; rubyw=${ruby}w; sudo cp $ruby $rubyw; sudo /Developer/Tools/Rez -t APPL Carbon.r -o $rubyw" else puts "This is only to be run on Mac OS X" end end ############################################# # Project registration helpers documentation: # # project.swig_file => # The name of the main swig interface file (sans .i) (default: project name) # # project.swig_includes => # The include declarations needed for this project to swigify # # project.swig => # Create a block that gets called after swig is done running, for post processing # # project.resulting_library => # The final name of the built library (default: project name) # # # TODO Looks like I can pull the swig block into the template, as all projects seem # to need this STL fix ############################################# register_project :ogre do |project| project.swig_file = "ogre_rb" project.swig_includes = %w(-I./src_headers/OGRE -I./src_headers/wrappers -I./src_headers/OIS) project.swig do if Platform.windows? # compensate for windows stl. Uses wrong version when ruby is first. insert_headers("build/ogre/ogre_rb_wrap.cpp") do <<-EOF #include "Ogre.h" #include EOF end end end end register_project :ois do |project| project.resulting_library = "ruby_ois" project.swig_includes = %w(-I./src_headers/OIS -I./src_headers/wrappers) project.swig do if Platform.windows? insert_headers("build/ois/ois_wrap.cpp") do <<-EOF #include "OIS.h" EOF end end end end register_project :navi do |project| project.swig_file = "navi_rb" project.swig_includes = %w(-I./src_headers/navi -I./src_headers/wrappers) project.swig do if Platform.windows? insert_headers("build/navi/navi_rb_wrap.cpp") do <<-EOF #include "Ogre.h" #include EOF end end end end