-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathignition-sensors6.rb
78 lines (69 loc) · 2.44 KB
/
ignition-sensors6.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
78
class IgnitionSensors6 < Formula
desc "Sensors library for robotics applications"
homepage "https://github.com/gazebosim/gz-sensors"
url "https://osrf-distributions.s3.amazonaws.com/gz-sensors/releases/ignition-sensors-6.8.1.tar.bz2"
sha256 "abc96be3bd018cae94c83981d173af0f67ce2980ef7a1374b34bd5b63f9a7235"
license "Apache-2.0"
revision 14
head "https://github.com/gazebosim/gz-sensors.git", branch: "ign-sensors6"
bottle do
root_url "https://osrf-distributions.s3.amazonaws.com/bottles-simulation"
sha256 cellar: :any, sonoma: "e075aa41bb563622322a3633f6d9e86497a8c6bba89ce93f4ea0a70234b7a213"
sha256 cellar: :any, ventura: "69ed3f1bad6df27f5b3993526abf61010ea7a9524416a85c6e53014c1ff00f35"
end
depends_on "cmake" => [:build, :test]
depends_on "pkgconf" => [:build, :test]
depends_on "ignition-cmake2"
depends_on "ignition-common4"
depends_on "ignition-math6"
depends_on "ignition-msgs8"
depends_on "ignition-rendering6"
depends_on "ignition-transport11"
depends_on "protobuf"
depends_on "sdformat12"
depends_on "tinyxml2"
def install
cmake_args = std_cmake_args
cmake_args << "-DBUILD_TESTING=OFF"
cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpath}"
mkdir "build" do
system "cmake", "..", *cmake_args
system "make", "install"
end
end
test do
(testpath/"test.cpp").write <<-EOS
#include <ignition/sensors/Noise.hh>
int main()
{
ignition::sensors::Noise noise(ignition::sensors::NoiseType::NONE);
return 0;
}
EOS
(testpath/"CMakeLists.txt").write <<-EOS
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
find_package(ignition-sensors6 QUIET REQUIRED)
add_executable(test_cmake test.cpp)
target_link_libraries(test_cmake ignition-sensors6::ignition-sensors6)
EOS
# test building with pkg-config
system "pkg-config", "ignition-sensors6"
cflags = `pkg-config --cflags ignition-sensors6`.split
ldflags = `pkg-config --libs ignition-sensors6`.split
system ENV.cc, "test.cpp",
*cflags,
*ldflags,
"-lc++",
"-o", "test"
system "./test"
# test building with cmake
mkdir "build" do
system "cmake", ".."
system "make"
system "./test_cmake"
end
# check for Xcode frameworks in bottle
cmd_not_grep_xcode = "! grep -rnI 'Applications[/]Xcode' #{prefix}"
system cmd_not_grep_xcode
end
end