forked from mozilla/DeepSpeech
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tc-build.sh
executable file
·51 lines (42 loc) · 1.22 KB
/
tc-build.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
50
51
#!/bin/bash
set -xe
source ${HOME}/DeepSpeech/tf/tc-vars.sh
DS_TFDIR=${HOME}/DeepSpeech/tf
EXTRA_CUDA_CFLAGS=
EXTRA_CUDA_LDFLAGS=
if [ "$1" = "--gpu" ]; then
BAZEL_ENV_FLAGS="TF_NEED_CUDA=1 ${TF_CUDA_FLAGS}"
BAZEL_BUILD_FLAGS="${BAZEL_CUDA_FLAGS} ${BAZEL_OPT_FLAGS}"
SYSTEM_TARGET=host
EXTRA_CUDA_CFLAGS=-L${HOME}/DeepSpeech/CUDA/lib64/
EXTRA_CUDA_LDFLAGS=-lcudart
fi
if [ "$1" = "--arm" ]; then
BAZEL_ENV_FLAGS="TF_NEED_CUDA=0"
BAZEL_BUILD_FLAGS="${BAZEL_ARM_FLAGS}"
SYSTEM_TARGET=rpi3
fi
if [ "$1" != "--gpu" -a "$1" != "--arm" ]; then
BAZEL_ENV_FLAGS="TF_NEED_CUDA=0"
BAZEL_BUILD_FLAGS="${BAZEL_OPT_FLAGS}"
SYSTEM_TARGET=host
MAKE_BINDINGS=1
fi
cd ~/DeepSpeech/tf
eval "export ${BAZEL_ENV_FLAGS}"
PATH=${HOME}/bin/:$PATH bazel \
build -c opt ${BAZEL_BUILD_FLAGS} \
//native_client:*
cd ~/DeepSpeech/ds/
make -C native_client/ \
TARGET=${SYSTEM_TARGET} \
TFDIR=${DS_TFDIR} \
RASPBIAN=/tmp/multistrap-raspbian-jessie \
EXTRA_CFLAGS=${EXTRA_CUDA_CFLAGS} \
EXTRA_LDFLAGS=${EXTRA_CUDA_LDFLAGS} \
deepspeech
if [ ${MAKE_BINDINGS} ]; then
cd native_client
CFLAGS="-L${DS_TFDIR}/bazel-bin/tensorflow -L${DS_TFDIR}/bazel-bin/native_client" python ./setup.py bdist_wheel
cd ..
fi