-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathignition-gazebo6.rb
113 lines (103 loc) · 3.75 KB
/
ignition-gazebo6.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
class IgnitionGazebo6 < Formula
desc "Ignition Gazebo robot simulator"
homepage "https://github.com/ignitionrobotics/ign-gazebo"
url "https://osrf-distributions.s3.amazonaws.com/ign-gazebo/releases/ignition-gazebo6-6.3.0.tar.bz2"
sha256 "85bc50f0e9f898e1babc8e41cb828c4159e843ed28d795ee4691b0d62f2d8850"
license "Apache-2.0"
revision 2
bottle do
root_url "https://osrf-distributions.s3.amazonaws.com/bottles-simulation"
sha256 big_sur: "75c0f5fcd9e5f5a1d4262e47b6fb1604c21d47f5bb2c53af0ffb0cb64d6e1445"
sha256 catalina: "f34534efe16f95cdd5521f607dc88adbd4a42b7694b67ea0dd27ee54c4cc7201"
end
depends_on "cmake" => :build
depends_on "gflags"
depends_on "google-benchmark"
depends_on "ignition-cmake2"
depends_on "ignition-common4"
depends_on "ignition-fuel-tools7"
depends_on "ignition-gui6"
depends_on "ignition-math6"
depends_on "ignition-msgs8"
depends_on "ignition-physics5"
depends_on "ignition-plugin1"
depends_on "ignition-rendering6"
depends_on "ignition-sensors6"
depends_on "ignition-tools"
depends_on "ignition-transport11"
depends_on "ignition-utils1"
depends_on macos: :mojave # c++17
depends_on "pkg-config"
depends_on "ruby"
depends_on "sdformat12"
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
ENV["IGN_CONFIG_PATH"] = "#{opt_share}/ignition"
system Formula["ruby"].opt_bin/"ruby",
Formula["ignition-tools"].opt_bin/"ign",
"gazebo", "-s", "--iterations", "5", "-r", "-v", "4"
(testpath/"test.cpp").write <<-EOS
#include <cstdint>
#include <ignition/gazebo/Entity.hh>
#include <ignition/gazebo/EntityComponentManager.hh>
#include <ignition/gazebo/components/World.hh>
#include <ignition/gazebo/components/Name.hh>
using namespace ignition;
using namespace gazebo;
//////////////////////////////////////////////////
int main(int argc, char **argv)
{
// Warm start. Initial allocation of resources can throw off calculations.
{
// Create the entity component manager
EntityComponentManager mgr;
// Create the matching entities
for (int i = 0; i < 100; ++i)
{
Entity entity = mgr.CreateEntity();
mgr.CreateComponent(entity, components::World());
mgr.CreateComponent(entity, components::Name("world_name"));
}
mgr.Each<components::World, components::Name>(
[&](const Entity &, const components::World *,
const components::Name *)->bool {return true;});
}
return 0;
}
EOS
(testpath/"CMakeLists.txt").write <<-EOS
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
find_package(ignition-gazebo6 QUIET REQUIRED)
add_executable(test_cmake test.cpp)
target_link_libraries(test_cmake ignition-gazebo6::core)
EOS
# ENV.append_path "PKG_CONFIG_PATH", Formula["qt@5"].opt_lib/"pkgconfig"
# system "pkg-config", "--cflags", "ignition-gazebo6"
# cflags = `pkg-config --cflags ignition-gazebo6`.split
# ldflags = `pkg-config --libs ignition-gazebo6`.split
# system ENV.cc, "test.cpp",
# *cflags,
# *ldflags,
# "-lc++",
# "-o", "test"
# system "./test"
# test building with cmake
ENV.append_path "CMAKE_PREFIX_PATH", Formula["qt@5"].opt_prefix
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