This repository has been archived by the owner on Mar 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
libwebots.rb
64 lines (54 loc) · 1.69 KB
/
libwebots.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
require 'formula'
class Libwebots < Formula
version '0.3.0'
homepage 'https://ponyo.epfl.ch/gitlab/webots/libwebots'
url 'https://ponyo.epfl.ch/gitlab/webots/libwebots.git', :using => :git , :commit => '9dbb7dc903ed9973faceb3dbce4f20a1eb2ab371'
head 'https://ponyo.epfl.ch/gitlab/webots/libwebots.git', :using => :git
option :universal
depends_on 'cmake' => :build
depends_on 'eigen'
depends_on 'protobuf'
def test_webots_presence
possible_location = [ENV["WEBOTS_HOME_PATH"],ENV["WEBOTS_HOME"],"/Applications/Webots"]
possible_location.each do |p|
if p.nil?
next
end
tests = [
File.exists?("#{p}/include/controller/c/webots/robot.h"),
File.exists?("#{p}/include/controller/cpp/webots/Robot.hpp"),
File.exists?("#{p}/lib/libController.dylib"),
File.exists?("#{p}/lib/libCppController.dylib")
]
tests.each do |t|
unless t
onoe "Webots installation seems misisng or incomplete."
puts <<-EOS.undent
You need a working installation of Webots (http://www.cyberbotics.com).
Please notice that if you don't install it under the standard path
(/Applications) You *NEED* to specify either WEBOTS_HOME or
WEBOTS_HOME_PATH in your environment (and webots is also expecting
that!!!)
EOS
exit 99
end
end
end
end
def install
test_webots_presence
ENV.universal_binary if build.universal?
system "cmake", ".", *std_cmake_args
system "make install"
end
def test
prefix="/usr/local"
files = ["lib/libwebots-communication.dylib","lib/libwebots-plugins.dylib","lib/libwebots-messages.dylib"]
files.each do |f|
unless File.exists?("#{prefix}/#{f}")
return false
end
end
return true
end
end