-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathRakefile
More file actions
86 lines (71 loc) · 2.36 KB
/
Rakefile
File metadata and controls
86 lines (71 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
require 'rubygems/package_task'
require 'rake/clean'
BULLET_FILE = "bullet-2.82-r2704.tgz"
BULLET_DIR = "bullet-2.82-r2704"
desc 'All clean'
task :cleanall do
sh "rm -rf deps/include"
sh "rm -rf deps/lib"
sh "rm -rf deps/src/#{BULLET_DIR}"
sh "rm -f deps/src/#{BULLET_FILE}"
end
desc 'Download the source packages.'
task :download do
FileUtils::mkdir_p("deps/src")
chdir('deps/src') {
BULLET_FILE = "bullet-2.82-r2704.tgz"
sh "wget http://bullet.googlecode.com/files/#{BULLET_FILE}"
sh "tar xzvf #{BULLET_FILE}"
}
end
desc 'Compile bullet libraries.'
task :compile do
chdir("deps/src/#{BULLET_DIR}") {
if /mingw/ =~ RUBY_PLATFORM
sh 'cmake . -G "MSYS Makefiles" -DUSE_GLUT:BOOL=OFF -DBUILD_DEMOS:BOOL=OFF -DCMAKE_INSTALL_PREFIX:PATH=..\
\.. -DINCLUDE_INSTALL_DIR:PATH=include\\bullet -DLIB_DESTINATION:STRING=..\\..\\lib -DPKGCONFIG_INSTALL_PR
EFIX:STRING=..\\..\\lib\\pkgconfig\\'
sh "make -j4"
system('mkdir ..\..\lib')
system('mkdir ..\..\include\bullet')
sh "cp -a lib/*.a ../../lib"
sh "cp -a src/* ../../include/bullet"
else
sh "cmake -DCMAKE_INSTALL_PREFIX:PATH=../.. -DINCLUDE_INSTALL_DIR:PATH=include/bullet -DLIB_DESTINATION:STRING=../../lib -DPKGCONFIG_INSTALL_PREFIX:STRING=../../lib/pkgconfig/"
sh "make -j4 && make install"
end
}
end
#
# Extension
#
DLEXT = RbConfig::MAKEFILE_CONFIG['DLEXT']
task :default => :build
desc 'Compile a bullet extension library.'
task :build => ["lib/bullet.#{DLEXT}"]
## lib/*.#{DLEXT}
file "lib/bullet.#{DLEXT}" => "bindings/bullet/bullet.#{DLEXT}" do |f|
cp f.prerequisites, "lib/", :preserve => true
end
## ext/**/*.#{DLEXT}
file "bindings/bullet/bullet.#{DLEXT}" => FileList["bindings/bullet/Makefile"] do |f|
sh 'cd bindings/bullet/ && make clean && make'
end
CLEAN.include 'bindings/bullet/*.{o,so,dll}'
## ext/**/Makefile
file 'bindings/bullet/Makefile' => FileList['bindings/bullet/interface/bullet_wrap.cpp'] do
chdir('bindings/bullet/') { ruby 'extconf.rb' }
end
CLEAN.include 'bindings/bullet/Makefile'
## make wrappers with swig.
file 'bindings/bullet/interface/bullet_wrap.cpp' do
chdir('bindings/bullet/interface') { sh 'rake' }
end
CLEAN.include 'bindings/bullet/interface/bullet_wrap.{cpp,h,o}'
#
# Document
#
desc 'Create documents'
task :doc => ['bindings/bullet/interface/bullet_wrap.cpp'] do |f|
sh "rdoc #{f.prerequisites.join(' ')}"
end