2021-11-23 17:37:22 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
2021-12-05 19:17:58 +00:00
|
|
|
default_abis="armeabi-v7a arm64-v8a x86_64"
|
2021-11-23 17:37:22 +00:00
|
|
|
build_abis=${ABIS:-$default_abis}
|
|
|
|
|
2022-07-11 14:13:31 +00:00
|
|
|
test x$NDK = x && test -e /usr/lib/android-ndk && export NDK=/usr/lib/android-ndk
|
2021-11-23 17:37:22 +00:00
|
|
|
test x$NDK = x && exit 1
|
|
|
|
|
|
|
|
echo "building abis: $build_abis"
|
|
|
|
|
2022-07-11 14:13:31 +00:00
|
|
|
root=$(readlink -f "$1")
|
|
|
|
shift
|
|
|
|
build=$(readlink -f "$1")
|
|
|
|
shift
|
2021-11-23 17:37:22 +00:00
|
|
|
mkdir -p $build
|
|
|
|
cd $build
|
|
|
|
|
|
|
|
for abi in $build_abis; do
|
|
|
|
mkdir -p build-$abi
|
|
|
|
cd build-$abi
|
|
|
|
cmake \
|
2022-07-11 14:13:31 +00:00
|
|
|
-S "$root" -B . \
|
2021-11-23 17:37:22 +00:00
|
|
|
-G 'Unix Makefiles' \
|
|
|
|
-DANDROID=ON \
|
|
|
|
-DANDROID_ABI=$abi \
|
|
|
|
-DANDROID_ARM_MODE=arm \
|
|
|
|
-DANDROID_PLATFORM=android-23 \
|
2022-09-19 22:01:21 +00:00
|
|
|
-DANDROID_API=23 \
|
2021-11-23 17:37:22 +00:00
|
|
|
-DANDROID_STL=c++_static \
|
|
|
|
-DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake \
|
|
|
|
-DBUILD_STATIC_DEPS=ON \
|
|
|
|
-DBUILD_PACKAGE=ON \
|
|
|
|
-DBUILD_SHARED_LIBS=OFF \
|
|
|
|
-DBUILD_TESTING=OFF \
|
|
|
|
-DWITH_TESTS=OFF \
|
2022-07-28 16:07:38 +00:00
|
|
|
-DWITH_BOOTSTRAP=OFF \
|
2021-11-23 17:37:22 +00:00
|
|
|
-DNATIVE_BUILD=OFF \
|
|
|
|
-DSTATIC_LINK=ON \
|
|
|
|
-DWITH_SYSTEMD=OFF \
|
|
|
|
-DFORCE_OXENMQ_SUBMODULE=ON \
|
2022-05-24 16:56:55 +00:00
|
|
|
-DFORCE_OXENC_SUBMODULE=ON \
|
2022-07-11 14:13:31 +00:00
|
|
|
-DFORCE_FMT_SUBMODULE=ON \
|
|
|
|
-DFORCE_SPDLOG_SUBMODULE=ON \
|
2022-07-19 15:31:14 +00:00
|
|
|
-DFORCE_NLOHMANN_SUBMODULE=ON \
|
2021-11-23 17:37:22 +00:00
|
|
|
-DSUBMODULE_CHECK=OFF \
|
|
|
|
-DWITH_LTO=OFF \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
2022-09-19 22:01:21 +00:00
|
|
|
"$@"
|
2021-11-23 17:37:22 +00:00
|
|
|
cd -
|
|
|
|
done
|
|
|
|
rm -f $build/Makefile
|
|
|
|
echo "# generated makefile" >> $build/Makefile
|
|
|
|
echo "all: $build_abis" >> $build/Makefile
|
|
|
|
for abi in $build_abis; do
|
|
|
|
echo -ne "$abi:\n\t" >> $build/Makefile
|
|
|
|
echo -ne '$(MAKE) -C ' >> $build/Makefile
|
|
|
|
echo "build-$abi lokinet-android" >> $build/Makefile
|
|
|
|
echo -ne "\tmkdir -p out/$abi && cp build-$abi/jni/liblokinet-android.so out/$abi/liblokinet-android.so\n\n" >> $build/Makefile
|
2022-07-11 14:13:31 +00:00
|
|
|
echo -ne "clean-$abi:\n\t" >> $build/Makefile
|
|
|
|
echo -ne '$(MAKE) -C ' >> $build/Makefile
|
|
|
|
echo "build-$abi clean" >> $build/Makefile
|
2021-11-23 17:37:22 +00:00
|
|
|
done
|
2022-07-11 14:13:31 +00:00
|
|
|
|
|
|
|
echo -ne "clean:" >> $build/Makefile
|
|
|
|
for targ in $build_abis ; do echo -ne " clean-$targ" >> $build/Makefile ; done
|
|
|
|
echo "" >> $build/Makefile
|