forked from davidhodo/homebrew-morse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
morse-simulator.rb
77 lines (61 loc) · 2.16 KB
/
morse-simulator.rb
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
require 'formula'
class MorseSimulator < Formula
homepage 'http://morse.openrobots.org'
url 'https://github.com/morse-simulator/morse.git', :tag => '1.4'
head 'https://github.com/morse-simulator/morse.git'
option 'with-ros', 'Enable ROS middleware support'
option 'with-moos', 'Enable MOOS middleware support'
option 'with-pocolibs', 'Enable Pocolibs middleware support'
option 'with-yarp2', 'Enable Yarp2 middleware support'
option 'with-hla', 'Enable HLA support'
option 'with-mavlink', 'Enable MAVLINK support'
option 'with-pymorse' 'Enable the PyMorse binding'
option 'with-doc', 'Enable documentation generation'
option 'with-python=', 'Select the right python interpreter'
depends_on 'cmake' => :build
def which_python3
python3 = ARGV.value("with-python") || which("python3").to_s
fail "#{python3} not found" unless File.exist? python3
python3
end
def install
cmake_args = std_cmake_parameters
# add optional build parameters
if build.include? 'with-ros'
cmake_args << "-DBUILD_ROS_SUPPORT:BOOL=ON"
end
if build.include? 'with-moos'
cmake_args << "-DBUILD_MOOS_SUPPORT:BOOL=ON"
end
if build.include? 'with-pocolibs'
cmake_args << "-DBUILD_POCOLIBS_SUPPORT:BOOL=ON"
end
if build.include? 'with-yarp2'
cmake_args << "-DBUILD_YARP2_SUPPORT:BOOL=ON"
end
if build.include? 'with-hla'
cmake_args << "-DBUILD_HLA_SUPPORT:BOOL=ON"
end
if build.include? 'with-mavlink'
cmake_args << "-DBUILD_MAVLINK_SUPPORT:BOOL=ON"
end
if build.include? 'with-doc'
cmake_args << "-DBUILD_DOC_SUPPORT:BOOL=ON"
end
if build.include? 'with-pymorse'
cmake_args << "-DPYMORSE_SUPPORT:BOOL=ON"
end
if build.include? 'with-python='
cmake_args << "-DPYTHON_EXECUTABLE=#{which_python3}"
end
system "cmake", ".", *cmake_args
system "make"
system "make install"
end
def test
# This test will fail and we won't accept that! It's enough to just replace
# "false" with the main program this formula installs, but it'd be nice if you
# were more thorough. Run the test with `brew test foo`.
system "morse check"
end
end