-
Notifications
You must be signed in to change notification settings - Fork 2
/
sparse2d.rb
66 lines (58 loc) · 1.98 KB
/
sparse2d.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
# Homebrew formula for Sparse2D
class Sparse2d < Formula
desc "Sparsity-based signal processing tools developed at CosmoStat."
homepage "https://github.com/CosmoStat/Sparse2D"
url "https://github.com/CosmoStat/Sparse2D/archive/refs/tags/v3.0.1.zip"
sha256 "6f5fe3b03218661383126e68379a0d4123e32ae324a1f80f6c0c5ef644cfa618"
# Build options
option "without-armadillo",
"Build without armadillo support, only core Sparse2D tools will be built"
option "without-gsl",
"Build without gsl support, only core Sparse2D tools will be built"
option "without-healpix",
"Build without healpix support, only core Sparse2D tools will be built"
option "without-pybind11",
"Build wihout pubind11 support, Python bindings will not be built"
option "without-python",
"Build wihout python support, Python bindings will not be built"
# Depencencies
depends_on "cmake" => :build
depends_on "cfitsio"
depends_on "fftw"
depends_on "libomp"
depends_on "armadillo" => :recommended
depends_on "gsl" => :recommended
depends_on "healpix" => :recommended
depends_on "python" => :recommended
# Set CMake options
if build.without? "armadillo" or build.without? "gsl" or build.without? "healpix"
$sparse_flag = "-DONLY_SPARSE=ON"
else
$sparse_flag = ""
end
if build.without? "python" or build.without? "pybind11"
$python_flag = "-DBUILD_PYBIND=OFF"
else
$python_flag = ""
end
# Installation
def install
system "mkdir build"
chdir "build" do
system "cmake", "..",
"--log-level=VERBOSE",
"-DCMAKE_INSTALL_PREFIX=#{prefix}",
$sparse_flag,
$python_flag,
"-DPYBIND_INSTALL_PATH=#{prefix}/python"
system "make"
system "make install"
end
end
# Caveats
def caveats; <<~EOS
To import Python bindings include #{prefix}/python in your PYTHONPATH.
e.g. for Bash: export PYTHONPATH="#{prefix}/python:$PYTHONPATH"
EOS
end
end