aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/vrpn.rb
blob: 01d602a76d21c228c4d5fdd8c8f1a869a56ee3cd (plain)
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
require 'formula'

class Vrpn < Formula
  url 'ftp://ftp.cs.unc.edu/pub/packages/GRIP/vrpn/vrpn_07_29.zip'
  md5 '422f13fc9cbb62d36c96f3cc3b06cec9'
  head 'git://git.cs.unc.edu/vrpn.git'
  homepage 'http://vrpn.org'

  depends_on 'libusb' # for HID support
  depends_on 'cmake' => :build
  depends_on 'doxygen' if ARGV.include? '--docs'

  def options
    [
      ['--clients', 'Build client apps and tests.'],
      ['--docs', 'Build doxygen-based API documentation']
    ]
  end

  def install
    args = std_cmake_parameters.split

    if ARGV.include? '--clients'
      args << "-DVRPN_BUILD_CLIENTS:BOOL=ON"
    else
      args << "-DVRPN_BUILD_CLIENTS:BOOL=OFF"
    end
    args << ".."

    Dir.mkdir "build"
    Dir.chdir "build" do
      system "cmake", *args

      if ARGV.include? '--docs'
        system "make doc"
      end

      system "make install"
    end
  end
end