Skip to content

Commit 8c959d1

Browse files
committed
improve rakefile targets
1 parent 5938370 commit 8c959d1

File tree

1 file changed

+35
-18
lines changed

1 file changed

+35
-18
lines changed

Rakefile

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,60 @@
1-
# automatic class generations
1+
# Automate serpapi C++ library
22
#
33

4-
task :default => [:init, :build, :run]
4+
task :default => [:clean, :setup, :build, :run]
55

66
task :clean do
77
sh('rm -rf build/')
88
end
99

10-
# initialize meson build
10+
desc('initialize meson build')
1111
task :setup do
1212
sh('meson setup --wipe build')
1313
end
1414

15-
# build application
15+
desc('build library')
1616
task :build => FileList['src/*.hpp', 'src/*.cpp'] do
17-
sh('meson compile -C build -v')
17+
sh('meson compile -C build')
1818
sh('cd build && ninja')
1919
end
2020

21+
desc('run test suite')
2122
task :test do
2223
sh('ninja -C build test')
2324
end
2425

25-
# run application
26-
task :run do
27-
sh('./build/example/google_example')
28-
sh('./build/oobt/oobt')
26+
task readme: ['README.md.erb'] do
27+
`erb -T '-' README.md.erb > README.md`
2928
end
3029

31-
# tested on AARCH64 and x86
32-
task :install_linux do
33-
sh('sudo apt update -y && sudo apt install -f -y build-essential meson pkg-config curl cmake meson ninja-build libcurl4-openssl-dev rapidjson-dev googletest-dev')
30+
desc('generate documentation')
31+
task doc: [:readme]
32+
33+
desc('run examples under build/example')
34+
task :example do
35+
Dir.glob('build/example/*').each do |file|
36+
sh(file)
37+
end
3438
end
3539

36-
# tested on Apple M1 aarch64
37-
task :install_apple do
38-
sh('brew install meson pkg-config curl cmake meson ninja rapidjson googletest')
40+
desc('run oobt under build/oobt')
41+
task :oobt do
42+
sh('./build/oobt/oobt')
3943
end
4044

41-
task readme: ['README.md.erb'] do
42-
`erb -T '-' README.md.erb > README.md`
43-
end
45+
desc('release current library')
46+
task :release do
47+
puts("TODO implement release")
48+
end
49+
50+
namespace :install do
51+
desc('install dependency on debian AARCH64 and x86 [tested]')
52+
task :linux do
53+
sh('sudo apt update -y && sudo apt install -f -y build-essential meson pkg-config curl cmake meson ninja-build libcurl4-openssl-dev rapidjson-dev googletest')
54+
end
55+
56+
desc('install dependency on Apple M1 aarch64 [tested]')
57+
task :apple do
58+
sh('brew install meson pkg-config curl cmake meson ninja rapidjson googletest')
59+
end
60+
end

0 commit comments

Comments
 (0)