8000 add github actions to cross-compile for android · log4cplus/log4cplus@cd78240 · GitHub
[go: up one dir, main page]

Skip to content

Commit cd78240

Browse files
leleliu008wilx
authored andcommitted
add github actions to cross-compile for android
(cherry picked from commit e6ab2ee) Signed-off-by: Vaclav Haisman <vhaisman@gmail.com>
1 parent 501a8b8 commit cd78240

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

.github/workflows/android.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: cross compile with android-ndk
2+
3+
on:
4+
push:
5+
branches: [ 2.0.x ]
6+
pull_request:
7+
branches: [ 2.0.x ]
8+
9+
jobs:
10+
cross-compile:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
target-abi: [armeabi-v7a, arm64-v8a, x86, x86_64]
15+
16+
runs-on: ubuntu-20.04
17+
18+
steps:
19+
- run: brew install tree
20+
21+
- uses: actions/checkout@v2
22+
23+
- name: build for ${{ matrix.target-abi }}
24+
run: |
25+
COLOR_GREEN='\033[0;32m' # Green
26+
COLOR_PURPLE='\033[0;35m' # Purple
27+
COLOR_OFF='\033[0m' # Reset
28+
29+
run() {
30+
printf '%b\n' "$COLOR_PURPLE==>$COLOR_OFF $COLOR_GREEN$*$COLOR_OFF"
31+
eval "$*"
32+
}
33+
34+
run "env | sed -n '/^ANDROID_/p'"
35+
36+
BUILD_MACHINE_OS_TYPE=$(uname | tr A-Z a-z)
37+
BUILD_MACHINE_OS_ARCH=$(uname -m)
38+
39+
ANDROID_NDK_VERS=$(grep "Pkg.Revision" "$ANDROID_NDK_HOME/source.properties" | cut -d " " -f3)
40+
ANDROID_NDK_BASE=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$BUILD_MACHINE_OS_TYPE-$BUILD_MACHINE_OS_ARCH
41+
ANDROID_NDK_BIND=$ANDROID_NDK_BASE/bin
42+
SYSROOT=$ANDROID_NDK_BASE/sysroot
43+
44+
printf '%s = %s\n' ANDROID_NDK_BASE "$ANDROID_NDK_BASE"
45+
printf '%s = %s\n' ANDROID_NDK_VERS "$ANDROID_NDK_VERS"
46+
47+
run cmake --version
48+
49+
run cmake \
50+
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \
51+
-DCMAKE_INSTALL_PREFIX=$PWD/install.d \
52+
-DCMAKE_BUILD_TYPE=Release \
53+
-DCMAKE_VERBOSE_MAKEFILE=ON \
54+
-DANDROID_TOOLCHAIN=clang \
55+
-DANDROID_ABI=${{ matrix.target-abi }} \
56+
-DANDROID_PLATFORM=21 \
57+
-S . \
58+
-B build.d \
59+
60+
run cmake --build build.d
61+
62+
run cmake --install build.d
63+
64+
run tree install.d
65+

0 commit comments

Comments
 (0)
0