PageRenderTime 73ms CodeModel.GetById 28ms RepoModel.GetById 1ms app.codeStats 0ms

/Rakefile

https://bitbucket.org/abexsoft/ruby-ogre
Rakefile | 109 lines | 81 code | 18 blank | 10 comment | 2 complexity | d5be8600e02243c36d7124d020dc8075 MD5 | raw file
Possible License(s): MIT
  1. require 'rake/clean'
  2. require 'ruby-ois'
  3. desc "Download a ruby-ogre gem from bitbucket."
  4. task :default do
  5. require 'open-uri'
  6. UPLOAD_SITE="http://cdn.bitbucket.org/abexsoft/ruby-ogre/downloads"
  7. RUBY_OGRE_GEM="ruby-ogre-0.1.0-x86-linux.gem"
  8. puts "Downloading #{RUBY_OGRE_GEM} from #{UPLOAD_SITE}..."
  9. File.open("#{RUBY_OGRE_GEM}", "wb") do |gem_file|
  10. open("#{UPLOAD_SITE}/#{RUBY_OGRE_GEM}", 'rb') do |read_file|
  11. gem_file.write(read_file.read)
  12. end
  13. end
  14. puts "Installing #{RUBY_OGRE_GEM}..."
  15. system("gem install #{RUBY_OGRE_GEM}")
  16. end
  17. desc "Download a ogre source."
  18. task :download do
  19. FileUtils::mkdir_p("deps/src")
  20. chdir('deps/src') {
  21. if /mingw/ =~ RUBY_PLATFORM
  22. sh "wget http://sourceforge.net/projects/ogre/files/ogre/1.8/1.8.0/OgreSDK_MinGW_v1-8-0.exe"
  23. sh "OgreSDK_MinGW_v1-8-0.exe"
  24. sh "cp -a OgreSDK_MinGW_v1-8-0/include ../"
  25. sh "cp -a OgreSDK_MinGW_v1-8-0/boost/boost ../include"
  26. sh "cp -a OgreSDK_MinGW_v1-8-0/lib ../"
  27. sh "cp -a OgreSDK_MinGW_v1-8-0/boost/lib/* ../lib"
  28. else
  29. OGRE_FILE="ogre_src_v1-8-1.tar.bz2"
  30. sh "wget http://sourceforge.net/projects/ogre/files/ogre/1.8/1.8.1/#{OGRE_FILE}"
  31. sh "tar xjvf #{OGRE_FILE}"
  32. end
  33. }
  34. end
  35. desc "Compile ogre libraries."
  36. task :compile do
  37. unless /mingw/ =~ RUBY_PLATFORM
  38. chdir("deps/src/ogre_src_v1-8-1/") {
  39. sh "cmake -DCMAKE_INSTALL_PREFIX:PATH=../.. -DOGRE_INSTALL_SAMPLES:BOOL=ON -DOIS_INCLUDE_DIR:PATH=#{Ruby::Ois::get_top_path}/deps/include/OIS -DOIS_LIBRARY_DBG:FILEPATH=#{Ruby::Ois::get_top_path}/deps/lib/libOIS.so -DOIS_LIBRARY_REL:FILEPATH=#{Ruby::Ois::get_top_path}/deps/lib/libOIS.so -DCMAKE_MODULE_LINKER_FLAGS:STRING='-static-libgcc -static-libstdc++' -DCMAKE_SHARED_LINKER_FLAGS:STRING='-static-libgcc -static-libstdc++'"
  40. sh "make -j4 && make install"
  41. }
  42. end
  43. end
  44. #
  45. # Compile extensions
  46. #
  47. DLEXT = RbConfig::MAKEFILE_CONFIG['DLEXT']
  48. ## lib/*.#{DLEXT}
  49. file "lib/ogre.#{DLEXT}" => "bindings/ogre/ogre.#{DLEXT}" do |f|
  50. cp f.prerequisites, "lib/", :preserve => true
  51. end
  52. file "lib/ogrebites.#{DLEXT}" => "bindings/ogrebites/ogrebites.#{DLEXT}" do |f|
  53. cp f.prerequisites, "lib/", :preserve => true
  54. end
  55. ## ext/**/*.#{DLEXT}
  56. file "bindings/ogre/ogre.#{DLEXT}" => FileList["bindings/ogre/Makefile"] do |f|
  57. sh 'cd bindings/ogre/ && make clean && make'
  58. end
  59. CLEAN.include 'bindings/ogre/*.{o,so,dll}'
  60. file "bindings/ogrebites/ogrebites.#{DLEXT}" => FileList["bindings/ogrebites/Makefile"] do |f|
  61. sh 'cd bindings/ogrebites && make clean && make'
  62. end
  63. CLEAN.include 'bindings/ogrebites/*.{o,so,dll}'
  64. ## ext/**/Makefile
  65. file 'bindings/ogre/Makefile' => FileList['bindings/ogre/interface/ogre_wrap.cpp'] do
  66. chdir('bindings/ogre/') { ruby 'extconf.rb' }
  67. end
  68. CLEAN.include 'bindings/ogre/Makefile'
  69. file 'bindings/ogrebites/Makefile' => FileList['bindings/ogrebites/interface/ogrebites_wrap.cpp'] do
  70. chdir('bindings/ogrebites/') { ruby 'extconf.rb' }
  71. end
  72. CLEAN.include 'bindings/ogrebites/Makefile'
  73. ## make wrappers with swig.
  74. file 'bindings/ogre/interface/ogre_wrap.cpp' do
  75. chdir('bindings/ogre/interface') { sh 'rake' }
  76. end
  77. CLEAN.include 'bindings/ogre/interface/ogre_wrap.{cpp,h,o}'
  78. file 'bindings/ogrebites/interface/ogrebites_wrap.cpp' do
  79. chdir('bindings/ogrebites/interface') { sh 'rake' }
  80. end
  81. CLEAN.include 'bindings/ogrebites/interface/ogrebites_wrap.{cpp,h,o}'
  82. desc "Compile all of extension libraries."
  83. task :build => ["lib/ogre.#{DLEXT}", "lib/ogrebites.#{DLEXT}"]
  84. #
  85. # Document
  86. #
  87. desc 'Create documents'
  88. task :doc => ['bindings/ogre/interface/ogre_wrap.cpp',
  89. 'bindings/ogrebites/interface/ogrebites_wrap.cpp'] do |f|
  90. sh "rdoc #{f.prerequisites.join(' ')}"
  91. end