-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathdefault.nix
More file actions
86 lines (70 loc) · 2.01 KB
/
default.nix
File metadata and controls
86 lines (70 loc) · 2.01 KB
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
76
77
78
79
80
81
82
83
84
85
86
{ pkgs ? import <nixpkgs> {}
, enableDoxygen ? false
}:
let gtestSrc = pkgs.fetchFromGitHub {
owner = "google";
repo = "googletest";
rev = "release-1.11.0";
hash = "sha256-SjlJxushfry13RGA7BCjYC9oZqV4z6x8dOiHfl/wpF0=";
};
in pkgs.stdenv.mkDerivation rec {
name = "itpp";
# version = "4.3.1";
src = builtins.path { name = "itpp"; path = ./.; };
enableParallelBuilding = true;
nativeBuildInputs = with pkgs; [
cmake
python
rsync
] ++ lib.optional enableDoxygen [ doxygen graphviz ];
buildInputs = with pkgs; [
openblas
lapack-reference
fftw
gtestSrc
];
configurePhase = ''
mkdir -p build && cd build
cmake -DOLD_TESTS=on -DGTEST_DIR=${gtestSrc}/googletest ..
'';
buildPhase = ''
make
'';
doCheck = true;
checkPhase = ''
echo Running old unit tests
python ../extras/check_tests.py -r ../tests -w tests
echo Running GTest-based unit tests
./gtests/itpp_gtests
'';
installPhase = ''
mkdir -p $out/bin
cp itpp-config $out/bin
chmod a+rx $out/bin/itpp-config
mkdir -p $out/lib
cp itpp/libitpp*.dylib $out/lib
# Headers
mkdir -p $out/include/itpp
rsync --recursive --prune-empty-dirs --exclude='config_msvc.h' --include='*.h' --include='*/' --exclude='*' $src/itpp/ $out/include/itpp/
cp itpp/config.h $out/include/itpp
cp itpp/itexports.h $out/include/itpp
# Extra (Matlab, Python)
mkdir -p $out/share/itpp
cp $src/extras/itsave.m $out/share/itpp/
cp $src/extras/itload.m $out/share/itpp/
cp $src/extras/pyitpp.py $out/share/itpp/
cp $src/extras/gdb_macros_for_itpp $out/share/itpp/
# Pkg-config support
mkdir -p $out/lib/pkgconfig
cp itpp.pc $out/lib/pkgconfig
# Man page
mkdir -p $out/share/man/man1
cp itpp-config.1 $out/share/man/man1
# Doxygen documentation
if [ -d "html" ]; then
mkdir -p $out/share/doc/itpp
cp -r html $out/share/doc/itpp
cp $src/doc/images/itpp_logo.png $out/share/doc/itpp/html
fi
'';
}