From 2da6abec685c45adf3b36918382ac2f70630f8d7 Mon Sep 17 00:00:00 2001 From: Tal Regev Date: Sun, 17 Apr 2022 01:11:01 +0300 Subject: [PATCH] Add android libs cmake --- .github/workflows/android.yml | 6 ++++- .gitignore | 1 + android/bootstrap_vcpkg_cmake.sh | 20 ++++++++++++++ android/buildAndroidBOINC-CI.sh | 17 +----------- android/ci_build_libs_cmake.sh | 42 +++++++++++++++++++++++++++++ android/ndk_common.sh | 20 ++++++++++++++ lib/vcpkg_config_android/vcpkg.json | 15 +++++++++++ 7 files changed, 104 insertions(+), 17 deletions(-) create mode 100755 android/bootstrap_vcpkg_cmake.sh create mode 100755 android/ci_build_libs_cmake.sh create mode 100644 android/ndk_common.sh create mode 100644 lib/vcpkg_config_android/vcpkg.json diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 377a800fda..3da1840ad3 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - type: [manager, libs, apps, manager-vcpkg, libs-vcpkg, apps-vcpkg] + type: [manager, libs, apps, manager-vcpkg, libs-vcpkg, apps-vcpkg, libs-cmake] fail-fast: false steps: - uses: actions/checkout@v2 @@ -76,6 +76,10 @@ jobs: if: ${{ success() && matrix.type == 'apps-vcpkg' }} run: ./android/ci_build_vcpkg_apps.sh + - name: Build libs with cmake + if: ${{ success() && matrix.type == 'libs-cmake' }} + run: ./android/ci_build_libs_cmake.sh + - name: Prepare logs on failure if: ${{ failure() }} run: 7z a -t7z -mx=9 deploy/logs.7z config.log android/BOINC/app/build/reports/ -r0 3rdParty/android/vcpkg/buildtrees/*.log diff --git a/.gitignore b/.gitignore index b1aa3df361..9af9fafc96 100644 --- a/.gitignore +++ b/.gitignore @@ -234,4 +234,5 @@ vda/vdad # cmake build build/ +build-*/ diff --git a/android/bootstrap_vcpkg_cmake.sh b/android/bootstrap_vcpkg_cmake.sh new file mode 100755 index 0000000000..acf5e90cb3 --- /dev/null +++ b/android/bootstrap_vcpkg_cmake.sh @@ -0,0 +1,20 @@ +#!/bin/sh +set -e + +PLATFORM_NAME="android" + +if [ ! -d "$PLATFORM_NAME" ]; then + echo "start this script in the source root directory" + exit 1 +fi + +BUILD_DIR="$PWD/3rdParty/$PLATFORM_NAME" +VCPKG_ROOT="$BUILD_DIR/vcpkg" + +if [ ! -d $VCPKG_ROOT ]; then + mkdir -p $BUILD_DIR + git -C $BUILD_DIR clone https://github.com/microsoft/vcpkg +fi + +git -C $VCPKG_ROOT pull +$VCPKG_ROOT/bootstrap-vcpkg.sh diff --git a/android/buildAndroidBOINC-CI.sh b/android/buildAndroidBOINC-CI.sh index 17d6850331..61f15a273d 100755 --- a/android/buildAndroidBOINC-CI.sh +++ b/android/buildAndroidBOINC-CI.sh @@ -24,8 +24,6 @@ export REV=1 export ARMV6_REV=1 export OPENSSL_VERSION=1.1.1l export CURL_VERSION=7.80.0 -export NDK_VERSION=21d -export NDK_ARMV6_VERSION=15c # checks if a given path is canonical (absolute and does not contain relative links) # from http://unix.stackexchange.com/a/256437 @@ -145,10 +143,9 @@ if [ "${silent}" = "yes" ]; then export STDOUT_TARGET="/dev/null" fi +. $(pwd)/ndk_common.sh export NDK_FLAGFILE="$PREFIX/NDK-${NDK_VERSION}-${REV}_done" export NDK_ARMV6_FLAGFILE="$PREFIX/NDK-${NDK_ARMV6_VERSION}-armv6-${ARMV6_REV}_done" -export NDK_ROOT=$BUILD_DIR/android-ndk-r${NDK_VERSION} -export NDK_ARMV6_ROOT=$BUILD_DIR/android-ndk-r${NDK_ARMV6_VERSION} export OPENSSL_SRC=$BUILD_DIR/openssl-${OPENSSL_VERSION} export CURL_SRC=$BUILD_DIR/curl-${CURL_VERSION} export VCPKG_ROOT="$BUILD_DIR/vcpkg" @@ -167,19 +164,7 @@ else export ANDROID_TC_FLAGFILE="$PREFIX/ANDROID_TC_WITH_NDK-${NDK_VERSION}-${arch}-${REV}_done" fi -createNDKFolder() -{ - rm -rf "$BUILD_DIR/android-ndk-r${NDK_VERSION}" - wget -c --no-verbose -O /tmp/ndk_${NDK_VERSION}.zip https://dl.google.com/android/repository/android-ndk-r${NDK_VERSION}-linux-x86_64.zip - unzip -qq /tmp/ndk_${NDK_VERSION}.zip -d $BUILD_DIR -} -createNDKARMV6Folder() -{ - rm -rf "$BUILD_DIR/android-ndk-r${NDK_ARMV6_VERSION}" - wget -c --no-verbose -O /tmp/ndk_armv6_${NDK_ARMV6_VERSION}.zip https://dl.google.com/android/repository/android-ndk-r${NDK_ARMV6_VERSION}-linux-x86_64.zip - unzip -qq /tmp/ndk_armv6_${NDK_ARMV6_VERSION}.zip -d $BUILD_DIR -} if [ ! -e "${NDK_FLAGFILE}" ]; then createNDKFolder diff --git a/android/ci_build_libs_cmake.sh b/android/ci_build_libs_cmake.sh new file mode 100755 index 0000000000..67ecabe21c --- /dev/null +++ b/android/ci_build_libs_cmake.sh @@ -0,0 +1,42 @@ +#!/bin/sh +set -e + +PLATFORM_NAME="android" + +if [ ! -d "$PLATFORM_NAME" ]; then + echo "start this script in the source root directory" + exit 1 +fi + +BUILD_DIR="$PWD/3rdParty/$PLATFORM_NAME" +VCPKG_ROOT="$BUILD_DIR/vcpkg" +VCPKG_PORTS="$PWD/3rdParty/vcpkg_ports" +. $PLATFORM_NAME/ndk_common.sh + +if [ ! -d $NDK_ROOT ]; then + createNDKFolder +fi + +if [ ! -d $NDK_ARMV6_ROOT ]; then + createNDKARMV6Folder +fi + +$PLATFORM_NAME/bootstrap_vcpkg_cmake.sh +./_autosetup + +TRIPLETS_LIST="armv6-android arm-android arm-neon-android arm64-android x86-android x64-android" + +for TRIPLET in $TRIPLETS_LIST ; do + echo "\e[0;35m building $TRIPLET ... \e[0m" + + if [ "$TRIPLET" = "armv6-android" ]; then + export ANDROID_NDK_HOME=$NDK_ARMV6_ROOT + else + export ANDROID_NDK_HOME=$NDK_ROOT + fi + BUILD_TRIPLET=build-$TRIPLET + cmake lib -B $BUILD_TRIPLET -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -DVCPKG_OVERLAY_PORTS=$VCPKG_PORTS/ports -DVCPKG_OVERLAY_TRIPLETS=$VCPKG_PORTS/triplets/ci -DVCPKG_TARGET_TRIPLET=$TRIPLET -DVCPKG_MANIFEST_DIR=lib/vcpkg_config_android -DVCPKG_INSTALL_OPTIONS=--clean-after-build + cmake --build $BUILD_TRIPLET + + echo "\e[1;32m $TRIPLET done \e[0m" +done diff --git a/android/ndk_common.sh b/android/ndk_common.sh new file mode 100644 index 0000000000..e8745c4c96 --- /dev/null +++ b/android/ndk_common.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +export NDK_VERSION=21d +export NDK_ARMV6_VERSION=15c +export NDK_ROOT=$BUILD_DIR/android-ndk-r${NDK_VERSION} +export NDK_ARMV6_ROOT=$BUILD_DIR/android-ndk-r${NDK_ARMV6_VERSION} + +createNDKFolder() +{ + rm -rf "$BUILD_DIR/android-ndk-r${NDK_VERSION}" + wget -c --no-verbose -O /tmp/ndk_${NDK_VERSION}.zip https://dl.google.com/android/repository/android-ndk-r${NDK_VERSION}-linux-x86_64.zip + unzip -qq /tmp/ndk_${NDK_VERSION}.zip -d $BUILD_DIR +} + +createNDKARMV6Folder() +{ + rm -rf "$BUILD_DIR/android-ndk-r${NDK_ARMV6_VERSION}" + wget -c --no-verbose -O /tmp/ndk_armv6_${NDK_ARMV6_VERSION}.zip https://dl.google.com/android/repository/android-ndk-r${NDK_ARMV6_VERSION}-linux-x86_64.zip + unzip -qq /tmp/ndk_armv6_${NDK_ARMV6_VERSION}.zip -d $BUILD_DIR +} diff --git a/lib/vcpkg_config_android/vcpkg.json b/lib/vcpkg_config_android/vcpkg.json new file mode 100644 index 0000000000..3741e30d3d --- /dev/null +++ b/lib/vcpkg_config_android/vcpkg.json @@ -0,0 +1,15 @@ +{ + "name": "boinc-libs", + "version-string": "7.19.0", + "builtin-baseline":"bd1ef2df46303989eeb048eb7aa9b816aa46365e", + "dependencies": + [ + "openssl" + ], + "overrides": [ + { + "name": "openssl", + "version-string": "1.1.1n" + } + ] +}