GN: add skia_enable_gpu (default true)

This lets us replace the NoGPU bot.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2356853002

NOTREECHECKS=true

Review-Url: https://codereview.chromium.org/2356853002
This commit is contained in:
mtklein 2016-09-20 12:28:12 -07:00 committed by Commit bot
parent 60b7ab7a8e
commit 06c35c0953
3 changed files with 65 additions and 36 deletions

View File

@ -6,8 +6,6 @@
import("gn/shared_sources.gni")
declare_args() {
skia_enable_tools = !is_fuchsia && !is_component_build
skia_use_expat = true
skia_use_fontconfig = is_linux
skia_use_freetype = is_android || is_fuchsia || is_linux
@ -20,8 +18,13 @@ declare_args() {
skia_use_zlib = true
skia_enable_android_framework_defines = false
skia_enable_gpu = true
skia_enable_tools = !is_fuchsia
}
# Our tools require static linking (they use non-exported symbols) and GPU support (just lazy).
skia_enable_tools = skia_enable_tools && skia_enable_gpu && !is_component_build
fontmgr_android_enabled = skia_use_expat && skia_use_freetype
skia_public_includes = [
@ -52,6 +55,9 @@ config("skia_public") {
if (skia_enable_android_framework_defines) {
defines += skia_android_framework_defines
}
if (!skia_enable_gpu) {
defines += [ "SK_SUPPORT_GPU=0" ]
}
}
# Skia internal APIs, used by Skia itself and a few test tools.
@ -294,6 +300,27 @@ optional("gif") {
]
}
optional("gpu") {
enabled = skia_enable_gpu
sources = skia_gpu_sources + [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
# These paths need to be absolute to match the ones produced by shared_sources.gni.
sources -= get_path_info([
"src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
"src/gpu/gl/GrGLDefaultInterface_none.cpp",
],
"abspath")
if (is_android) {
sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
} else if (is_linux) {
sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
} else if (is_mac) {
sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
} else {
sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
}
}
optional("jpeg") {
enabled = skia_use_libjpeg_turbo
public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
@ -400,6 +427,7 @@ component("skia") {
":fontmgr_fontconfig",
":fontmgr_fuchsia",
":gif",
":gpu",
":jpeg",
":none",
":pdf",
@ -417,7 +445,6 @@ component("skia") {
sources = []
sources += skia_core_sources
sources += skia_effects_sources
sources += skia_gpu_sources
sources += skia_sksl_sources
sources += skia_utils_sources
sources += [
@ -436,7 +463,6 @@ component("skia") {
"src/codec/SkSampler.cpp",
"src/codec/SkSwizzler.cpp",
"src/codec/SkWbmpCodec.cpp",
"src/gpu/gl/GrGLDefaultInterface_native.cpp",
"src/images/SkImageEncoder.cpp",
"src/images/SkImageEncoder_Factory.cpp",
"src/images/SkKTXImageEncoder.cpp",
@ -454,15 +480,6 @@ component("skia") {
"third_party/ktx/ktx.cpp",
]
# These paths need to be absolute to match the ones produced by
# shared_sources.gni, but this file may be used from different directory
# locations.
sources -= get_path_info([
"src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
"src/gpu/gl/GrGLDefaultInterface_none.cpp",
],
"abspath")
libs = []
if (is_win) {
@ -494,10 +511,7 @@ component("skia") {
"//third_party/cpu-features",
"//third_party/expat",
]
sources += [
"src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp",
"src/ports/SkDebug_android.cpp",
]
sources += [ "src/ports/SkDebug_android.cpp" ]
libs += [
"EGL",
"GLESv2",
@ -511,15 +525,11 @@ component("skia") {
"GLU",
"X11",
]
sources += [
"src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp",
"src/ports/SkDebug_stdio.cpp",
]
sources += [ "src/ports/SkDebug_stdio.cpp" ]
}
if (is_mac) {
sources += [
"src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp",
"src/ports/SkDebug_stdio.cpp",
"src/ports/SkFontHost_mac.cpp",
"src/ports/SkImageEncoder_CG.cpp",
@ -532,10 +542,7 @@ component("skia") {
}
if (is_fuchsia) {
sources += [
"src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
"src/ports/SkDebug_stdio.cpp",
]
sources += [ "src/ports/SkDebug_stdio.cpp" ]
}
}
@ -561,7 +568,7 @@ action("skia.h") {
]
}
if (target_cpu == "x64") {
if (skia_enable_gpu && target_cpu == "x64") {
# Our bots only have 64-bit libOSMesa installed.
# TODO: worth fixing?
executable("fiddle") {

View File

@ -16,6 +16,7 @@ class GNFlavorUtils(default_flavor.DefaultFlavorUtils):
'SAN' in extra_config,
extra_config == 'Fast',
extra_config == 'GN',
extra_config == 'NoGPU',
extra_config.startswith('SK'),
os == 'Ubuntu' and target_arch == 'x86',
])
@ -63,6 +64,8 @@ class GNFlavorUtils(default_flavor.DefaultFlavorUtils):
args['is_debug'] = 'false'
if extra_config == 'MSAN':
args['skia_use_fontconfig'] = 'false'
if extra_config == 'NoGPU':
args['skia_enable_gpu'] = 'false'
for (k,v) in {
'cc': cc,

View File

@ -121,19 +121,38 @@
},
{
"cmd": [
"make",
"most"
"[CUSTOM_/_B_WORK]/skia/bin/fetch-gn"
],
"cwd": "[CUSTOM_/_B_WORK]/skia",
"env": {
"BUILDTYPE": "Debug",
"CHROME_HEADLESS": "1",
"CHROME_PATH": "[SLAVE_BUILD]/src",
"GYP_DEFINES": "skia_arch_type=x86_64 skia_gpu=0 skia_warnings_as_errors=1",
"PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]",
"SKIA_OUT": "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Debug-NoGPU"
"PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]"
},
"name": "build most"
"name": "fetch-gn"
},
{
"cmd": [
"gn",
"gen",
"[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Debug-NoGPU/Debug",
"--args=cc=\"gcc\" cxx=\"g++\" skia_enable_gpu=false"
],
"cwd": "[CUSTOM_/_B_WORK]/skia",
"env": {
"PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]"
},
"name": "gn gen"
},
{
"cmd": [
"ninja",
"-C",
"[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Debug-NoGPU/Debug"
],
"cwd": "[CUSTOM_/_B_WORK]/skia",
"env": {
"PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]"
},
"name": "ninja"
},
{
"cmd": [