Skip to content

Commit

Permalink
CI/CD - switch Android build to CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
gkv311 committed Jan 8, 2025
1 parent e9aa38f commit 8b16d29
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y \
g++
g++ ninja-build
- name: Compile
run: |
./adm/ci/build_sview_android.sh
52 changes: 45 additions & 7 deletions adm/ci/build_sview_android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD";

aSrcRoot=$aScriptPath/../..
aBuildPath=$aSrcRoot/build

aParties=$aSrcRoot/3rdparty/android

if [ ! -x "$aParties/unpack.sh" ]; then
Expand All @@ -20,11 +22,47 @@ if [ ! -d "${SVIEW_NDK}" ]; then exit 1; fi;
# define number of jobs from available CPU cores
aNbJobs="$(getconf _NPROCESSORS_ONLN)"

SVIEW_ANDROID_API=21
# armeabi-v7a arm64-v8a x86 x86_64
#SVIEW_ANDROID_ARCH=arm64-v8a
SVIEW_ANDROID_ARCH=armeabi-v7a
aCompiler=gcc
aCppLib=gnustl_shared
if [[ ! -d "${SVIEW_NDK}/sources/cxx-stl/gnu-libstdc++" ]]; then
if [[ -d "${SVIEW_NDK}/sources/cxx-stl/llvm-libc++" ]]; then
aCompiler=clang
aCppLib=c++_shared
fi
fi

# perform building itself
make --directory=$aSrcRoot clean
make --directory=$aSrcRoot genjavares ANDROID_NDK=$SVIEW_NDK ANDROID_BUILD_TOOLS=$SVIEW_BUILD_TOOLS ANDROID_PLATFORM=$SVIEW_PLATFORM \
FFMPEG_ROOT=$SVIEW_FFMPEG FREETYPE_ROOT=$SVIEW_FREETYPE OPENAL_ROOT=$SVIEW_OPENAL LIBCONFIG_ROOT=$SVIEW_LIBCONFIG WERROR_LEVEL=1
make --directory=$aSrcRoot sView_keystore_debug ANDROID_NDK=$SVIEW_NDK ANDROID_BUILD_TOOLS=$SVIEW_BUILD_TOOLS ANDROID_PLATFORM=$SVIEW_PLATFORM \
FFMPEG_ROOT=$SVIEW_FFMPEG FREETYPE_ROOT=$SVIEW_FREETYPE OPENAL_ROOT=$SVIEW_OPENAL LIBCONFIG_ROOT=$SVIEW_LIBCONFIG WERROR_LEVEL=1
make --directory=$aSrcRoot -j $aNbJobs android ANDROID_NDK=$SVIEW_NDK ANDROID_BUILD_TOOLS=$SVIEW_BUILD_TOOLS ANDROID_PLATFORM=$SVIEW_PLATFORM \
FFMPEG_ROOT=$SVIEW_FFMPEG FREETYPE_ROOT=$SVIEW_FREETYPE OPENAL_ROOT=$SVIEW_OPENAL LIBCONFIG_ROOT=$SVIEW_LIBCONFIG WERROR_LEVEL=1
#make --directory=$aSrcRoot clean
#make --directory=$aSrcRoot genjavares ANDROID_NDK=$SVIEW_NDK ANDROID_BUILD_TOOLS=$SVIEW_BUILD_TOOLS ANDROID_PLATFORM=$SVIEW_PLATFORM \
# FFMPEG_ROOT=$SVIEW_FFMPEG FREETYPE_ROOT=$SVIEW_FREETYPE OPENAL_ROOT=$SVIEW_OPENAL LIBCONFIG_ROOT=$SVIEW_LIBCONFIG WERROR_LEVEL=1
#make --directory=$aSrcRoot sView_keystore_debug ANDROID_NDK=$SVIEW_NDK ANDROID_BUILD_TOOLS=$SVIEW_BUILD_TOOLS ANDROID_PLATFORM=$SVIEW_PLATFORM \
# FFMPEG_ROOT=$SVIEW_FFMPEG FREETYPE_ROOT=$SVIEW_FREETYPE OPENAL_ROOT=$SVIEW_OPENAL LIBCONFIG_ROOT=$SVIEW_LIBCONFIG WERROR_LEVEL=1
#make --directory=$aSrcRoot -j $aNbJobs android ANDROID_NDK=$SVIEW_NDK ANDROID_BUILD_TOOLS=$SVIEW_BUILD_TOOLS ANDROID_PLATFORM=$SVIEW_PLATFORM \
# FFMPEG_ROOT=$SVIEW_FFMPEG FREETYPE_ROOT=$SVIEW_FREETYPE OPENAL_ROOT=$SVIEW_OPENAL LIBCONFIG_ROOT=$SVIEW_LIBCONFIG WERROR_LEVEL=1

cmake -G "Ninja Multi-Config" \
-D BUILD_TREAT_WARNINGS_AS_ERRORS=ON \
-D CMAKE_BUILD_TYPE="Release" \
-D CMAKE_INSTALL_PREFIX="$aBuildPath/install" \
-D CMAKE_SYSTEM_NAME:STRING="Android" \
-D CMAKE_ANDROID_NDK="${SVIEW_NDK}" \
-D CMAKE_BUILD_TYPE:STRING="Release" \
-D CMAKE_ANDROID_ARCH_ABI:STRING="${SVIEW_ANDROID_ARCH}" \
-D CMAKE_SYSTEM_VERSION:STRING="${SVIEW_ANDROID_API}" \
-D CMAKE_ANDROID_STL_TYPE="$aCppLib" \
-D ANDROID_PLATFORM:PATH="${SVIEW_PLATFORM}" \
-D ANDROID_BUILD_TOOLS:PATH="${SVIEW_BUILD_TOOLS}" \
-D FREETYPE_DIR="$SVIEW_FREETYPE" \
-D FFMPEG_DIR="$SVIEW_FFMPEG" \
-D OPENAL_DIR="$SVIEW_OPENAL" \
-D LIBCONFIGCPP_DIR="$SVIEW_LIBCONFIG" \
-D USE_OPENVR=OFF \
-S "$aSrcRoot" -B "$aBuildPath"

cmake --build "$aBuildPath" --config Release --target clean
cmake --build "$aBuildPath" --config Release --target sView_keystore_debug
cmake --build "$aBuildPath" --config Release

0 comments on commit 8b16d29

Please sign in to comment.