-
Notifications
You must be signed in to change notification settings - Fork 275
/
configure
executable file
·77 lines (66 loc) · 1.36 KB
/
configure
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
#!/bin/sh
set -e
BUILD_LIB=1
BUILD_TESTS=0
BUILD_FAKE=0
BUILD_EXAMPLES=0
BUILD_USER_CODES=0
if [ ! -e /dev/nvidia0 ]; then
BUILD_FAKE=1
echo "CUDA NOT Found, using BUILD_FAKE=$BUILD_FAKE"
fi
parse_args() {
for i in "$@"; do
case $i in
--prefix=*)
PREFIX="${i#*=}"
;;
--examples)
BUILD_EXAMPLES=1
;;
--tests)
BUILD_TESTS=1
;;
--user-code)
BUILD_USER_CODE=1
;;
--fake-cuda)
BUILD_FAKE=1
;;
*)
echo "unknown argument $i"
exit 1
;;
esac
done
}
parse_args $@
cmake_flag() {
echo "-D$1=$2"
}
cmake_flags() {
if [ ! -z "$PREFIX" ]; then
cmake_flag CMAKE_INSTALL_PREFIX $PREFIX
fi
cmake_flag CMAKE_RUNTIME_OUTPUT_DIRECTORY $PWD/bin
cmake_flag BUILD_TESTS $BUILD_TESTS
cmake_flag BUILD_FAKE $BUILD_FAKE
cmake_flag BUILD_EXAMPLES $BUILD_EXAMPLES
cmake_flag BUILD_LIB $BUILD_LIB
cmake_flag BUILD_USER_CODES $BUILD_USER_CODES
}
cd $(dirname $0)
W=$PWD
build='.build'
gen_make() {
echo "build:"
echo "\t\$(MAKE) -C $build"
echo "install:"
echo "\t\$(MAKE) -C $build install"
echo "test:"
echo "\t\$(MAKE) -C $build test"
}
mkdir -p $build
cd $build
cmake $W $(cmake_flags)
gen_make >$W/Makefile