forked from bytedeco/javacpp-presets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcppbuild.sh
executable file
·123 lines (117 loc) · 5.27 KB
/
cppbuild.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
# This file is meant to be included by the parent cppbuild.sh script
if [[ -z "$PLATFORM" ]]; then
pushd ..
bash cppbuild.sh "$@" flandmark
popd
exit
fi
FLANDMARK_VERSION=master
download https://github.com/uricamic/flandmark/archive/$FLANDMARK_VERSION.zip flandmark-$FLANDMARK_VERSION.zip
mkdir -p $PLATFORM
cd $PLATFORM
INSTALL_PATH=`pwd`
mkdir -p include lib bin
unzip -o ../flandmark-$FLANDMARK_VERSION.zip
cd flandmark-$FLANDMARK_VERSION
patch --binary -Np1 < ../../../flandmark.patch || true
OPENCV_PATH=$INSTALL_PATH/../../../opencv/cppbuild/$PLATFORM/
if [[ -n "${BUILD_PATH:-}" ]]; then
PREVIFS="$IFS"
IFS="$BUILD_PATH_SEPARATOR"
for P in $BUILD_PATH; do
if [[ -d "$P/include/opencv2" ]]; then
OPENCV_PATH="$P"
fi
done
IFS="$PREVIFS"
fi
case $PLATFORM in
android-arm)
$CMAKE -DCMAKE_TOOLCHAIN_FILE=${PLATFORM_ROOT}/build/cmake/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a -DANDROID_NATIVE_API_LEVEL=24 -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=$OPENCV_PATH/sdk/native/jni/abi-armeabi-v7a/ -DCMAKE_CXX_FLAGS="-std=c++11" .
make -j $MAKEJ flandmark_static
cp libflandmark/*.h ../include
cp libflandmark/*.a ../lib
;;
android-arm64)
$CMAKE -DCMAKE_TOOLCHAIN_FILE=${PLATFORM_ROOT}/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_NATIVE_API_LEVEL=24 -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=$OPENCV_PATH/sdk/native/jni/abi-arm64-v8a/ -DCMAKE_CXX_FLAGS="-std=c++11" .
make -j $MAKEJ flandmark_static
cp libflandmark/*.h ../include
cp libflandmark/*.a ../lib
;;
android-x86)
$CMAKE -DCMAKE_TOOLCHAIN_FILE=${PLATFORM_ROOT}/build/cmake/android.toolchain.cmake -DANDROID_ABI=x86 -DANDROID_NATIVE_API_LEVEL=24 -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=$OPENCV_PATH/sdk/native/jni/abi-x86/ -DCMAKE_CXX_FLAGS="-std=c++11" .
make -j $MAKEJ flandmark_static
cp libflandmark/*.h ../include
cp libflandmark/*.a ../lib
;;
android-x86_64)
$CMAKE -DCMAKE_TOOLCHAIN_FILE=${PLATFORM_ROOT}/build/cmake/android.toolchain.cmake -DANDROID_ABI=x86_64 -DANDROID_NATIVE_API_LEVEL=24 -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=$OPENCV_PATH/sdk/native/jni/abi-x86_64/ -DCMAKE_CXX_FLAGS="-std=c++11" .
make -j $MAKEJ flandmark_static
cp libflandmark/*.h ../include
cp libflandmark/*.a ../lib
;;
linux-x86)
CC="gcc -m32" CXX="g++ -m32" $CMAKE -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=$OPENCV_PATH/lib/cmake/opencv4/ -DCMAKE_CXX_FLAGS="-std=c++11" .
make -j $MAKEJ flandmark_static
cp libflandmark/*.h ../include
cp libflandmark/*.a ../lib
;;
linux-x86_64)
CC="gcc -m64" CXX="g++ -m64" $CMAKE -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=$OPENCV_PATH/lib/cmake/opencv4/ -DCMAKE_CXX_FLAGS="-std=c++11" .
make -j $MAKEJ flandmark_static
cp libflandmark/*.h ../include
cp libflandmark/*.a ../lib
;;
linux-armhf)
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ $CMAKE -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=$OPENCV_PATH/lib/cmake/opencv4/ -DCMAKE_CXX_FLAGS="-std=c++11" .
make -j $MAKEJ flandmark_static
cp libflandmark/*.h ../include
cp libflandmark/*.a ../lib
;;
linux-arm64)
CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ $CMAKE -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=$OPENCV_PATH/lib/cmake/opencv4/ -DCMAKE_CXX_FLAGS="-std=c++11" .
make -j $MAKEJ flandmark_static
cp libflandmark/*.h ../include
cp libflandmark/*.a ../lib
;;
linux-ppc64le)
MACHINE_TYPE=$( uname -m )
if [[ "$MACHINE_TYPE" =~ ppc64 ]]; then
CC="gcc -m64" CXX="g++ -m64" $CMAKE -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=$OPENCV_PATH/lib/cmake/opencv4/ -DCMAKE_CXX_FLAGS="-std=c++11" .
else
CC="powerpc64le-linux-gnu-gcc -m64" CXX="powerpc64le-linux-gnu-g++ -m64" $CMAKE -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=$OPENCV_PATH/lib/cmake/opencv4/ -DCMAKE_CXX_FLAGS="-std=c++11" .
fi
make -j $MAKEJ flandmark_static
cp libflandmark/*.h ../include
cp libflandmark/*.a ../lib
;;
linux-mips64el)
CC="gcc -mabi=64" CXX="g++ -mabi=64" $CMAKE -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=$OPENCV_PATH/lib/cmake/opencv4/ -DCMAKE_CXX_FLAGS="-std=c++11" .
make -j $MAKEJ flandmark_static
cp libflandmark/*.h ../include
cp libflandmark/*.a ../lib
;;
macosx-*)
CXX="g++ -fpermissive" $CMAKE -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=$OPENCV_PATH/lib/cmake/opencv4/ -DCMAKE_CXX_FLAGS="-std=c++11" .
make -j $MAKEJ flandmark_static
cp libflandmark/*.h ../include
cp libflandmark/*.a ../lib
;;
windows-x86)
"$CMAKE" -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=$OPENCV_PATH .
nmake flandmark_static
cp libflandmark/*.h ../include
cp libflandmark/*.lib ../lib
;;
windows-x86_64)
"$CMAKE" -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=$OPENCV_PATH .
nmake flandmark_static
cp libflandmark/*.h ../include
cp libflandmark/*.lib ../lib
;;
*)
echo "Error: Platform \"$PLATFORM\" is not supported"
;;
esac
cd ../..