Build shaderc in android without debug symbols

This commit is contained in:
Benau 2022-08-09 09:26:05 +08:00
parent c6dafd4b80
commit bed0acda7a
2 changed files with 37 additions and 8 deletions

View File

@ -93,6 +93,13 @@ include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
# shaderc
LOCAL_MODULE := shaderc
LOCAL_SRC_FILES := deps-$(TARGET_ARCH_ABI)/shaderc/libshaderc/libshaderc_combined.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
# libsquish
LOCAL_MODULE := libsquish
LOCAL_SRC_FILES := deps-$(TARGET_ARCH_ABI)/libsquish/libsquish.a
@ -182,20 +189,20 @@ LOCAL_PATH := .
LOCAL_CPP_FEATURES += rtti exceptions
LOCAL_SRC_FILES := $(wildcard ../lib/graphics_engine/src/*.c) \
$(wildcard ../lib/graphics_engine/src/*.cpp)
LOCAL_CFLAGS := -DENABLE_LIBASTCENC \
-I../lib/graphics_engine/include \
-I../lib/graphics_utils \
-I../lib/sdl2/include/ \
-I../lib/bullet/src/ \
-I../lib/irrlicht/include/ \
-I../lib/libsquish \
LOCAL_CFLAGS := -DENABLE_LIBASTCENC \
-I../lib/graphics_engine/include \
-I../lib/graphics_utils \
-I../lib/sdl2/include/ \
-I../lib/bullet/src/ \
-I../lib/irrlicht/include/ \
-I../lib/shaderc/libshaderc/include \
-I../lib/libsquish \
-Ideps-$(TARGET_ARCH_ABI)/astc-encoder/Source
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
LOCAL_ARM_NEON := false
endif
LOCAL_STATIC_LIBRARIES := shaderc libsquish libastcenc
include $(BUILD_STATIC_LIBRARY)
$(call import-module, third_party/shaderc)
include $(CLEAR_VARS)

View File

@ -284,6 +284,28 @@ build_deps()
touch "$DIRNAME/deps-$ARCH_OPTION/libvorbis.stamp"
fi
# Shaderc
if [ ! -f "$DIRNAME/deps-$ARCH_OPTION/shaderc.stamp" ]; then
echo "Compiling $ARCH_OPTION shaderc"
mkdir -p "$DIRNAME/deps-$ARCH_OPTION/shaderc"
cp -a -f "$DIRNAME/../lib/shaderc/"* "$DIRNAME/deps-$ARCH_OPTION/shaderc"
cd "$DIRNAME/deps-$ARCH_OPTION/shaderc"
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \
-DHOST=$HOST -DARCH=$ARCH -DCMAKE_C_FLAGS="-fpic -O3" \
-DCMAKE_CXX_FLAGS="-fpic -O3" -DSHADERC_SKIP_INSTALL=1 \
-DSHADERC_SKIP_TESTS=1 -DSHADERC_SKIP_EXAMPLES=1 \
-DSPIRV_HEADERS_SKIP_INSTALL=1 -DSPIRV_HEADERS_SKIP_EXAMPLES=1 \
-DSKIP_SPIRV_TOOLS_INSTALL=1 -DSPIRV_SKIP_TESTS=1 \
-DSPIRV_SKIP_EXECUTABLES=1 -DENABLE_GLSLANG_BINARIES=0 \
-DENABLE_CTEST=0 &&
make -j $(($(nproc) + 1))
# Strip debug symbol to make app bundle smaller
llvm-strip --strip-debug "$DIRNAME/deps-$ARCH_OPTION/shaderc/libshaderc/libshaderc_combined.a"
check_error
touch "$DIRNAME/deps-$ARCH_OPTION/shaderc.stamp"
fi
# Libsquish
if [ ! -f "$DIRNAME/deps-$ARCH_OPTION/libsquish.stamp" ]; then
echo "Compiling $ARCH_OPTION libsquish"