forked from osrf/homebrew-simulation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sdformat4.rb
69 lines (60 loc) · 2.03 KB
/
sdformat4.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
class Sdformat4 < Formula
desc "Simulation Description Format"
homepage "http://sdformat.org"
url "http://gazebosim.org/distributions/sdformat/releases/sdformat-4.2.0.tar.bz2"
sha256 "75e2d053f97ca33456109b4d7794e6b7d26deef59c778f0d9e25d1369b24b094"
revision 1
head "https://bitbucket.org/osrf/sdformat", :branch => "default", :using => :hg
bottle do
root_url "http://gazebosim.org/distributions/sdformat/releases"
sha256 "f3ea2a5185a4054b047dccd1d0abfff767b37743d9f690bc3f7b7c6485f22290" => :el_capitan
sha256 "3b703e9e76fe650a13861e38f75c6eb34e7f208e0d80b7ac90123bf22ce7c7c4" => :yosemite
end
depends_on "cmake" => :build
depends_on "boost"
depends_on "doxygen"
depends_on "ignition-math2"
depends_on "pkg-config" => :run
depends_on "ros/deps/urdfdom" => :optional
depends_on "tinyxml"
conflicts_with "sdformat", :because => "Differing version of the same formula"
conflicts_with "sdformat3", :because => "Differing version of the same formula"
def install
ENV.m64
cmake_args = std_cmake_args
cmake_args << "-DUSE_EXTERNAL_URDF:BOOL=True" if build.with? "urdfdom"
cmake_args << ".."
mkdir "build" do
system "cmake", *cmake_args
system "make", "install"
end
end
test do
(testpath/"test.cpp").write <<-EOS.undent
#include <iostream>
#include "sdf/sdf.hh"
const std::string sdfString(
"<sdf version='1.5'>"
" <model name='example'>"
" <link name='link'>"
" <sensor type='gps' name='mysensor' />"
" </link>"
" </model>"
"</sdf>");
int main() {
sdf::SDF modelSDF;
modelSDF.SetFromString(sdfString);
std::cout << modelSDF.ToString() << std::endl;
}
EOS
system "pkg-config", "sdformat"
cflags = `pkg-config --cflags sdformat`.split(" ")
system ENV.cc, "test.cpp",
*cflags,
"-L#{lib}",
"-lsdformat",
"-lc++",
"-o", "test"
system "./test"
end
end