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
diff --git a/BUILD.gn b/BUILD.gn
index c94f3cf..3c6ac0f 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -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 @@
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 @@
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("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 @@
":fontmgr_fontconfig",
":fontmgr_fuchsia",
":gif",
+ ":gpu",
":jpeg",
":none",
":pdf",
@@ -417,7 +445,6 @@
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 @@
"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 @@
"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 @@
"//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 @@
"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 @@
}
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 @@
]
}
-if (target_cpu == "x64") {
+if (skia_enable_gpu && target_cpu == "x64") {
# Our bots only have 64-bit libOSMesa installed.
# TODO: worth fixing?
executable("fiddle") {