forked from ahmadia/homebrew-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
alglib.rb
75 lines (69 loc) · 2.17 KB
/
alglib.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
67
68
69
70
71
72
73
74
75
class Alglib < Formula
desc "Cross-platform numerical analysis library"
homepage "http://www.alglib.net"
url "http://www.alglib.net/translator/re/alglib-3.10.0.cpp.gpl.tgz"
version "3.10.0"
sha256 "26a6aa966da5bba01da1bebddc0acb0a8fc579f07d53a2cbcfa5dfcaf612aaeb"
bottle do
cellar :any
sha256 "8e598ccbc0a92205ce55a079e9d0ff6a120675c3350ca6673aae7f5e9d9b48a3" => :sierra
sha256 "8e598ccbc0a92205ce55a079e9d0ff6a120675c3350ca6673aae7f5e9d9b48a3" => :el_capitan
sha256 "f0a4fd70b961c25d781f7a2dc9c25980a53a680db5074577c6ffea6fb4665d46" => :yosemite
end
depends_on "qt5"
depends_on "pkg-config" => :build
def install
(buildpath/"alglib.pro").write <<-EOS.undent
TEMPLATE = subdirs
SUBDIRS = \\
src
EOS
(buildpath/"src/src.pro").write <<-EOS.undent
isEmpty(PREFIX) {
PREFIX = /usr/local
}
CONFIG += warn_on release static_and_shared
QT -= gui core
LIBS -= -lQtGui -lQtCore
TARGET = alglib
VERSION = 3.10.0
TEMPLATE = lib
target.path = $$PREFIX/lib
DEPENDPATH += .
INCLUDEPATH += .
OBJECTS_DIR = ../_tmp
DESTDIR = ../
HEADERS += *.h
SOURCES += *.cpp
header_files.files = $$HEADERS
header_files.path = $$PREFIX/include/alglib
INSTALLS += target
INSTALLS += header_files
CONFIG += create_pc create_prl no_install_prl
QMAKE_PKGCONFIG_LIBDIR = $$PREFIX/lib/
QMAKE_PKGCONFIG_INCDIR = $$PREFIX/include/alglib
QMAKE_PKGCONFIG_CFLAGS = -I$$PREFIX/include/
QMAKE_PKGCONFIG_DESTDIR = pkgconfig
EOS
system "qmake", "alglib.pro", "PREFIX=#{prefix}"
system "make"
system "make", "install"
end
test do
(testpath / "test.cpp").write <<-EOS.undent
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "dataanalysis.h"
int main(int argc, char **argv)
{
alglib::multilayerperceptron net;
mlpcreate0(2, 1, net);
mlprandomize(net);
return 0;
}
EOS
system ENV.cxx, "-o", "test", "test.cpp", "-L#{lib}", "-lalglib", "-I#{include}/alglib"
system "./test"
end
end