Build libsquish and astc-encoder for android
This commit is contained in:
parent
d7390a1824
commit
1b671c932a
@ -93,6 +93,20 @@ include $(PREBUILT_STATIC_LIBRARY)
|
|||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
|
||||||
|
# libsquish
|
||||||
|
LOCAL_MODULE := libsquish
|
||||||
|
LOCAL_SRC_FILES := deps-$(TARGET_ARCH_ABI)/libsquish/libsquish.a
|
||||||
|
include $(PREBUILT_STATIC_LIBRARY)
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
|
||||||
|
# astc-encoder
|
||||||
|
LOCAL_MODULE := libastcenc
|
||||||
|
LOCAL_SRC_FILES := deps-$(TARGET_ARCH_ABI)/astc-encoder/Source/libastcenc.a
|
||||||
|
include $(PREBUILT_STATIC_LIBRARY)
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
|
||||||
# ifaddrs
|
# ifaddrs
|
||||||
LOCAL_MODULE := ifaddrs
|
LOCAL_MODULE := ifaddrs
|
||||||
LOCAL_PATH := .
|
LOCAL_PATH := .
|
||||||
@ -168,15 +182,18 @@ LOCAL_PATH := .
|
|||||||
LOCAL_CPP_FEATURES += rtti exceptions
|
LOCAL_CPP_FEATURES += rtti exceptions
|
||||||
LOCAL_SRC_FILES := $(wildcard ../lib/graphics_engine/src/*.c) \
|
LOCAL_SRC_FILES := $(wildcard ../lib/graphics_engine/src/*.c) \
|
||||||
$(wildcard ../lib/graphics_engine/src/*.cpp)
|
$(wildcard ../lib/graphics_engine/src/*.cpp)
|
||||||
LOCAL_CFLAGS := -I../lib/graphics_engine/include \
|
LOCAL_CFLAGS := -DENABLE_LIBASTCENC \
|
||||||
|
-I../lib/graphics_engine/include \
|
||||||
-I../lib/graphics_utils \
|
-I../lib/graphics_utils \
|
||||||
-I../lib/sdl2/include/ \
|
-I../lib/sdl2/include/ \
|
||||||
-I../lib/bullet/src/ \
|
-I../lib/bullet/src/ \
|
||||||
-I../lib/irrlicht/include/
|
-I../lib/irrlicht/include/ \
|
||||||
|
-I../lib/libsquish \
|
||||||
|
-Ideps-$(TARGET_ARCH_ABI)/astc-encoder/Source
|
||||||
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
|
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
|
||||||
LOCAL_ARM_NEON := false
|
LOCAL_ARM_NEON := false
|
||||||
endif
|
endif
|
||||||
LOCAL_STATIC_LIBRARIES := shaderc
|
LOCAL_STATIC_LIBRARIES := shaderc libsquish libastcenc
|
||||||
include $(BUILD_STATIC_LIBRARY)
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
$(call import-module, third_party/shaderc)
|
$(call import-module, third_party/shaderc)
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
@ -283,6 +283,64 @@ build_deps()
|
|||||||
check_error
|
check_error
|
||||||
touch "$DIRNAME/deps-$ARCH_OPTION/libvorbis.stamp"
|
touch "$DIRNAME/deps-$ARCH_OPTION/libvorbis.stamp"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Libsquish
|
||||||
|
if [ ! -f "$DIRNAME/deps-$ARCH_OPTION/libsquish.stamp" ]; then
|
||||||
|
echo "Compiling $ARCH_OPTION libsquish"
|
||||||
|
mkdir -p "$DIRNAME/deps-$ARCH_OPTION/libsquish"
|
||||||
|
cp -a -f "$DIRNAME/../lib/libsquish/"* "$DIRNAME/deps-$ARCH_OPTION/libsquish"
|
||||||
|
|
||||||
|
cd "$DIRNAME/deps-$ARCH_OPTION/libsquish"
|
||||||
|
if [[ "$ARCH_OPTION" = "x86" || "$ARCH_OPTION" = "x86_64" ]]; then
|
||||||
|
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \
|
||||||
|
-DHOST=$HOST -DARCH=$ARCH \
|
||||||
|
-DCMAKE_C_FLAGS="-fpic -O3 -g -DSQUISH_USE_SSE=2 -msse2" \
|
||||||
|
-DCMAKE_CXX_FLAGS="-fpic -O3 -g -DSQUISH_USE_SSE=2 -msse2"
|
||||||
|
else
|
||||||
|
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \
|
||||||
|
-DHOST=$HOST -DARCH=$ARCH -DCMAKE_C_FLAGS="-fpic -O3 -g" \
|
||||||
|
-DCMAKE_CXX_FLAGS="-fpic -O3 -g"
|
||||||
|
fi
|
||||||
|
make -j $(($(nproc) + 1)) VERBOSE=1
|
||||||
|
check_error
|
||||||
|
touch "$DIRNAME/deps-$ARCH_OPTION/libsquish.stamp"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ASTC-encoder
|
||||||
|
if [ ! -f "$DIRNAME/deps-$ARCH_OPTION/astc-encoder.stamp" ]; then
|
||||||
|
echo "Compiling $ARCH_OPTION astc-encoder"
|
||||||
|
mkdir -p "$DIRNAME/deps-$ARCH_OPTION/astc-encoder"
|
||||||
|
cp -a -f "$DIRNAME/../lib/astc-encoder/"* "$DIRNAME/deps-$ARCH_OPTION/astc-encoder"
|
||||||
|
|
||||||
|
cd "$DIRNAME/deps-$ARCH_OPTION/astc-encoder"
|
||||||
|
sed -i '/-Werror/d' Source/cmake_core.cmake
|
||||||
|
sed -i 's|${ASTC_TARGET}-static|astcenc|g' Source/cmake_core.cmake
|
||||||
|
if [ "$ARCH_OPTION" = "armeabi-v7a" ]; then
|
||||||
|
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \
|
||||||
|
-DHOST=$HOST -DARCH=$ARCH -DSTK_ARM_NEON=ON \
|
||||||
|
-DCMAKE_C_FLAGS="-fpic -O3 -g -mfpu=neon" \
|
||||||
|
-DCMAKE_CXX_FLAGS="-fpic -O3 -g -mfpu=neon" \
|
||||||
|
-DNO_INVARIANCE=ON -DCLI=OFF
|
||||||
|
elif [ "$ARCH_OPTION" = "arm64-v8a" ]; then
|
||||||
|
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \
|
||||||
|
-DHOST=$HOST -DARCH=$ARCH -DCMAKE_C_FLAGS="-fpic -O3 -g" \
|
||||||
|
-DCMAKE_CXX_FLAGS="-fpic -O3 -g" \
|
||||||
|
-DISA_NEON=ON -DNO_INVARIANCE=ON -DCLI=OFF
|
||||||
|
elif [ "$ARCH_OPTION" = "x86" ]; then
|
||||||
|
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \
|
||||||
|
-DHOST=$HOST -DARCH=$ARCH -DCMAKE_C_FLAGS="-fpic -O3 -g" \
|
||||||
|
-DCMAKE_CXX_FLAGS="-fpic -O3 -g" \
|
||||||
|
-DISA_SSE2=ON -DNO_INVARIANCE=ON -DCLI=OFF
|
||||||
|
else
|
||||||
|
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \
|
||||||
|
-DHOST=$HOST -DARCH=$ARCH -DCMAKE_C_FLAGS="-fpic -O3 -g" \
|
||||||
|
-DCMAKE_CXX_FLAGS="-fpic -O3 -g" \
|
||||||
|
-DISA_SSE41=ON -DNO_INVARIANCE=ON -DCLI=OFF
|
||||||
|
fi
|
||||||
|
make -j $(($(nproc) + 1))
|
||||||
|
check_error
|
||||||
|
touch "$DIRNAME/deps-$ARCH_OPTION/astc-encoder.stamp"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$COMPILE_ARCH" ] || [ "$COMPILE_ARCH" = "all" ]; then
|
if [ -z "$COMPILE_ARCH" ] || [ "$COMPILE_ARCH" = "all" ]; then
|
||||||
|
@ -16,7 +16,7 @@ set(CMAKE_SYSTEM_PROCESSOR ${ARCH})
|
|||||||
|
|
||||||
# Starting NDK21 it enables NEON by default on 32-bit ARM target
|
# Starting NDK21 it enables NEON by default on 32-bit ARM target
|
||||||
# Disable it to support more devices
|
# Disable it to support more devices
|
||||||
if("${ARCH}" STREQUAL "arm")
|
if("${ARCH}" STREQUAL "arm" AND NOT STK_ARM_NEON)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=vfpv3-d16")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=vfpv3-d16")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=vfpv3-d16")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=vfpv3-d16")
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user