GN: add a helper script for running Android builds
Think of this as the spiritual equivalent of platform_tools/android/bin/android_run_skia, but for GN and easier to type. Cutting down the debug symbols makes Android builds about 1/4 the size. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2323833002 DOCS_PREVIEW= https://skia.org/user/quick/gn?cl=2323833002 Review-Url: https://codereview.chromium.org/2323833002
This commit is contained in:
parent
4cea3b9e9d
commit
f3155ad97c
20
bin/droid
Executable file
20
bin/droid
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Run a GN-built Android binary on the connected device.
|
||||
#
|
||||
# Example usage:
|
||||
# $ ninja -C out dm
|
||||
# $ droid out/dm --src gm --config gpu
|
||||
#
|
||||
# See https://skia.org/user/quick/gn for build instructions.
|
||||
|
||||
path=$1
|
||||
name=$(basename $1)
|
||||
shift
|
||||
args=$@
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
adb push $path resources /data/local/tmp/
|
||||
adb shell "cd /data/local/tmp; ./$name $args"
|
@ -31,7 +31,6 @@ config("no_rtti") {
|
||||
config("default") {
|
||||
cflags = [
|
||||
"-O1",
|
||||
"-g",
|
||||
"-fstrict-aliasing",
|
||||
"-fPIC",
|
||||
"-fvisibility=hidden",
|
||||
@ -57,6 +56,14 @@ config("default") {
|
||||
]
|
||||
ldflags = []
|
||||
|
||||
# It's annoying to wait for full debug symbols to push over
|
||||
# to Android devices. -gline-tables-only is a lot slimmer.
|
||||
if (is_android) {
|
||||
cflags += [ "-gline-tables-only" ]
|
||||
} else {
|
||||
cflags += [ "-g" ]
|
||||
}
|
||||
|
||||
if (current_cpu == "arm") {
|
||||
cflags += [
|
||||
"-march=armv7-a",
|
||||
|
@ -74,3 +74,10 @@ desired `target_cpu`:
|
||||
gn gen out/x86 --args='ndk="/tmp/ndk" target_cpu="x86"'
|
||||
|
||||
Other arguments like `is_debug` and `is_component_build` continue to work.
|
||||
|
||||
To test on a locally connected Android device, you can use our `droid` convenience script:
|
||||
|
||||
<!--?prettify lang=sh?-->
|
||||
|
||||
ninja -C out/arm64
|
||||
bin/droid out/arm64/dm --src gm --config gpu
|
||||
|
Loading…
Reference in New Issue
Block a user