forked from facebookarchive/MemNN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·49 lines (43 loc) · 1.14 KB
/
setup.sh
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
#!/bin/bash
# Copyright 2004-present Facebook. All Rights Reserved.
luarocks show lzmq 1>/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
luarocks install lzmq
if [ $? -ne 0 ]; then
echo "Error: resolve then run luarocks install lzmq"
exit 1
fi
fi
luarocks show threads 1>/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
luarocks install threads
if [ $? -ne 0 ]; then
echo "Error: resolve then run luarocks install threads"
exit 1
fi
fi
luarocks show tds 1>/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
luarocks install tds
if [ $? -ne 0 ]; then
echo "Error: resolve then run luarocks install tds"
exit 1
fi
fi
# compile libmemnn.so
gcc -O3 -std=c99 -shared -o ./library/c/libmemnn.so -fPIC ./library/c/*.c
if [ $? -ne 0 ]; then
echo "Error compiling memnn library"
exit 1
fi
# link libmemnn.so to lua lib
s=$(which luarocks)
syml_path="${s%luarocks}/../lib/libmemnn.so"
if [ -e $syml_path -o -L $syml_path ]; then
rm $syml_path
fi
ln -s $(pwd)/library/c/libmemnn.so $syml_path
if [ $? -ne 0 ]; then
echo "Error linking memnn library to luarocks lib directory"
exit 1
fi