[build] add cJSON to android build scripts

This commit is contained in:
Armin Novak 2023-03-09 10:10:16 +01:00 committed by akallabeth
parent 9f1fc5adaf
commit 69aa1ff9db
6 changed files with 79 additions and 1 deletions

View File

@ -12,6 +12,7 @@
WITH_OPENH264=0
WITH_OPENSSL=1
WITH_FFMPEG=1
WITH_CJSON=1
BUILD_DEPS=1
DEPS_ONLY=0
NDK_TARGET=21
@ -23,6 +24,8 @@ OPENSSL_TAG=openssl-1.1.1s
OPENSSL_HASH=c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa
FFMPEG_TAG=n4.4.1
FFMPEG_HASH=82b43cc67296bcd01a59ae6b327cdb50121d3a9e35f41a30de1edd71bb4a6666
CJSON_TAG=v1.7.15
CJSON_HASH=5308fd4bd90cef7aa060558514de6a1a4a0819974a26e6ed13973c5f624c24b2
SRC_DIR=$SCRIPT_PATH/..
BUILD_DST=$SCRIPT_PATH/../client/Android/Studio/freeRDPCore/src/main/jniLibs

View File

@ -12,6 +12,7 @@
WITH_OPENH264=1
WITH_OPENSSL=1
WITH_FFMPEG=1
WITH_CJSON=1
BUILD_DEPS=1
DEPS_ONLY=0
NDK_TARGET=21
@ -23,6 +24,8 @@ OPENSSL_TAG=openssl-1.1.1s
OPENSSL_HASH=c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa
FFMPEG_TAG=n4.4.1
FFMPEG_HASH=82b43cc67296bcd01a59ae6b327cdb50121d3a9e35f41a30de1edd71bb4a6666
CJSON_TAG=v1.7.15
CJSON_HASH=5308fd4bd90cef7aa060558514de6a1a4a0819974a26e6ed13973c5f624c24b2
SRC_DIR=$SCRIPT_PATH/..
BUILD_DST=$SCRIPT_PATH/../client/Android/Studio/freeRDPCore/src/main/jniLibs

42
scripts/android-build-cjson.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
SCM_URL=https://github.com/DaveGamble/cJSON/archive
SCM_TAG=v1.7.15
SCM_HASH=5308fd4bd90cef7aa060558514de6a1a4a0819974a26e6ed13973c5f624c24b2
source $(dirname "${BASH_SOURCE[0]}")/android-build-common.sh
# Run the main program.
common_parse_arguments $@
common_check_requirements
common_update $SCM_URL $SCM_TAG $BUILD_SRC $SCM_HASH
# Prepare the environment
common_run mkdir -p $BUILD_SRC
CMAKE_CMD_ARGS="-DANDROID_NDK=$ANDROID_NDK \
-DANDROID_NATIVE_API_LEVEL=android-${NDK_TARGET} \
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
-DENABLE_CJSON_TEST=OFF \
-DENABLE_HIDDEN_SYMBOLS=OFF \
-DCMAKE_MAKE_PROGRAM=make"
BASE=$(pwd)
for ARCH in $BUILD_ARCH
do
common_run cd $BASE
common_run mkdir -p $BUILD_SRC/cJSON-build/$ARCH
common_run cd $BUILD_SRC/cJSON-build/$ARCH
common_run export ANDROID_NDK=$ANDROID_NDK
common_run $CMAKE_PROGRAM $CMAKE_CMD_ARGS \
-DANDROID_ABI=$ARCH \
-DCMAKE_INSTALL_PREFIX=$BUILD_DST/$ARCH \
-DCMAKE_INSTALL_LIBDIR=. \
-B . \
-S $BUILD_SRC
echo $(pwd)
common_run $CMAKE_PROGRAM --build . --target install
done
echo "Successfully build library for architectures $BUILD_ARCH"

View File

