-
Notifications
You must be signed in to change notification settings - Fork 2
/
build_cpp_linux.sh
57 lines (44 loc) · 1.21 KB
/
build_cpp_linux.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
52
53
54
55
56
57
#!/bin/bash
whisper_path="$1"
targets=${2:-all}
unity_project="$PWD"
build_path="$1/build"
clean_build(){
rm -rf "$build_path"
mkdir "$build_path"
cd "$build_path"
}
build_cpu() {
clean_build
echo "Starting building for CPU..."
cmake -DCMAKE_BUILD_TYPE=Release \
-DWHISPER_BUILD_TESTS=OFF -DWHISPER_BUILD_EXAMPLES=OFF ../
make
echo "Build for CPU complete!"
artifact_path="$build_path/libwhisper.so"
target_path="$unity_project/Packages/com.whisper.unity/Plugins/Linux/libwhisper.so"
cp "$artifact_path" "$target_path"
echo "Build files copied to $target_path"
}
build_cuda() {
clean_build
echo "Starting building for CUDA..."
cmake -DWHISPER_CUBLAS=ON -DCMAKE_BUILD_TYPE=Release \
-DWHISPER_BUILD_TESTS=OFF -DWHISPER_BUILD_EXAMPLES=OFF ../
make
echo "Build for CUDA complete!"
artifact_path="$build_path/libwhisper.so"
target_path="$unity_project/Packages/com.whisper.unity/Plugins/Linux/libwhisper_cuda.so"
cp "$artifact_path" "$target_path"
echo "Build files copied to $target_path"
}
if [ "$targets" = "all" ]; then
build_cpu
build_cuda
elif [ "$targets" = "cpu" ]; then
build_cpu
elif [ "$targets" = "cuda" ]; then
build_cuda
else
echo "Unknown targets: $targets"
fi