forked from Vindaar/TimepixAnalysis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildTpa.nims
More file actions
107 lines (94 loc) · 2.71 KB
/
buildTpa.nims
File metadata and controls
107 lines (94 loc) · 2.71 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Simple script to build all necessary tools of the TimepixAnalysis as well as
# the TPA tools itself.
import shell, strutils
# The script will make no attempt to install the HDF5 library (only the Nim lib)!
echo "Adding helpers to nimble"
let dir = getCurrentDir()
var toContinue = true
template shellCheck(actions: untyped): untyped =
if toContinue:
let res = shellVerbose:
actions
toContinue = res[1] == 0
if not toContinue:
quit("Building TimepixAnalysis failed!")
shellCheck:
one:
cd ($dir)/NimUtil
nimble develop "-y"
echo "Checking for NLopt"
var nloptCheck = ""
shellAssign:
nloptCheck = nimble path nlopt
if "Error" in nloptCheck:
echo "Clone and build NLopt"
shellCheck:
one:
mkdir -p "$HOME/src"
cd "$HOME/src"
git clone "https://github.com/vindaar/nimnlopt"
cd nimnlopt/c_header
git clone "git://github.com/stevengj/nlopt"
cd nlopt
mkdir build
cd build
cmake ".."
make
cd "../../../"
nimble develop "-y"
echo "\n\nNOTE: Please call `sudo make install` in " &
"$HOME/src/nimnlopt/c_header/nlopt/build! \n\n"
echo "Checking for mnpfit"
var mpfitCheck = ""
shellAssign:
mpfitCheck = nimble path mpfit
if "Error" in mpfitCheck:
echo "Clone and build mpfit"
shellCheck:
one:
mkdir -p "$HOME/src"
cd "$HOME/src"
git clone "https://github.com/vindaar/nim-mpfit"
cd "nim-mpfit"
cd "c_src"
gcc "-c -Wall -Werror -fpic" mpfit.c mpfit.h
gcc "-shared -o" libmpfit.so mpfit.o
cd ".."
nimble develop "-y"
echo "\n\nNOTE: Please copy `libmpfit.so` located in " &
"$HOME/src/nim-mpfit/c_src into an appropriate location, " &
"e.g. '/usr/local/lib'! \n\n"
echo "Adding ingridDatabase to nimble"
shellCheck:
one:
cd ($dir)/InGridDatabase
nimble develop "-y"
echo "Adding ingrid to nimble"
shellCheck:
one:
cd ($dir)/Analysis
nimble develop "-y"
echo "Now add the InGrid-Python module via `setup.py develop` to your " &
"correct Python installation"
echo "Compiling Nim procs for Python"
shellCheck:
one:
cd ($dir)/Analysis/ingrid
nim c "-d:release --app:lib --out:procsForPython.so" procsForPython.nim
mv procsForPython.so ($dir)/"InGrid-Python/ingrid"
echo "Attempt compiling raw_data_manipulation"
shellCheck:
one:
cd ($dir)/Analysis/ingrid
nim c "-d:release --threads:on" raw_data_manipulation.nim
echo "Attempt compiling reconstruction"
shellCheck:
one:
cd ($dir)/Analysis/ingrid
nim c "-d:release --threads:on" reconstruction.nim
echo "Attempt compiling likelihood"
shellCheck:
one:
cd ($dir)/Analysis/ingrid
nim c "-d:release --threads:on" likelihood.nim
echo "Finished building TimepixAnalysis!"