@ -6,10 +6,13 @@ OPENSSL_TAG=openssl-1.1.1s
OPENSSL_HASH=c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa
FFMPEG_TAG=n4.4.1
FFMPEG_HASH=82b43cc67296bcd01a59ae6b327cdb50121d3a9e35f41a30de1edd71bb4a6666
CJSON_TAG=v1.7.15
CJSON_HASH=d348621ca93571343a56862df7de4ff3bc9b5667
WITH_OPENH264=0
WITH_OPENSSL=0
WITH_FFMPEG=0
WITH_CJSON=0
SRC_DIR=$(dirname "${BASH_SOURCE[0]}")
SRC_DIR=$(realpath "$SRC_DIR")
@ -46,6 +49,10 @@ do
WITH_FFMPEG=1
shift
;;
--cjson)
WITH_CJSON=1
shift
;;
--openssl)
WITH_OPENSSL=1
shift
@ -155,6 +162,20 @@ do
else
CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_FFMPEG=OFF"
fi
if [ $WITH_CJSON -ne 0 ];
then
if [ $BUILD_DEPS -ne 0 ];
then
common_run bash $SCRIPT_PATH/android-build-cjson.sh \
--src $BUILD_SRC/cjson --dst $BUILD_DST \
--sdk "$ANDROID_SDK" \
--ndk "$ANDROID_NDK" \
--arch $ARCH \
--target $NDK_TARGET \
--tag $CJSON_TAG \
--hash $CJSON_HASH
fi
fi
if [ $WITH_OPENSSL -ne 0 ];
then
if [ $BUILD_DEPS -ne 0 ];
@ -164,7 +185,7 @@ do
--sdk "$ANDROID_SDK" \
--ndk $ANDROID_NDK \
--arch $ARCH \
--target $NDK_TARGET \
--target $NDK_TARGET \
--tag $OPENSSL_TAG \
--hash $OPENSSL_HASH
fi
@ -181,6 +202,9 @@ do
-DANDROID_ABI=$ARCH \
-DCMAKE_INSTALL_PREFIX=$BUILD_DST/$ARCH \
-DCMAKE_INSTALL_LIBDIR=. \
-DCMAKE_PREFIX_PATH=$BUILD_DST/$ARCH \
-DCMAKE_SHARED_LINKER_FLAGS="-L$BUILD_DST/$ARCH" \
-DcJSON_DIR=$BUILD_DST/$ARCH/cmake/cJSON \
$SRC_DIR
echo $(pwd)
common_run $CMAKE_PROGRAM --build . --target install

View File

@ -12,6 +12,7 @@
WITH_OPENH264=0
WITH_OPENSSL=1
WITH_FFMPEG=1
WITH_CJSON=1
BUILD_DEPS=1
DEPS_ONLY=0
NDK_TARGET=23
@ -23,6 +24,8 @@ OPENSSL_TAG=openssl-1.1.1s
OPENSSL_HASH=c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa
FFMPEG_TAG=n4.4.1
FFMPEG_HASH=82b43cc67296bcd01a59ae6b327cdb50121d3a9e35f41a30de1edd71bb4a6666
CJSON_TAG=v1.7.15
CJSON_HASH=5308fd4bd90cef7aa060558514de6a1a4a0819974a26e6ed13973c5f624c24b2
SRC_DIR=$SCRIPT_PATH/..
BUILD_DST=$SCRIPT_PATH/../client/Android/Studio/freeRDPCore/src/main/jniLibs

View File

@ -12,6 +12,7 @@
WITH_OPENH264=0
WITH_OPENSSL=1
WITH_FFMPEG=0
WITH_CJSON=1
BUILD_DEPS=1
DEPS_ONLY=0
NDK_TARGET=21
@ -23,6 +24,8 @@ OPENSSL_TAG=openssl-1.1.1s
OPENSSL_HASH=c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa
FFMPEG_TAG=n4.4.1
FFMPEG_HASH=82b43cc67296bcd01a59ae6b327cdb50121d3a9e35f41a30de1edd71bb4a6666
CJSON_TAG=v1.7.15
CJSON_HASH=5308fd4bd90cef7aa060558514de6a1a4a0819974a26e6ed13973c5f624c24b2
SRC_DIR=$SCRIPT_PATH/..
BUILD_DST=$SCRIPT_PATH/../client/Android/Studio/freeRDPCore/src/main/jniLibs