forked from ahmadia/homebrew-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
beagle.rb
66 lines (50 loc) · 1.91 KB
/
beagle.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
require 'formula'
class CudaRequirement < Requirement
build true
fatal true
satisfy { which 'nvcc' }
env do
# Nvidia CUDA installs (externally) into this dir (hard-coded):
ENV.append 'CFLAGS', "-F/Library/Frameworks"
# # because nvcc has to be used
ENV.append 'PATH', which('nvcc').dirname, ':'
end
def message
<<-EOS.undent
To use this formula with NVIDIA graphics cards you will need to
download and install the CUDA drivers and tools from nvidia.com.
https://developer.nvidia.com/cuda-downloads
Select "Mac OS" as the Operating System and then select the
'Developer Drivers for MacOS' package.
You will also need to download and install the 'CUDA Toolkit' package.
The `nvcc` has to be in your PATH then (which is normally the case).
EOS
end
end
class Beagle < Formula
homepage 'https://beagle-lib.googlecode.com/'
url 'https://beagle-lib.googlecode.com/svn/tags/beagle_release_2_1/'
head 'https://beagle-lib.googlecode.com/svn/trunk/'
option 'with-opencl', "Build with OpenCL GPU/CPU acceleration"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on 'doxygen' => :build
depends_on CudaRequirement => :optional
def install
system "./autogen.sh"
args = [ "--prefix=#{prefix}" ]
args << "--enable-osx-leopard" if MacOS.version <= :leopard
args << "--with-cuda=#{Pathname(which 'nvcc').dirname}" if build.with? 'cuda'
args << "--enable-opencl" if build.with? 'opencl'
system "./configure", *args
# The JNI bindings cannot be built in parallel, else we get
# "ld: library not found for -lhmsbeagle"
# (https://github.com/Homebrew/homebrew-science/issues/67)
ENV.deparallelize
system "make"
system "make install"
# The tests seem to fail if --enable-opencl is provided
system "make check" if build.without? "opencl"
end
end