forked from rock-core/tools-orocosrb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
135 lines (114 loc) · 5.13 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
require 'rake'
require './lib/orocos/version'
begin
require 'hoe'
Hoe::plugin :yard
hoe_spec = Hoe.spec('orocos.rb') do |p|
self.developer("Sylvain Joyeux", "[email protected]")
self.summary = 'Controlling Orocos modules from Ruby'
self.description = paragraphs_of('README.markdown', 3..5).join("\n\n")
self.urls = ["https://gitorious.org/rock-toolchain/orocos-rb.git"]
self.changes = ""
licenses << "GPL v2 or later"
self.extra_deps <<
['utilrb', ">= 1.1"] <<
['rake', ">= 0.8"] <<
["rake-compiler", "~> 0.8.0"] <<
["hoe-yard", ">= 0.1.2"]
end
hoe_spec.spec.extensions = FileList["ext/**/extconf.rb"]
def build_orogen(name, options = Hash.new)
require './lib/orocos/rake'
work_dir = File.expand_path(File.join('test', 'working_copy'))
data_dir = File.expand_path(File.join('test', 'data'))
Orocos::Rake.generate_and_build File.join(data_dir, name, "#{name}.orogen"), work_dir, options
end
# Making sure that native extension will be build with gem
require 'rubygems/package_task'
Gem::PackageTask.new(hoe_spec.spec) do |pkg|
pkg.need_zip = true
pkg.need_tar = true
end
Rake.clear_tasks(/^default$/)
task :default => ["compile", "setup:uic"]
# Leave in top level namespace to allow rake-compiler to build native gem: 'rake native gem'
require 'rake/extensiontask'
desc "builds Orocos.rb C extension"
rorocos_task = Rake::ExtensionTask.new('rorocos', hoe_spec.spec) do |ext|
# Same info as in ext/rocoros/extconf.rb where cmake
# is used to generate the Makefile
ext.name = "rorocos"
ext.ext_dir = "ext/rorocos"
ext.lib_dir = "lib/orocos"
ext.gem_spec = hoe_spec.spec
ext.source_pattern = "*.{c,cpp,cc}"
if not Dir.exists?(ext.tmp_dir)
FileUtils.mkdir_p ext.tmp_dir
end
end
namespace :setup do
desc "builds the oroGen modules that are needed by the tests"
task :orogen_all, [:keep_wc,:transports] do |_, args|
build_orogen 'process', args
build_orogen 'simple_sink', args
build_orogen 'simple_source', args
build_orogen 'echo', args
build_orogen 'operations', args
build_orogen 'configurations', args
build_orogen 'states', args
build_orogen 'uncaught', args
build_orogen 'system', args
end
desc "builds the test 'process' module"
task :orogen_process, [:keep_wc,:transports] do |_, args| build_orogen 'process', args end
desc "builds the test 'simple_sink' module"
task :orogen_sink, [:keep_wc,:transports] do |_, args| build_orogen 'simple_sink', args end
desc "builds the test 'simple_source' module"
task :orogen_source, [:keep_wc,:transports] do |_, args| build_orogen 'simple_source', args end
desc "builds the test 'echo' module"
task :orogen_echo, [:keep_wc,:transports] do |_, args| build_orogen 'echo', args end
desc "builds the test 'states' module"
task :orogen_states, [:keep_wc,:transports] do |_, args| build_orogen 'states', args end
desc "builds the test 'uncaught' module"
task :orogen_uncaught, [:keep_wc,:transports] do |_, args| build_orogen 'uncaught', args end
desc "builds the test 'system' module"
task :orogen_system, [:keep_wc,:transports] do |_, args| build_orogen 'system', args end
desc "builds the test 'operations' module"
task :orogen_operations, [:keep_wc,:transports] do |_, args| build_orogen 'operations', args end
desc "builds the test 'configurations' module"
task :orogen_configurations, [:keep_wc,:transports] do |_, args| build_orogen 'configurations', args end
desc "builds the test 'ros_test' module"
task :orogen_ros_test, [:keep_wc,:transports] do |_, args| build_orogen 'ros_test', args end
task :test do
Rake::Task['setup:orogen_all'].invoke(true, nil)
end
UIFILES = %w{}
desc 'generate all Qt UI files using rbuic4'
task :uic do
rbuic = 'rbuic4'
if File.exists?('/usr/lib/kde4/bin/rbuic4')
rbuic = '/usr/lib/kde4/bin/rbuic4'
end
UIFILES.each do |file|
file = 'lib/orocos/roby/gui/' + file
if !system(rbuic, '-o', file.gsub(/\.ui$/, '_ui.rb'), file)
STDERR.puts "Failed to generate #{file}"
end
end
end
end
task :test => 'setup:test'
task :doc => :yard
task :docs => :yard
task :redoc => :yard
task :redocs => :yard
# Add removal of by-products of test setup to the clean task
CLEAN.include("test/working_copy")
rescue LoadError
STDERR.puts "cannot load the Hoe gem. Distribution is disabled"
rescue Exception => e
if e.message !~ /\.rubyforge/
STDERR.puts "cannot load the Hoe gem, or Hoe fails. Distribution is disabled"
STDERR.puts "error message is: #{e.message}"
end
end