-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathgz-utils3.rb
72 lines (67 loc) · 2.21 KB
/
gz-utils3.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
class GzUtils3 < Formula
desc "General purpose classes and functions designed for robotic applications"
homepage "https://github.com/gazebosim/gz-utils"
url "https://osrf-distributions.s3.amazonaws.com/gz-utils/releases/gz-utils-3.1.1.tar.bz2"
sha256 "161942a2d00c820683cf88e41c48545e8da4c959aad77ca2229021e5f961201d"
license "Apache-2.0"
bottle do
root_url "https://osrf-distributions.s3.amazonaws.com/bottles-simulation"
sha256 cellar: :any, sonoma: "809bac481818d9ab2dcdc6572e0352e4f5c08f80717bade1a6ddadd94e592817"
sha256 cellar: :any, ventura: "a9f9038074fb7fc0b58c89d3c2b90c42088a589e44563375d1f7abdba7f7d55e"
end
depends_on "cmake" => [:build, :test]
depends_on "pkgconf" => [:build, :test]
depends_on "cli11"
depends_on "gz-cmake4"
depends_on "spdlog"
def install
cmake_args = std_cmake_args
cmake_args << "-DBUILD_TESTING=OFF"
cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpath}"
# Use a build folder
mkdir "build" do
system "cmake", "..", *cmake_args
system "make", "install"
end
end
test do
(testpath/"test.cpp").write <<-EOS
#include <gz/utils/ImplPtr.hh>
class SomeClassPrivate
{
};
class SomeClass
{
private: gz::utils::ImplPtr<SomeClassPrivate> dataPtr =
gz::utils::MakeImpl<SomeClassPrivate>();
};
int main() {
SomeClass object;
return 0;
}
EOS
(testpath/"CMakeLists.txt").write <<-EOS
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
find_package(gz-utils3 QUIET REQUIRED)
add_executable(test_cmake test.cpp)
target_link_libraries(test_cmake gz-utils3::gz-utils3)
EOS
system "pkg-config", "gz-utils3"
cflags = `pkg-config --cflags gz-utils3`.split
ldflags = `pkg-config --libs gz-utils3`.split
system ENV.cxx, "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