-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathignition-msgs8.rb
80 lines (73 loc) · 2.7 KB
/
ignition-msgs8.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
class IgnitionMsgs8 < Formula
desc "Middleware protobuf messages for robotics"
homepage "https://github.com/gazebosim/gz-msgs"
url "https://osrf-distributions.s3.amazonaws.com/ign-msgs/releases/ignition-msgs8-8.7.0.tar.bz2"
sha256 "b17a8e16fe56a84891bd0654a2ac09427e9a567b9cd2255bb2cfa830f8e1af45"
license "Apache-2.0"
revision 51
head "https://github.com/gazebosim/gz-msgs.git", branch: "ign-msgs8"
bottle do
root_url "https://osrf-distributions.s3.amazonaws.com/bottles-simulation"
sha256 cellar: :any, sonoma: "cc756770b6ce6280a61647ed7932f7e7fc95d72623c1da9d32e89a1d212370b6"
sha256 cellar: :any, ventura: "2e8c1d6548d7ba7058cf417371b02984f9032820b79d6d5900524e835bcb59be"
end
depends_on "cmake"
depends_on "ignition-cmake2"
depends_on "ignition-math6"
depends_on "ignition-tools"
depends_on macos: :high_sierra # c++17
depends_on "pkgconf"
depends_on "protobuf"
depends_on "tinyxml2"
patch do
# Fix for compatibility with protobuf 23.2
url "https://github.com/gazebosim/gz-msgs/commit/0c0926c37042ac8f5aeb49ac36101acd3e084c6b.patch?full_index=1"
sha256 "02dd3ee467dcdd1b5b1c7c26d56ebea34276fea7ff3611fb53bf27b99e7ba4bc"
end
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/msgs.hh>
int main() {
ignition::msgs::UInt32;
return 0;
}
EOS
(testpath/"CMakeLists.txt").write <<-EOS
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
find_package(ignition-msgs8 QUIET REQUIRED)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${IGNITION-MSGS_CXX_FLAGS}")
include_directories(${IGNITION-MSGS_INCLUDE_DIRS})
link_directories(${IGNITION-MSGS_LIBRARY_DIRS})
add_executable(test_cmake test.cpp)
target_link_libraries(test_cmake ignition-msgs8::ignition-msgs8)
EOS
# test building with pkg-config
system "pkg-config", "ignition-msgs8"
# cflags = `pkg-config --cflags ignition-msgs8`.split
# ldflags = `pkg-config --libs ignition-msgs8`.split
# compilation is broken with pkg-config, disable for now
# system ENV.cc, "test.cpp",
# *cflags,
# *ldflags,
# "-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