-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmake-turbojpeg.sh
More file actions
executable file
·48 lines (44 loc) · 1.46 KB
/
make-turbojpeg.sh
File metadata and controls
executable file
·48 lines (44 loc) · 1.46 KB
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
#!/bin/bash
ABSPATH="$(pwd)"
if [[ $TOOLCHAIN ]]; then
if [[ ! -f ${TOOLCHAIN}gcc ]]; then
echo "The toolchain you have provided is invalid. ${TOOLCHAIN}gcc does not exist."
exit 1
fi
else
if [[ ! -f ${ABSPATH}/vic-toolchain/arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc ]]; then
echo "Toolchain not found. Either define one or follow the README instructions to clone the vic-toolchain submodule."
exit 1
else
TOOLCHAIN=${ABSPATH}/vic-toolchain/arm-linux-gnueabi/bin/arm-linux-gnueabi-
fi
fi
if [[ ! -f libjpeg-turbo/CMakeLists.txt ]]; then
echo "libjpeg-turbo has not been cloned. Follow the README instructions to clone the submodule."
else
echo "Everything is in place! Building libjpeg-turbo..."
cd libjpeg-turbo
rm -rf build
mkdir -p build
cd build
if [[ $TOOLCHAIN == *"gnueabihf"* ]]; then
ARMCC_FLAGS="-mfloat-abi=hard -mfpu=neon-vfpv4 -mcpu=cortex-a7 -O3 -ffast-math -fopenmp"
else
ARMCC_FLAGS="-mfloat-abi=softfp -mfpu=neon-vfpv4 -mcpu=cortex-a7 -O3 -ffast-math -fopenmp"
fi
ARMCC_PREFIX=${TOOLCHAIN}
cmake -DCMAKE_C_COMPILER=${ARMCC_PREFIX}gcc \
-DCMAKE_CXX_COMPILER=${ARMCC_PREFIX}g++ \
-DCMAKE_C_FLAGS="${ARMCC_FLAGS}" \
-DCMAKE_CXX_FLAGS="${ARMCC_FLAGS}" \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DCMAKE_INSTALL_PREFIX=${ABSPATH}/build/libjpeg-turbo \
-DCMAKE_SYSTEM_NAME=Linux \
-DCMAKE_SYSTEM_PROCESSOR=armv7 \
..
cd build
make -j
make install
echo
echo "libjpeg-turbo has been built! ${ABSPATH}/build/libjpeg-turbo/lib"
fi