From 6fcfa581a64c9874160685fc0488514b5c0e9a77 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Fri, 28 Apr 2017 17:18:40 -0400 Subject: [PATCH] Added the Android native library --- cake/BuildExternals.cake | 18 +++++ .../libHarfBuzzSharp_android/.gitignore | 1 + .../libHarfBuzzSharp_android/jni/Android.mk | 3 + .../jni/Application.mk | 5 ++ .../jni/HarfBuzzSharp.mk | 69 +++++++++++++++++++ 5 files changed, 96 insertions(+) create mode 100644 native-builds/libHarfBuzzSharp_android/.gitignore create mode 100644 native-builds/libHarfBuzzSharp_android/jni/Android.mk create mode 100644 native-builds/libHarfBuzzSharp_android/jni/Application.mk create mode 100644 native-builds/libHarfBuzzSharp_android/jni/HarfBuzzSharp.mk diff --git a/cake/BuildExternals.cake b/cake/BuildExternals.cake index e5dea05e..fda75be9 100644 --- a/cake/BuildExternals.cake +++ b/cake/BuildExternals.cake @@ -658,6 +658,8 @@ Task ("externals-android") .WithCriteria (IsRunningOnMac ()) .Does (() => { + // SkiaSharp + var buildArch = new Action ((arch, skiaArch) => { // generate native skia build files RunProcess (SKIA_PATH.CombineWithFilePath("bin/gn"), new ProcessSettings { @@ -700,6 +702,22 @@ Task ("externals-android") } CopyFileToDirectory ("native-builds/libSkiaSharp_android/libs/" + folder + "/libSkiaSharp.so", "native-builds/lib/android/" + folder); } + + // HarfBuzzSharp + + // build libHarfBuzzSharp + RunProcess (ndkbuild, new ProcessSettings { + Arguments = "", + WorkingDirectory = ROOT_PATH.Combine ("native-builds/libHarfBuzzSharp_android").FullPath, + }); + + // copy libSkiaSharp to output + foreach (var folder in new [] { "x86", "x86_64", "armeabi-v7a", "arm64-v8a" }) { + if (!DirectoryExists ("native-builds/lib/android/" + folder)) { + CreateDirectory ("native-builds/lib/android/" + folder); + } + CopyFileToDirectory ("native-builds/libHarfBuzzSharp_android/libs/" + folder + "/libHarfBuzzSharp.so", "native-builds/lib/android/" + folder); + } }); // this builds the native C and C++ externals for Linux diff --git a/native-builds/libHarfBuzzSharp_android/.gitignore b/native-builds/libHarfBuzzSharp_android/.gitignore new file mode 100644 index 00000000..a93e887b --- /dev/null +++ b/native-builds/libHarfBuzzSharp_android/.gitignore @@ -0,0 +1 @@ +libs diff --git a/native-builds/libHarfBuzzSharp_android/jni/Android.mk b/native-builds/libHarfBuzzSharp_android/jni/Android.mk new file mode 100644 index 00000000..31f85917 --- /dev/null +++ b/native-builds/libHarfBuzzSharp_android/jni/Android.mk @@ -0,0 +1,3 @@ +LOCAL_PATH:= $(call my-dir) + +include jni/HarfBuzzSharp.mk diff --git a/native-builds/libHarfBuzzSharp_android/jni/Application.mk b/native-builds/libHarfBuzzSharp_android/jni/Application.mk new file mode 100644 index 00000000..e292d12f --- /dev/null +++ b/native-builds/libHarfBuzzSharp_android/jni/Application.mk @@ -0,0 +1,5 @@ +APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 +APP_PLATFORM := android-9 +NDK_TOOLCHAIN_VERSION := 4.9 +APP_STL := gnustl_static +APP_OPTIM := release diff --git a/native-builds/libHarfBuzzSharp_android/jni/HarfBuzzSharp.mk b/native-builds/libHarfBuzzSharp_android/jni/HarfBuzzSharp.mk new file mode 100644 index 00000000..1cd48fca --- /dev/null +++ b/native-builds/libHarfBuzzSharp_android/jni/HarfBuzzSharp.mk @@ -0,0 +1,69 @@ + +include $(CLEAR_VARS) + +cmd-strip = $(PRIVATE_STRIP) --strip-all $(call host-path,$1) + +# LOCAL_LDLIBS := -llog -lEGL -lGLESv2 + +# LOCAL_LDFLAGS := -s -Wl,--gc-sections + +LOCAL_MODULE := HarfBuzzSharp + +LOCAL_C_INCLUDES := ../../externals/harfbuzz/harfbuzz/src/hb-ucdn \ + ../../externals/harfbuzz/harfbuzz/src \ + ../../externals/harfbuzz/harfbuzz + +# LOCAL_CFLAGS := -DSK_INTERNAL -DSK_GAMMA_APPLY_TO_A8 \ +# -DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0 -DSK_SUPPORT_GPU=1 \ +# -DSK_SUPPORT_OPENCL=0 -DSK_FORCE_DISTANCE_FIELD_TEXT=0 \ +# -DSK_BUILD_FOR_ANDROID -DSK_GAMMA_EXPONENT=1.4 -DSK_GAMMA_CONTRAST=0.0 \ +# -DSKIA_C_DLL -DSKIA_IMPLEMENTATION=1 \ +# -DSK_SUPPORT_LEGACY_CLIPTOLAYERFLAG -DNDEBUG + +# LOCAL_CFLAGS += -fPIC -g -fno-exceptions -fstrict-aliasing -Wall -Wextra \ +# -Winit-self -Wpointer-arith -Wsign-compare -Wno-unused-parameter \ +# -Werror -fuse-ld=gold \ +# -Os -ffunction-sections -fdata-sections -fno-rtti + +# LOCAL_CPPFLAGS := -std=c++11 -fno-rtti -fno-threadsafe-statics -Wnon-virtual-dtor \ +# -Os -ffunction-sections -fdata-sections + +LOCAL_CFLAGS := -DHAVE_CONFIG_H + +LOCAL_SRC_FILES := ../../../externals/harfbuzz/harfbuzz/src/hb-ucdn/ucdn.c \ + ../../../externals/harfbuzz/harfbuzz/src/hb-blob.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-buffer-serialize.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-buffer.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-common.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-face.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-fallback-shape.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-font.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ot-font.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ot-layout.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ot-map.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ot-math.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ot-shape-complex-arabic.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ot-shape-complex-default.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ot-shape-complex-hangul.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ot-shape-complex-hebrew.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ot-shape-complex-indic-table.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ot-shape-complex-indic.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ot-shape-complex-myanmar.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ot-shape-complex-thai.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ot-shape-complex-tibetan.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ot-shape-complex-use-table.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ot-shape-complex-use.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ot-shape-fallback.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ot-shape-normalize.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ot-shape.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ot-tag.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ot-var.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-set.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-shape-plan.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-shape.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-shaper.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-ucdn.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-unicode.cc \ + ../../../externals/harfbuzz/harfbuzz/src/hb-warning.cc + +include $(BUILD_SHARED_LIBRARY)