Skip to content

Instantly share code, notes, and snippets.

@dpo
Created October 11, 2013 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpo/6938726 to your computer and use it in GitHub Desktop.
Save dpo/6938726 to your computer and use it in GitHub Desktop.
require 'formula'
class Cppad < Formula
homepage 'http://www.coin-or.org/CppAD'
url 'http://www.coin-or.org/CppAD/Doc/cppad-20131019.epl.tgz'
version '20131019'
sha1 'f99c9fad1f8c89d0c93899e5fbd9895cc7fcaeab'
head 'https://projects.coin-or.org/svn/CppAD/trunk', :using => :svn
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.factory('eigen').prefix}"
cmake_args << "-Dcppad_cxx_flags=-I" + Formula.factory('eigen').include + '/eigen3'
elsif build.include? 'with-std'
cppad_testvector = 'std'
end
cmake_args << "-Dcppad_testvector=#{cppad_testvector}"
cmake_args << "-Dadolc_prefix=#{Formula.factory('adol-c').prefix}" if build.with? 'adol-c'
mkdir 'build' do
system "cmake", "..", *cmake_args
if build.with? 'check'
ohai 'Running tests. Please be patient.'
system 'make check'
end
system 'make install'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment