Allow make.sh to compile multiple architectures apk file

This commit is contained in:
Benau 2021-09-25 14:57:03 +08:00
parent 731ed0b16e
commit 42cc2ab239
3 changed files with 42 additions and 277 deletions

View File

@ -4,91 +4,91 @@ include $(CLEAR_VARS)
# OpenAL
LOCAL_MODULE := openal
LOCAL_SRC_FILES := obj/openal/libopenal.a
LOCAL_SRC_FILES := deps-$(TARGET_ARCH_ABI)/openal/libopenal.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
# OGG
LOCAL_MODULE := ogg
LOCAL_SRC_FILES := obj/libogg/libogg.a
LOCAL_SRC_FILES := deps-$(TARGET_ARCH_ABI)/libogg/libogg.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
# Vorbis
LOCAL_MODULE := vorbis
LOCAL_SRC_FILES := obj/libvorbis/lib/libvorbis.a
LOCAL_SRC_FILES := deps-$(TARGET_ARCH_ABI)/libvorbis/lib/libvorbis.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
# Vorbisfile
LOCAL_MODULE := vorbisfile
LOCAL_SRC_FILES := obj/libvorbis/lib/libvorbisfile.a
LOCAL_SRC_FILES := deps-$(TARGET_ARCH_ABI)/libvorbis/lib/libvorbisfile.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
# CURL
LOCAL_MODULE := curl
LOCAL_SRC_FILES := obj/curl/lib/libcurl.a
LOCAL_SRC_FILES := deps-$(TARGET_ARCH_ABI)/curl/lib/libcurl.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
# libmbedtls
LOCAL_MODULE := libmbedtls
LOCAL_SRC_FILES := obj/mbedtls/library/libmbedtls.a
LOCAL_SRC_FILES := deps-$(TARGET_ARCH_ABI)/mbedtls/library/libmbedtls.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
# libmbedcrypto
LOCAL_MODULE := libmbedcrypto
LOCAL_SRC_FILES := obj/mbedtls/library/libmbedcrypto.a
LOCAL_SRC_FILES := deps-$(TARGET_ARCH_ABI)/mbedtls/library/libmbedcrypto.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
# libmbedx509
LOCAL_MODULE := libmbedx509
LOCAL_SRC_FILES := obj/mbedtls/library/libmbedx509.a
LOCAL_SRC_FILES := deps-$(TARGET_ARCH_ABI)/mbedtls/library/libmbedx509.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
# JPEG
LOCAL_MODULE := libjpeg
LOCAL_SRC_FILES := obj/libjpeg/libjpeg.a
LOCAL_SRC_FILES := deps-$(TARGET_ARCH_ABI)/libjpeg/libjpeg.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
# zlib
LOCAL_MODULE := zlib
LOCAL_SRC_FILES := obj/zlib/libz.a
LOCAL_SRC_FILES := deps-$(TARGET_ARCH_ABI)/zlib/libz.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
# PNG
LOCAL_MODULE := png
LOCAL_SRC_FILES := obj/libpng/libpng.a
LOCAL_SRC_FILES := deps-$(TARGET_ARCH_ABI)/libpng/libpng.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
# Freetype
LOCAL_MODULE := freetype
LOCAL_SRC_FILES := obj/freetype/build/libfreetype.a
LOCAL_SRC_FILES := deps-$(TARGET_ARCH_ABI)/freetype/build/libfreetype.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
# Harfbuzz
LOCAL_MODULE := harfbuzz
LOCAL_SRC_FILES := obj/harfbuzz/build/libharfbuzz.a
LOCAL_SRC_FILES := deps-$(TARGET_ARCH_ABI)/harfbuzz/build/libharfbuzz.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
@ -195,9 +195,9 @@ LOCAL_SRC_FILES := $(wildcard ../lib/irrlicht/source/Irrlicht/*.cpp)
LOCAL_CFLAGS := -I../lib/irrlicht/source/Irrlicht/ \
-I../lib/irrlicht/include/ \
-I../src \
-Iobj/libjpeg/ \
-Iobj/libpng/ \
-Iobj/zlib/ \
-Ideps-$(TARGET_ARCH_ABI)/libjpeg/ \
-Ideps-$(TARGET_ARCH_ABI)/libpng/ \
-Ideps-$(TARGET_ARCH_ABI)/zlib/ \
-I../lib/sdl2/include/ \
-I../lib/graphics_engine/include \
-DMOBILE_STK \
@ -278,18 +278,18 @@ LOCAL_CFLAGS := -I../lib/angelscript/include \
-I../lib/sdl2/include \
-I../lib/tinygettext/include \
-I../src \
-Iobj/curl/include \
-Iobj/freetype/include \
-Iobj/harfbuzz/include \
-Iobj/libogg/include \
-Iobj/libvorbis/include \
-Iobj/openal/include \
-Iobj/mbedtls/include \
-Ideps-$(TARGET_ARCH_ABI)/curl/include \
-Ideps-$(TARGET_ARCH_ABI)/freetype/include \
-Ideps-$(TARGET_ARCH_ABI)/harfbuzz/include \
-Ideps-$(TARGET_ARCH_ABI)/libogg/include \
-Ideps-$(TARGET_ARCH_ABI)/libvorbis/include \
-Ideps-$(TARGET_ARCH_ABI)/openal/include \
-Ideps-$(TARGET_ARCH_ABI)/mbedtls/include \
-DUSE_GLES2 \
-DMOBILE_STK \
-DENABLE_SOUND \
-DENABLE_IPV6 \
-DENABLE_CRYPTO_MBEDTLS \
-DENABLE_CRYPTO_MBEDTLS \
-DNDEBUG \
-DDISABLE_ICONV \
-DANDROID_PACKAGE_NAME=\"$(PACKAGE_NAME)\" \

View File

@ -91,7 +91,8 @@ to just run:
export SDK_PATH=/path/to/your/android/sdk
export NDK_PATH=/path/to/your/android/ndk
./generate_assets.sh
./make.sh -j5
./make_deps.sh
./make.sh -j $(($(nproc) + 1))
@ -101,8 +102,8 @@ to just run:
COMPILE_ARCH - Allows one to choose CPU architecture for which the package will
be compiled.
Possible values: armv7, aarch64, x86, x86_64.
Default is: armv7.
Possible values: all, armv7, aarch64, x86, x86_64.
Default is: all.
BUILD_TYPE - Allows one to set build type.
Possible values: debug, release, beta.
@ -152,4 +153,5 @@ variables, so that the apk files can be signed.
and then you make standard compilation with:
./generate_assets.sh
./make_deps.sh
./make.sh -j $(($(nproc) + 1))

View File

@ -10,41 +10,27 @@ export DIRNAME=$(realpath "$(dirname "$0")")
export NDK_PATH_DEFAULT="$DIRNAME/android-ndk"
export SDK_PATH_DEFAULT="$DIRNAME/android-sdk"
export NDK_TOOLCHAIN_PATH="$DIRNAME/obj/bin"
export NDK_BUILD_SCRIPT="$DIRNAME/Android.mk"
export PATH="$DIRNAME/obj/bin:$PATH"
#export NDK_CCACHE=ccache
export NDK_CPPFLAGS="-O3 -g"
export NDK_ABI_ARMV7=armeabi-v7a
export ARCH_ARMV7=arm
export HOST_ARMV7=arm-linux-androideabi
export NDK_PLATFORM_ARMV7=android-16
export MIN_SDK_VERSION_ARMV7=16
export TARGET_SDK_VERSION_ARMV7=29
export COMPILE_SDK_VERSION_ARMV7=29
export NDK_ABI_AARCH64=arm64-v8a
export ARCH_AARCH64=arm64
export HOST_AARCH64=aarch64-linux-android
export NDK_PLATFORM_AARCH64=android-21
export MIN_SDK_VERSION_AARCH64=21
export TARGET_SDK_VERSION_AARCH64=29
export COMPILE_SDK_VERSION_AARCH64=29
export NDK_ABI_X86=x86
export ARCH_X86=x86
export HOST_X86=i686-linux-android
export NDK_PLATFORM_X86=android-16
export MIN_SDK_VERSION_X86=16
export TARGET_SDK_VERSION_X86=29
export COMPILE_SDK_VERSION_X86=29
export NDK_ABI_X86_64=x86_64
export ARCH_X86_64=x86_64
export HOST_X86_64=x86_64-linux-android
export NDK_PLATFORM_X86_64=android-21
export MIN_SDK_VERSION_X86_64=21
export TARGET_SDK_VERSION_X86_64=29
export COMPILE_SDK_VERSION_X86_64=29
@ -97,7 +83,7 @@ fi
# Check if compilation for different platform has been started before
if [ -f "$DIRNAME/obj/compile_arch" ]; then
PROJECT_ARCH=$(cat "$DIRNAME/obj/compile_arch")
if [ -z "$COMPILE_ARCH" ]; then
COMPILE_ARCH="$PROJECT_ARCH"
elif [ "$PROJECT_ARCH" != "$COMPILE_ARCH" ]; then
@ -110,44 +96,37 @@ fi
# Update variables for selected architecture
if [ -z "$COMPILE_ARCH" ]; then
COMPILE_ARCH="armv7"
COMPILE_ARCH="all"
fi
if [ "$COMPILE_ARCH" = "armv7" ]; then
export NDK_PLATFORM=$NDK_PLATFORM_ARMV7
if [ "$COMPILE_ARCH" = "all" ]; then
export NDK_ABI="armeabi-v7a arm64-v8a x86 x86_64"
export MIN_SDK_VERSION=$MIN_SDK_VERSION_ARMV7
export TARGET_SDK_VERSION=$TARGET_SDK_VERSION_ARMV7
export COMPILE_SDK_VERSION=$COMPILE_SDK_VERSION_ARMV7
elif [ "$COMPILE_ARCH" = "armv7" ]; then
export NDK_ABI=$NDK_ABI_ARMV7
export ARCH=$ARCH_ARMV7
export HOST=$HOST_ARMV7
export MIN_SDK_VERSION=$MIN_SDK_VERSION_ARMV7
export TARGET_SDK_VERSION=$TARGET_SDK_VERSION_ARMV7
export COMPILE_SDK_VERSION=$COMPILE_SDK_VERSION_ARMV7
elif [ "$COMPILE_ARCH" = "aarch64" ]; then
export NDK_PLATFORM=$NDK_PLATFORM_AARCH64
export NDK_ABI=$NDK_ABI_AARCH64
export ARCH=$ARCH_AARCH64
export HOST=$HOST_AARCH64
export MIN_SDK_VERSION=$MIN_SDK_VERSION_AARCH64
export TARGET_SDK_VERSION=$TARGET_SDK_VERSION_AARCH64
export COMPILE_SDK_VERSION=$COMPILE_SDK_VERSION_AARCH64
elif [ "$COMPILE_ARCH" = "x86" ]; then
export NDK_PLATFORM=$NDK_PLATFORM_X86
export NDK_ABI=$NDK_ABI_X86
export ARCH=$ARCH_X86
export HOST=$HOST_X86
export MIN_SDK_VERSION=$MIN_SDK_VERSION_X86
export TARGET_SDK_VERSION=$TARGET_SDK_VERSION_X86
export COMPILE_SDK_VERSION=$COMPILE_SDK_VERSION_X86
elif [ "$COMPILE_ARCH" = "x86_64" ]; then
export NDK_PLATFORM=$NDK_PLATFORM_X86_64
export NDK_ABI=$NDK_ABI_X86_64
export ARCH=$ARCH_X86_64
export HOST=$HOST_X86_64
export MIN_SDK_VERSION=$MIN_SDK_VERSION_X86_64
export TARGET_SDK_VERSION=$TARGET_SDK_VERSION_X86_64
export COMPILE_SDK_VERSION=$COMPILE_SDK_VERSION_X86_64
else
echo "Unknow COMPILE_ARCH: $COMPILE_ARCH. Possible values are: " \
"armv7, aarch64, x86, x86_64"
echo "Unknown COMPILE_ARCH: $COMPILE_ARCH. Possible values are:" \
"all, armv7, aarch64, x86, x86_64"
exit
fi
@ -265,7 +244,7 @@ fi
# Set project version and code
if [ -f "$DIRNAME/obj/project_version" ]; then
PROJECT_VERSION_PREV=$(cat "$DIRNAME/obj/project_version")
if [ -z "$PROJECT_VERSION" ]; then
export PROJECT_VERSION="$PROJECT_VERSION_PREV"
elif [ "$PROJECT_VERSION" != "$PROJECT_VERSION_PREV" ]; then
@ -305,236 +284,20 @@ fi
if [ ! -f "$DIRNAME/obj/make_standalone_toolchain.stamp" ]; then
echo "Creating standalone toolchain"
rm -rf "$DIRNAME/obj"
${NDK_PATH}/build/tools/make-standalone-toolchain.sh \
--platform=$NDK_PLATFORM \
--install-dir="$DIRNAME/obj/" \
--arch=$ARCH
check_error
mkdir "$DIRNAME/obj"
touch "$DIRNAME/obj/make_standalone_toolchain.stamp"
echo $COMPILE_ARCH > "$DIRNAME/obj/compile_arch"
fi
# Last ndk supporting android 14 is 17c which has gcc-4.9, and most
# dependencies require clang to build
if [ -f "$DIRNAME/obj/bin/$HOST-gcc-4.9" ]; then
cp "$DIRNAME/obj/bin/clang" "$DIRNAME/obj/bin/$HOST-gcc"
cp "$DIRNAME/obj/bin/clang++" "$DIRNAME/obj/bin/$HOST-g++"
fi
echo "$PROJECT_VERSION" > "$DIRNAME/obj/project_version"
# Zlib
if [ ! -f "$DIRNAME/obj/zlib.stamp" ]; then
echo "Compiling zlib"
mkdir -p "$DIRNAME/obj/zlib"
cp -a -f "$DIRNAME/../lib/zlib/"* "$DIRNAME/obj/zlib"
cd "$DIRNAME/obj/zlib"
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \
-DHOST=$HOST -DARCH=$ARCH -DCMAKE_C_FLAGS="-fpic" &&
make $@
check_error
touch "$DIRNAME/obj/zlib.stamp"
fi
# Libpng
if [ ! -f "$DIRNAME/obj/libpng.stamp" ]; then
echo "Compiling libpng"
mkdir -p "$DIRNAME/obj/libpng"
mkdir -p "$DIRNAME/obj/libpng/lib"
cp -a -f "$DIRNAME/../lib/libpng/"* "$DIRNAME/obj/libpng"
cd "$DIRNAME/obj/libpng"
MLIBRARY="$DIRNAME/obj/sysroot/usr/lib/$HOST/libm.a"
# For ndk 17c
if [ ! -f "$MLIBRARY" ]; then
MLIBRARY="$DIRNAME/obj/sysroot/usr/lib/libm.a"
fi
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \
-DHOST=$HOST -DARCH=$ARCH \
-DZLIB_LIBRARY="$DIRNAME/obj/zlib/libz.a" \
-DZLIB_INCLUDE_DIR="$DIRNAME/obj/zlib/" \
-DM_LIBRARY="$MLIBRARY" \
-DPNG_TESTS=0 -DCMAKE_C_FLAGS="-fpic" &&
make $@
check_error
touch "$DIRNAME/obj/libpng.stamp"
fi
# Freetype bootstrap
if [ ! -f "$DIRNAME/obj/freetype_bootstrap.stamp" ]; then
echo "Compiling freetype bootstrap"
mkdir -p "$DIRNAME/obj/freetype/build"
cp -a -f "$DIRNAME/../lib/freetype/"* "$DIRNAME/obj/freetype"
cd "$DIRNAME/obj/freetype/build"
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \
-DHOST=$HOST -DARCH=$ARCH \
-DZLIB_LIBRARY="$DIRNAME/obj/zlib/libz.a" \
-DZLIB_INCLUDE_DIR="$DIRNAME/obj/zlib/" \
-DPNG_LIBRARY="$DIRNAME/obj/libpng/libpng.a" \
-DPNG_PNG_INCLUDE_DIR="$DIRNAME/obj/libpng/" \
-DFT_WITH_HARFBUZZ=OFF -DFT_WITH_BZIP2=OFF \
-DFT_WITH_BROTLI=OFF -DFT_WITH_ZLIB=ON -DFT_WITH_PNG=ON \
-DCMAKE_C_FLAGS="-fpic" &&
make $@
check_error
# We need to rebuild freetype after harfbuzz is compiled
touch "$DIRNAME/obj/freetype_bootstrap.stamp"
fi
# Harfbuzz
if [ ! -f "$DIRNAME/obj/harfbuzz.stamp" ]; then
echo "Compiling harfbuzz"
mkdir -p "$DIRNAME/obj/harfbuzz/build"
cp -a -f "$DIRNAME/../lib/harfbuzz/"* "$DIRNAME/obj/harfbuzz"
cd "$DIRNAME/obj/harfbuzz/build"
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \
-DHOST=$HOST -DARCH=$ARCH -DBUILD_SHARED_LIBS=OFF \
-DFREETYPE_LIBRARY="$DIRNAME/obj/freetype/build/libfreetype.a $DIRNAME/obj/libpng/libpng.a $DIRNAME/obj/zlib/libz.a" \
-DFREETYPE_INCLUDE_DIRS="$DIRNAME/obj/freetype/include/" \
-DHB_HAVE_GLIB=OFF -DHB_HAVE_GOBJECT=OFF -DHB_HAVE_ICU=OFF \
-DHB_HAVE_FREETYPE=ON -DHB_BUILD_SUBSET=OFF \
-DCMAKE_C_FLAGS="-fpic" -DCMAKE_CXX_FLAGS="-std=gnu++0x -fpic" &&
make $@
check_error
mkdir -p "$DIRNAME/obj/harfbuzz/include/harfbuzz"
cp $DIRNAME/obj/harfbuzz/src/*.h "$DIRNAME/obj/harfbuzz/include/harfbuzz"
touch "$DIRNAME/obj/harfbuzz.stamp"
fi
# Freetype
if [ ! -f "$DIRNAME/obj/freetype.stamp" ]; then
echo "Compiling freetype"
cd "$DIRNAME/obj/freetype/build"
rm -rf *
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \
-DHOST=$HOST -DARCH=$ARCH \
-DZLIB_LIBRARY="$DIRNAME/obj/zlib/libz.a" \
-DZLIB_INCLUDE_DIR="$DIRNAME/obj/zlib/" \
-DPNG_LIBRARY="$DIRNAME/obj/libpng/libpng.a" \
-DPNG_PNG_INCLUDE_DIR="$DIRNAME/obj/libpng/" \
-DHarfBuzz_LIBRARY="$DIRNAME/obj/harfbuzz/build/libharfbuzz.a" \
-DHarfBuzz_INCLUDE_DIR="$DIRNAME/obj/harfbuzz/src/" \
-DFT_WITH_HARFBUZZ=ON -DFT_WITH_BZIP2=OFF \
-DFT_WITH_BROTLI=OFF -DFT_WITH_ZLIB=ON -DFT_WITH_PNG=ON \
-DCMAKE_C_FLAGS="-fpic" &&
make $@
check_error
touch "$DIRNAME/obj/freetype.stamp"
fi
# Openal
if [ ! -f "$DIRNAME/obj/openal.stamp" ]; then
echo "Compiling openal"
mkdir -p "$DIRNAME/obj/openal"
cp -a -f "$DIRNAME/../lib/openal/"* "$DIRNAME/obj/openal"
cd "$DIRNAME/obj/openal"
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \
-DHOST=$HOST -DARCH=$ARCH -DALSOFT_UTILS=0 -DALSOFT_EXAMPLES=0 \
-DLIBTYPE=STATIC -DOPENSL_LIBRARY="-lOpenSLES" \
-DOPENSL_INCLUDE_DIR="$DIRNAME/obj/sysroot/usr/include/SLES/" \
-DOPENSL_ANDROID_INCLUDE_DIR="$DIRNAME/obj/sysroot/usr/include/SLES/" \
-DCMAKE_C_FLAGS="-fpic" -DCMAKE_CXX_FLAGS="-fpic" &&
make $@
check_error
touch "$DIRNAME/obj/openal.stamp"
fi
# MbedTLS
if [ ! -f "$DIRNAME/obj/mbedtls.stamp" ]; then
echo "Compiling mbedtls"
mkdir -p "$DIRNAME/obj/mbedtls"
cp -a -f "$DIRNAME/../lib/mbedtls/"* "$DIRNAME/obj/mbedtls"
cd "$DIRNAME/obj/mbedtls"
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \
-DHOST=$HOST -DARCH=$ARCH -DBUILD_SHARED_LIBS=OFF \
-DENABLE_TESTING=OFF -DENABLE_PROGRAMS=OFF \
-DCMAKE_C_FLAGS="-fpic" &&
make $@
check_error
touch "$DIRNAME/obj/mbedtls.stamp"
fi
# Curl
if [ ! -f "$DIRNAME/obj/curl.stamp" ]; then
echo "Compiling curl"
mkdir -p "$DIRNAME/obj/curl"
cp -a -f "$DIRNAME/../lib/curl/"* "$DIRNAME/obj/curl"
cd "$DIRNAME/obj/curl"
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \
-DHOST=$HOST -DARCH=$ARCH -DBUILD_SHARED_LIBS=OFF \
-DZLIB_LIBRARY="$DIRNAME/obj/zlib/libz.a" \
-DZLIB_INCLUDE_DIR="$DIRNAME/obj/zlib/" \
-DMBEDCRYPTO_LIBRARY="$DIRNAME/obj/mbedtls/library/libmbedcrypto.a" \
-DMBEDTLS_LIBRARY="$DIRNAME/obj/mbedtls/library/libmbedtls.a" \
-DMBEDX509_LIBRARY="$DIRNAME/obj/mbedtls/library/libmbedx509.a" \
-DMBEDTLS_INCLUDE_DIRS="$DIRNAME/obj/mbedtls/include/" \
-DBUILD_TESTING=OFF -DBUILD_CURL_EXE=OFF \
-DCMAKE_USE_MBEDTLS=ON -DUSE_ZLIB=ON -DCMAKE_USE_OPENSSL=OFF \
-DCMAKE_USE_LIBSSH=OFF -DCMAKE_USE_LIBSSH2=OFF \
-DCMAKE_USE_GSSAPI=OFF -DUSE_NGHTTP2=OFF -DUSE_QUICHE=OFF \
-DHTTP_ONLY=ON -DCURL_CA_BUNDLE=none -DCURL_CA_PATH=none \
-DENABLE_THREADED_RESOLVER=ON &&
make $@
check_error
touch "$DIRNAME/obj/curl.stamp"
fi
# Libjpeg
if [ ! -f "$DIRNAME/obj/libjpeg.stamp" ]; then
echo "Compiling libjpeg"
mkdir -p "$DIRNAME/obj/libjpeg"
cp -a -f "$DIRNAME/../lib/libjpeg/"* "$DIRNAME/obj/libjpeg"
cd "$DIRNAME/obj/libjpeg"
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \
-DHOST=$HOST -DARCH=$ARCH -DCMAKE_C_FLAGS="-fpic" &&
make $@
check_error
touch "$DIRNAME/obj/libjpeg.stamp"
fi
# Libogg
if [ ! -f "$DIRNAME/obj/libogg.stamp" ]; then
echo "Compiling libogg"
mkdir -p "$DIRNAME/obj/libogg"
cp -a -f "$DIRNAME/../lib/libogg/"* "$DIRNAME/obj/libogg"
cd "$DIRNAME/obj/libogg"
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \
-DHOST=$HOST -DARCH=$ARCH -DCMAKE_C_FLAGS="-fpic" &&
make $@
check_error
touch "$DIRNAME/obj/libogg.stamp"
fi
# Libvorbis
if [ ! -f "$DIRNAME/obj/libvorbis.stamp" ]; then
echo "Compiling libvorbis"
mkdir -p "$DIRNAME/obj/libvorbis"
cp -a -f "$DIRNAME/../lib/libvorbis/"* "$DIRNAME/obj/libvorbis"
cd "$DIRNAME/obj/libvorbis"
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \
-DHOST=$HOST -DARCH=$ARCH -DCMAKE_C_FLAGS="-fpic" \
-DOGG_LIBRARY="$DIRNAME/obj/libogg/libogg.a" \
-DOGG_INCLUDE_DIR="$DIRNAME/obj/libogg/include" &&
make $@
check_error
touch "$DIRNAME/obj/libvorbis.stamp"
fi
# STK
echo "Compiling STK"
cd "$DIRNAME"
${NDK_PATH}/ndk-build $@ \
APP_BUILD_SCRIPT="$NDK_BUILD_SCRIPT" \
APP_ABI="$NDK_ABI" \
APP_PLATFORM="$NDK_PLATFORM" \
APP_PLATFORM=android-16 \
APP_CPPFLAGS="$NDK_CPPFLAGS" \
APP_STL=c++_static \
NDK_DEBUG=$IS_DEBUG_BUILD