-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemonstrator.sh
More file actions
executable file
·99 lines (82 loc) · 2.13 KB
/
demonstrator.sh
File metadata and controls
executable file
·99 lines (82 loc) · 2.13 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
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
#!/bin/sh
# Crosscompiles demonstrator using already compiled Celix and toolchain from android-ndk
# You have to build the toolchains first in order to crosscompile.
rootdir=$(pwd)
arm() {
# check for toolchain
if [ ! -d "toolchain" ]; then
echo "No toolchain found in: $rootdir/toolchain"
exit 1
fi
# Variables to toolchain and compilers
export PATH=$rootdir/toolchain/bin:$PATH
export CC=arm-linux-androideabi-gcc
export CXX=arm-linux-androideabi-g++
}
arm64() {
# check for arm64 toolchain
if [ ! -d "toolchain64" ]; then
echo "No toolchain64 found in: $rootdir/toolchain64"
exit 1
fi
# Variables to toolchain and compilers
export PATH=$rootdir/toolchain64/bin:$PATH
export CC=aarch64-linux-android-gcc
export CXX=aarch64-linux-android-g++
}
ask_input() {
# input which architecture to compile for
read -p "1) ARM 2) ARM-v7a 3) Aarch64 : " inp
case $inp in
1 )
echo "chose ARM"
cpu_arch=arm
arm;;
2 )
echo "chose ARM-v7a"
cpu_arch=arm-v7a
arm
export CFLAGS="-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16" ;;
3 )
echo "chose ARM-v8a"
cpu_arch=arm-v8a
arm64;;
esac
}
checks_and_makedirs() {
mkdir -p compiled/$cpu_arch
libdir=$rootdir/compiled/$cpu_arch
# Check for demonstrator source in rootdir
if [ ! -d "demonstrator" ]; then
echo "No demonstrator source found at: $rootdir/demonstrator"
exit 1
fi
cd $libdir
# Check if celix is compiled for current architecture
if [ ! -d "celix" ]; then
echo "No celix install found at: $libdir/celix"
exit 1
fi
# Remove older compiled demonstrator
if [ -d "demonstrator" ]; then
rm -r demonstrator
fi
cd $rootdir/demonstrator
# Remove old build folder
if [ -d "build-$cpu_arch" ]; then
rm -r build-$cpu_arch
fi
mkdir -p build-$cpu_arch
}
make_demonstrator() {
cd build-$cpu_arch
cmake -DCELIX_DIR=$libdir/celix -DCMAKE_BUILD_TYPE=Debug -DJANSSON_LIBRARY=$libdir/jansson/lib/libjansson.a -DJANSSON_INCLUDE_DIR=$libdir/jansson/include ..
make && make deploy
mv deploy $libdir/demonstrator
}
main() {
ask_input
checks_and_makedirs
make_demonstrator
}
main