forked from translunar/nmatrix
/
Rakefile
154 lines (126 loc) · 3.75 KB
/
Rakefile
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# -*- ruby -*-
require 'rubygems'
# Fix for problem described here: https://github.com/jbarnette/isolate/pull/39
module Gem
Deprecate = Module.new do
include Deprecate
end
end
require 'isolate/now'
# End Fix
require 'hoe'
require 'pathname'
require 'rspec/core/rake_task'
Hoe.plugin :compiler
Hoe.plugin :bundler
Hoe.plugin :git
# Hoe.plugin :compiler
# Hoe.plugin :gem_prelude_sucks
# Hoe.plugin :inline
# Hoe.plugin :racc
# Hoe.plugin :rubyforge
BASEDIR = Pathname( __FILE__ ).dirname.relative_path_from( Pathname.pwd )
SPECDIR = BASEDIR + 'spec'
VALGRIND_OPTIONS = [
"--num-callers=50",
"--error-limit=no",
"--partial-loads-ok=yes",
"--undef-value-errors=no",
]
VALGRIND_MEMORYFILL_OPTIONS = [
"--freelist-vol=100000000",
"--malloc-fill=6D",
"--free-fill=66 ",
]
GDB_OPTIONS = []
h = Hoe.spec 'nmatrix' do
self.require_ruby_version ">=1.9"
self.developer('John Woods', 'john.o.woods@gmail.com')
self.post_install_message = <<-EOF
***********************************************************
Welcome to SciRuby: Tools for Scientific Computing in Ruby!
*** WARNING ***
Please be aware that NMatrix is in ALPHA status. If you're
thinking of using NMatrix to write mission critical code,
such as for driving a car or flying a space shuttle, you
may wish to choose other software (for now).
NMatrix requires a C compiler, and has been tested only
with GCC 4.6.1. We are happy to accept contributions
which improve the portability of this project.
Also required is ATLAS. Most Linux distributions and Mac
versions include ATLAS, but you may wish to compile it
yourself.
More explicit instructions for NMatrix and SciRuby should
be available on the SciRuby website, sciruby.com, or
through our mailing list (which can be found on our web-
site).
Thanks for trying out NMatrix! Happy coding!
***********************************************************
EOF
#self.need_rdoc = false
self.readme_file = 'README.rdoc'
# self.rubyforge_name = 'nmatrixx' # if different than 'nmatrix'
end
RSpec::Core::RakeTask.new(:spec)
task :console do |task|
cmd = [ 'irb', "-r './lib/nmatrix.rb'" ]
run *cmd
end
#namespace :console do
# CONSOLE_CMD = ['irb', "-r './lib/nmatrix.rb'"]
# desc "Run console under GDB."
# task :gdb => [ :compile ] do |task|
# cmd = [ 'gdb' ] + GDB_OPTIONS
# cmd += [ '--args' ]
# cmd += CONSOLE_CMD
# run( *cmd )
# end
#
# desc "Run console under Valgrind."
# task :valgrind => [ :compile ] do |task|
# cmd = [ 'valgrind' ] + VALGRIND_OPTIONS
# cmd += CONSOLE_CMD
# run( *cmd )
# end
#end
task :default => :spec
def run *cmd
sh(cmd.join(" "))
end
namespace :spec do
# partial-loads-ok and undef-value-errors necessary to ignore
# spurious (and eminently ignorable) warnings from the ruby
# interpreter
RSPEC_CMD = [ 'ruby', '-S', 'rspec', '-Ilib:ext', SPECDIR ]
#desc "Run the spec for generator.rb"
#task :generator do |task|
# run 'rspec spec/generator_spec.rb'
#end
desc "Run specs under GDB."
task :gdb => [ :compile ] do |task|
cmd = [ 'gdb' ] + GDB_OPTIONS
cmd += [ '--args' ]
cmd += RSPEC_CMD
run( *cmd )
end
desc "Run specs under Valgrind."
task :valgrind => [ :compile ] do |task|
cmd = [ 'valgrind' ] + VALGRIND_OPTIONS
cmd += RSPEC_CMD
run( *cmd )
end
end
namespace :clean do
task :so do |task|
tmp_path = "tmp/#{RUBY_PLATFORM}/nmatrix/#{RUBY_VERSION}"
chdir tmp_path do
if RUBY_PLATFORM =~ /mswin/
`nmake soclean`
else
mkcmd = ENV['MAKE'] || %w[gmake make].find { |c| system("#{c} -v >> /dev/null 2>&1") }
`#{mkcmd} soclean`
end
end
end
end
# vim: syntax=ruby