-
Notifications
You must be signed in to change notification settings - Fork 13
/
compiler.sh
executable file
·104 lines (97 loc) · 2.35 KB
/
compiler.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
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
#!/usr/bin/env bash
## ubuntu16.04
build_linux_fn ()
{
echo "linux x86-64"
mkdir -p build-linux
pushd build-linux
cmake -DNCNN_BENCHMARK=OFF \
-DNCNN_OPENMP=ON \
-DNCNN_REQUANT=OFF \
-DNCNN_IM2COL_SGEMM=ON \
..
make -j3
make install
popd
}
## arm linux
build_arm_fn ()
{
echo "linux armv7-a"
mkdir -p build-arm
pushd build-arm
cmake -DNCNN_OPENMP=ON \
-DNCNN_REQUANT=OFF \
-DNCNN_BENCHMARK=OFF \
-DNCNN_IM2COL_SGEMM=ON \
-DCMAKE_TOOLCHAIN_FILE=../arm.toolchain.cmake ..
make -j3
make install
popd
}
## android armv7
build_android_fn ()
{
echo "android armv7-a"
mkdir -p build-android-armv7
pushd build-android-armv7
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON -DANDROID_PLATFORM=android-21 \
-DNCNN_OPENMP=ON \
-DNCNN_REQUANT=ON \
-DNCNN_BENCHMARK=OFF \
-DNCNN_IM2COL_SGEMM=ON \
..
make -j3
make install
popd
}
build_android_aarch64_fn ()
{
echo "android aarch64"
mkdir -p build-android-aarch64
pushd build-android-aarch64
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-21 \
-DNCNN_OPENMP=ON \
-DNCNN_BENCHMARK=ON \
-DNCNN_REQUANT=OFF \
-DNCNN_IM2COL_SGEMM=OFF \
..
make -j3
make install
popd
}
build_clean_fn ()
{
echo "remove build file"
rm -rf build-android-armv7
rm -rf build-android-aarch64
rm -rf build-linux
rm -rf build-arm
echo "remove pull file"
rm -rf output
echo "build clean done"
}
error_fn ()
{
echo "unknown argument"
echo "available targets: linux||android||android_64||arm"
}
if [ $# = 0 ]; then
echo "error: target missing!"
echo "available targets: linux||android||android_64||arm"
echo "sample usage: ./build.sh linux"
else
if [ $1 = "linux" ]; then
build_linux_fn
elif [ $1 = "android" ]; then
build_android_fn
elif [ $1 = "android64" ]; then
build_android_aarch64_fn
elif [ $1 = "arm" ]; then
build_arm_fn
elif [ $1 = "clean" ]; then
build_clean_fn
else
error_fn
fi
fi