make_skm.sh
2.49 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
## Keep track of where we are now
if [ "$#" -lt 1 ]; then
echo -e "Illegal number of parameters!!\n"
echo -e "Usage: $0 {Release|Debug} where the second parameter is the build type (Release or Debug)"
exit 1
fi
pwkdir=$(pwd)
build_type=$1
echo -e "Build type is ${build_type^}\n"
echo -e "-- Present working directory is ${pwkdir}"
if [ -d ../../metadata ]
then
echo -e "-- Moved to `pwd` in order to generate build info"
echo -e "-- ======================= GENERATING CURRENT BUILD DATA ========================="
cd ../../metadata
if [ -f run.sh ]
then
./run.sh
else
file="../common/core/build_data.h"
if [ -f $file ]; then
contents="`cat $file`"
echo -e "\nPrevious build key: $contents \n"
fi
# if there was any previous build directory, clean it up
if [ -d build ]
then
echo -e "\n>>Cleaning previous builds"
rm -Rfd build
echo -e "Clean up completed\n"
fi
echo -e "\n>>Building the make file. Please wait..."
mkdir _build && cd _build && cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release >>output.txt
echo -e "\n>>Creating the executable. Please wait.."
make >> output.txt
echo -e "\n>>Running the executable"
./metadata
cd ..
if [ ! -d build ]; then
mkdir build
fi
cp _build/metadata build/
if [ -d _build ]
then
#echo -e "\n>>Cleaning previous builds"
rm -Rf _build
#echo -e "Clean up completed\n"
fi
if [ -f $file ]; then
contents="`cat $file`"
echo -e "\nCurrent build key: ${contents} \n"
fi
fi
echo -e "-- ========================== BUILD DATA COMPLETE ======================\n"
fi
# Move back to where we are comming from [Android root directory]
cd $pwkdir
echo -e "-- Back in ${pwkdir} to generate the libskm\n"
if [ ! -d "${build_type,,}"_build ]
then mkdir "${build_type,,}"_build
fi
cd "${build_type,,}"_build
echo -e "-- Now in ${pwkdir} to generate the libskm in ${build_type^} \n"
cmake .. -G Ninja -DCMAKE_ANDROID_ARCH_ABI:STRING="arm64-v8a" -DANDROID_ABI:STRING="arm64-v8a" \
-DANDROID_PLATFORM:STRING="android-29" -DCMAKE_TOOLCHAIN_FILE:FILEPATH=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
-DSELF_BUILD:BOOL=True -DCMAKE_BUILD_TYPE="${build_type^}" -D_UNITY_BUILD_=True && ninja -j8 && cp libskm.a ../libskm.a