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
|
#!/usr/bin/env ruby
# DISCLAIMER: this is not Mozilla's mach
require 'optparse'
options = {
:settingsDir => "../build/config",
:profile => 'qt5',
:build => 'release',
:buildDir => '../build',
}
OptionParser.new do |opts|
opts.banner = "Usage: ./mach [options]"
opts.on("-h", "--help", "Prints this help") do
puts opts
puts "Options: #{options}"
puts 'Commands: setup, run, clean, build'
exit
end
opts.on("--profile", "Set profile") do |profile|
options[:profile] = profile
end
opts.on("-d", "--build DIRECTORY", "Build location") do |dir|
options[:buildDir] = dir
end
opts.on("-i", "--install DIRECTORY", "Install location") do |dir|
options[:installDir] = dir
end
opts.on("--debug", "Debug build") do
options[:build] = 'debug'
end
opts.on("--release", "Release build") do
options[:build] = 'release'
end
end.parse!
if not ARGV.empty? then
ARGV.each do|arg|
case arg
when 'setup'
system "qbs-setup-toolchains --settings-dir #{options[:settingsDir]} --detect"
system "qbs-setup-qt --settings-dir #{options[:settingsDir]} /usr/bin/qmake-qt5 #{options[:profile]}"
when 'run'
system "qbs run --settings-dir #{options[:settingsDir]} -d #{options[:buildDir]} -p poi profile:#{options[:profile]} #{options[:build]}"
when 'clean'
system "qbs clean --settings-dir #{options[:settingsDir]} -d #{options[:buildDir]} profile:#{options[:profile]} #{options[:build]}"
when 'build'
system "qbs build --settings-dir #{options[:settingsDir]} -d #{options[:buildDir]} --force-probe-execution profile:#{options[:profile]} #{options[:build]}"
else
puts "Unknown argument #{arg}; use ./mach -h for more details"
end
end
else
puts 'No arguments; use ./mach -h for more details'
end
|