GN: nanobench

Add nanobench, and while we're at it monobench to show off how cool
source_sets are... the bench files are only built once then linked
into both binaries.  With GYP we build them twice. :/  Same deal
for GMs between nanobench and DM... build once, link twice.

nanobench uses SkImageEncoder to encode its .pngs, which requires
we link in the image encoders, which requires we get them all in.
That's the bulk of this.

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

Review-Url: https://codereview.chromium.org/2193513002
This commit is contained in:
mtklein 2016-07-28 14:17:33 -07:00 committed by Commit bot
parent 2f428966c6
commit 2b6870ccb2
2 changed files with 111 additions and 24 deletions

105
BUILD.gn
View File

@ -49,6 +49,7 @@ config("skia_private") {
"src/lazy",
"src/opts",
"src/pathops",
"src/pdf",
"src/ports",
"src/sfnt",
"src/utils",
@ -202,6 +203,11 @@ component("skia") {
"src/codec/SkWebpCodec.cpp",
"src/images/SkImageEncoder.cpp",
"src/images/SkImageEncoder_Factory.cpp",
"src/images/SkJPEGImageEncoder.cpp",
"src/images/SkJPEGWriteUtility.cpp",
"src/images/SkKTXImageEncoder.cpp",
"src/images/SkPNGImageEncoder.cpp",
"src/images/SkWEBPImageEncoder.cpp",
"src/ports/SkDiscardableMemory_none.cpp",
"src/ports/SkGlobalInitialization_default.cpp",
"src/ports/SkImageGenerator_skia.cpp",
@ -249,9 +255,6 @@ component("skia") {
]
sources += [
"src/fonts/SkFontMgr_fontconfig.cpp",
"src/images/SkJPEGImageEncoder.cpp",
"src/images/SkJPEGWriteUtility.cpp",
"src/images/SkPNGImageEncoder.cpp",
"src/ports/SkFontConfigInterface_direct.cpp",
"src/ports/SkFontConfigInterface_direct_factory.cpp",
"src/ports/SkFontHost_FreeType.cpp",
@ -368,9 +371,12 @@ test_lib("tool_utils") {
"tools/timer",
]
sources = [
"src/images/SkForceLinking.cpp",
"src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
"tools/CrashHandler.cpp",
"tools/ProcStats.cpp",
"tools/Resources.cpp",
"tools/ThermalManager.cpp",
"tools/picture_utils.cpp",
"tools/random_parse_path.cpp",
"tools/sk_tool_utils.cpp",
@ -399,26 +405,77 @@ test_lib("gm") {
]
}
if (!is_component_build) { # DM uses many non-SK_API APIs...
executable("dm") {
sources = [
"dm/DM.cpp",
"dm/DMJsonWriter.cpp",
"dm/DMSrcSink.cpp",
bench_sources = exec_script("gyp/find.py",
[
rebase_path("bench"),
"*.c*",
],
"list lines",
[])
# TODO: tests for real
"tests/Test.cpp",
]
include_dirs = [ "tests" ]
deps = [
":flags",
":gm",
":gpu_tool_utils",
":skia",
":tool_utils",
"//third_party/jsoncpp",
"//third_party/libpng",
]
testonly = true
}
test_lib("bench") {
public_include_dirs = [ "bench" ]
sources = bench_sources
sources -= [
rebase_path("bench/nanobench.cpp"),
rebase_path("bench/nanobenchAndroid.cpp"),
]
deps = [
":flags",
":gm",
":gpu_tool_utils",
":skia",
":tool_utils",
]
}
if (!is_component_build) { # Our test tools use many non-SK_API APIs...
executable("dm") {
sources = [
"dm/DM.cpp",
"dm/DMJsonWriter.cpp",
"dm/DMSrcSink.cpp",
# TODO: tests for real
"tests/Test.cpp",
]
include_dirs = [ "tests" ]
deps = [
":flags",
":gm",
":gpu_tool_utils",
":skia",
":tool_utils",
"//third_party/jsoncpp",
"//third_party/libpng",
]
testonly = true
}
executable("monobench") {
sources = [
"tools/monobench.cpp",
]
deps = [
":bench",
":skia",
]
testonly = true
}
executable("nanobench") {
sources = [
"bench/nanobench.cpp",
]
deps = [
":bench",
":flags",
":gm",
":gpu_tool_utils",
":skia",
":tool_utils",
"//third_party/jsoncpp",
]
testonly = true
}
}

View File

@ -26,16 +26,25 @@ third_party("libwebp") {
"../externals/libwebp/src/dsp/alpha_processing.c",
"../externals/libwebp/src/dsp/alpha_processing_sse2.c",
"../externals/libwebp/src/dsp/alpha_processing_sse41.c",
"../externals/libwebp/src/dsp/argb.c",
"../externals/libwebp/src/dsp/argb_sse2.c",
"../externals/libwebp/src/dsp/cost.c",
"../externals/libwebp/src/dsp/cost_sse2.c",
"../externals/libwebp/src/dsp/cpu.c",
"../externals/libwebp/src/dsp/dec.c",
"../externals/libwebp/src/dsp/dec_clip_tables.c",
"../externals/libwebp/src/dsp/dec_sse2.c",
"../externals/libwebp/src/dsp/dec_sse41.c",
"../externals/libwebp/src/dsp/enc.c",
"../externals/libwebp/src/dsp/enc_avx2.c",
"../externals/libwebp/src/dsp/enc_sse2.c",
"../externals/libwebp/src/dsp/enc_sse41.c",
"../externals/libwebp/src/dsp/filters.c",
"../externals/libwebp/src/dsp/filters_sse2.c",
"../externals/libwebp/src/dsp/lossless.c",
"../externals/libwebp/src/dsp/lossless_enc.c",
"../externals/libwebp/src/dsp/lossless_enc_sse2.c",
"../externals/libwebp/src/dsp/lossless_enc_sse41.c",
"../externals/libwebp/src/dsp/lossless_sse2.c",
"../externals/libwebp/src/dsp/rescaler.c",
"../externals/libwebp/src/dsp/rescaler_sse2.c",
@ -43,6 +52,27 @@ third_party("libwebp") {
"../externals/libwebp/src/dsp/upsampling_sse2.c",
"../externals/libwebp/src/dsp/yuv.c",
"../externals/libwebp/src/dsp/yuv_sse2.c",
"../externals/libwebp/src/enc/alpha.c",
"../externals/libwebp/src/enc/analysis.c",
"../externals/libwebp/src/enc/backward_references.c",
"../externals/libwebp/src/enc/config.c",
"../externals/libwebp/src/enc/cost.c",
"../externals/libwebp/src/enc/filter.c",
"../externals/libwebp/src/enc/frame.c",
"../externals/libwebp/src/enc/histogram.c",
"../externals/libwebp/src/enc/iterator.c",
"../externals/libwebp/src/enc/near_lossless.c",
"../externals/libwebp/src/enc/picture.c",
"../externals/libwebp/src/enc/picture_csp.c",
"../externals/libwebp/src/enc/picture_psnr.c",
"../externals/libwebp/src/enc/picture_rescale.c",
"../externals/libwebp/src/enc/picture_tools.c",
"../externals/libwebp/src/enc/quant.c",
"../externals/libwebp/src/enc/syntax.c",
"../externals/libwebp/src/enc/token.c",
"../externals/libwebp/src/enc/tree.c",
"../externals/libwebp/src/enc/vp8l.c",
"../externals/libwebp/src/enc/webpenc.c",
"../externals/libwebp/src/utils/bit_reader.c",
"../externals/libwebp/src/utils/bit_writer.c",
"../externals/libwebp/src/utils/color_cache.c",