зеркало из https://github.com/mozilla/moz-skia.git
Support linking skia statically on Android
Support linking skia statically on Android. Skia symbols should be exported by the app library, to the extent that skia_launcher needs them. Syncs libskia_android.so to the device only if it exists. R=djsollen@google.com Author: kkinnunen@nvidia.com Review URL: https://codereview.chromium.org/61893008 git-svn-id: http://skia.googlecode.com/svn/trunk@12399 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
ee21a3e395
Коммит
3daa1aed7a
|
@ -43,6 +43,11 @@ public class SkiaSampleActivity extends Activity
|
|||
|
||||
try {
|
||||
System.loadLibrary("skia_android");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
// This might be because skia was linked to SampleApp statically.
|
||||
}
|
||||
|
||||
try {
|
||||
System.loadLibrary("SampleApp");
|
||||
|
||||
LinearLayout holder = (LinearLayout) findViewById(R.id.holder);
|
||||
|
|
|
@ -28,7 +28,10 @@ then
|
|||
fi
|
||||
|
||||
adb_push_if_needed "${SKIA_OUT}/${configuration}/skia_launcher" /data/local/tmp
|
||||
adb_push_if_needed "${SKIA_OUT}/${configuration}/lib.target/libskia_android.so" /data/local/tmp
|
||||
if [ -f "${SKIA_OUT}/${configuration}/lib.target/libskia_android.so" ]; then
|
||||
# Does not exist for builds with static skia.
|
||||
adb_push_if_needed "${SKIA_OUT}/${configuration}/lib.target/libskia_android.so" /data/local/tmp
|
||||
fi
|
||||
adb_push_if_needed "${SKIA_OUT}/${configuration}/lib.target/lib${runVars[0]}.so" /data/local/tmp
|
||||
|
||||
STATUS_FILENAME="/data/local/tmp/.skia_tmp_$(date +%s%N)"
|
||||
|
|
|
@ -161,7 +161,9 @@ setup_device() {
|
|||
DEFINES="${DEFINES} host_os=$(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')"
|
||||
DEFINES="${DEFINES} skia_os=android"
|
||||
DEFINES="${DEFINES} android_base=${SCRIPT_DIR}/.."
|
||||
DEFINES="${DEFINES} skia_shared_lib=1"
|
||||
if [[ "$GYP_DEFINES" != *skia_shared_lib=* ]]; then
|
||||
DEFINES="${DEFINES} skia_shared_lib=1"
|
||||
fi
|
||||
|
||||
# Setup the build variation depending on the target device
|
||||
TARGET_DEVICE="$1"
|
||||
|
|
|
@ -30,9 +30,16 @@
|
|||
# still build.
|
||||
{
|
||||
'destination': '<(PRODUCT_DIR)/android/libs/<(android_arch)',
|
||||
'files': [
|
||||
'<(SHARED_LIB_DIR)/libSampleApp.so',
|
||||
'<(SHARED_LIB_DIR)/libskia_android.so',
|
||||
'conditions': [
|
||||
[ 'skia_shared_lib', {
|
||||
'files': [
|
||||
'<(SHARED_LIB_DIR)/libSampleApp.so',
|
||||
'<(SHARED_LIB_DIR)/libskia_android.so',
|
||||
]}, {
|
||||
'files': [
|
||||
'<(SHARED_LIB_DIR)/libSampleApp.so',
|
||||
]}
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
@ -67,12 +67,16 @@ int main(int argc, const char** argv) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
void* skiaLibrary;
|
||||
|
||||
#if defined(SKIA_DLL)
|
||||
// load the local skia shared library
|
||||
void* skiaLibrary = load_library(appLocation, "skia_android");
|
||||
skiaLibrary = load_library(appLocation, "skia_android");
|
||||
if (NULL == skiaLibrary)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
// load the appropriate library
|
||||
void* appLibrary = load_library(appLocation, argv[1]);
|
||||
|
@ -80,6 +84,10 @@ int main(int argc, const char** argv) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
#if !defined(SKIA_DLL)
|
||||
skiaLibrary = appLibrary;
|
||||
#endif
|
||||
|
||||
// find the address of the main function
|
||||
int (*app_main)(int, const char**);
|
||||
*(void **) (&app_main) = dlsym(appLibrary, "main");
|
||||
|
|
Загрузка…
Ссылка в новой задаче