Skip to content

Commit

Permalink
improve rakefile targets
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Benarbia committed Dec 29, 2023
1 parent 5938370 commit 8c959d1
Showing 1 changed file with 35 additions and 18 deletions.
53 changes: 35 additions & 18 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,43 +1,60 @@
# automatic class generations
# Automate serpapi C++ library
#

task :default => [:init, :build, :run]
task :default => [:clean, :setup, :build, :run]

task :clean do
sh('rm -rf build/')
end

# initialize meson build
desc('initialize meson build')
task :setup do
sh('meson setup --wipe build')
end

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

desc('run test suite')
task :test do
sh('ninja -C build test')
end

# run application
task :run do
sh('./build/example/google_example')
sh('./build/oobt/oobt')
task readme: ['README.md.erb'] do
`erb -T '-' README.md.erb > README.md`
end

# tested on AARCH64 and x86
task :install_linux do
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')
desc('generate documentation')
task doc: [:readme]

desc('run examples under build/example')
task :example do
Dir.glob('build/example/*').each do |file|
sh(file)
end
end

# tested on Apple M1 aarch64
task :install_apple do
sh('brew install meson pkg-config curl cmake meson ninja rapidjson googletest')
desc('run oobt under build/oobt')
task :oobt do
sh('./build/oobt/oobt')
end

task readme: ['README.md.erb'] do
`erb -T '-' README.md.erb > README.md`
end
desc('release current library')
task :release do
puts("TODO implement release")
end

namespace :install do
desc('install dependency on debian AARCH64 and x86 [tested]')
task :linux do
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')
end

desc('install dependency on Apple M1 aarch64 [tested]')
task :apple do
sh('brew install meson pkg-config curl cmake meson ninja rapidjson googletest')
end
end

0 comments on commit 8c959d1

Please sign in to comment.