forked from ahmadia/homebrew-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cppad.rb
52 lines (45 loc) · 1.69 KB
/
cppad.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
require 'formula'
class Cppad < Formula
homepage 'http://www.coin-or.org/CppAD'
url 'http://www.coin-or.org/download/source/CppAD/cppad-20140000.0.epl.tgz'
version '20140000'
sha1 '27ecae20785c95ac5af0f285b54be292aad75008'
head 'https://projects.coin-or.org/svn/CppAD/trunk', :using => :svn
# Only one of --with-boost, --with-eigen and --with-std should be given.
depends_on 'boost' => :optional
depends_on 'eigen' => :optional
depends_on 'adol-c' => :optional
option 'with-std', 'Use std test vector'
option 'without-check', 'Skip comprehensive tests (not recommended)'
depends_on 'cmake' => :build
fails_with :gcc do
build 5658
cause <<-EOS.undent
A bug in complex division causes failure of certain tests.
See http://list.coin-or.org/pipermail/cppad/2013q1/000297.html
EOS
end
def install
if ENV.compiler == :clang
opoo 'OpenMP support will not be enabled. Use --use-gcc if you require OpenMP.'
end
cmake_args = ["-Dcmake_install_prefix=#{prefix}", "-Dcppad_documentation=YES"]
cppad_testvector = 'cppad'
if build.with? 'boost'
cppad_testvector = 'boost'
elsif build.with? 'eigen'
cppad_testvector = 'eigen'
cmake_args << "-Deigen_prefix=#{Formula["eigen"].prefix}"
cmake_args << "-Dcppad_cxx_flags=-I#{Formula["eigen"].include}/eigen3"
elsif build.with? 'std'
cppad_testvector = 'std'
end
cmake_args << "-Dcppad_testvector=#{cppad_testvector}"
cmake_args << "-Dadolc_prefix=#{Formula["adol-c"].prefix}" if build.with? 'adol-c'
mkdir 'build' do
system "cmake", "..", *cmake_args
system 'make check' if build.with? 'check'
system 'make install'
end
end
end