@@ -55,51 +55,76 @@ fixtures_location("display_list_benchmarks_fixtures") {
5555 assets_dir = " $target_gen_dir /"
5656}
5757
58- if (enable_unittests ) {
59- executable (" display_list_benchmarks" ) {
60- testonly = true
58+ source_set (" display_list_benchmarks_source" ) {
59+ testonly = true
60+
61+ sources = [
62+ " display_list_benchmarks.cc" ,
63+ " display_list_benchmarks.h" ,
64+ ]
65+
66+ deps = [
67+ " :display_list" ,
68+ " :display_list_benchmarks_fixtures" ,
69+ " //flutter/benchmarking" ,
70+ " //flutter/common/graphics" ,
71+ " //flutter/fml" ,
72+ " //flutter/testing:skia" ,
73+ " //flutter/testing:testing_lib" ,
74+ " //third_party/dart/runtime:libdart_jit" , # for tracing
75+ " //third_party/skia" ,
76+ ]
77+
78+ defines = []
6179
62- sources = [
63- " display_list_benchmarks.cc" ,
64- " display_list_benchmarks.h" ,
80+ if (is_android ) {
81+ libs = [
82+ " android" ,
83+ " EGL" ,
84+ " GLESv2" ,
85+ ]
86+ }
87+
88+ # We only do software benchmarks on non-mobile platforms
89+ if (! is_android && ! is_ios ) {
90+ sources += [
6591 " display_list_benchmarks_software.cc" ,
6692 " display_list_benchmarks_software.h" ,
6793 ]
94+ defines += [ " ENABLE_SOFTWARE_BENCHMARKS" ]
95+ }
96+
97+ # iOS and Fuchsia don't support OpenGL
98+ if (! is_fuchsia && ! is_ios ) {
99+ defines += [ " ENABLE_OPENGL_BENCHMARKS" ]
100+ sources += [
101+ " display_list_benchmarks_gl.cc" ,
102+ " display_list_benchmarks_gl.h" ,
103+ ]
104+ deps += [ " //flutter/testing:opengl" ]
105+ }
68106
69- deps = [
70- " :display_list" ,
71- " :display_list_benchmarks_fixtures" ,
72- " //flutter/benchmarking" ,
73- " //flutter/common/graphics" ,
74- " //flutter/fml" ,
75- " //flutter/testing:skia" ,
76- " //flutter/testing:testing_lib" ,
77- " //third_party/dart/runtime:libdart_jit" , # for tracing
78- " //third_party/skia" ,
107+ if (is_mac || is_ios ) {
108+ defines += [ " ENABLE_METAL_BENCHMARKS" ]
109+ sources += [
110+ " display_list_benchmarks_metal.cc" ,
111+ " display_list_benchmarks_metal.h" ,
79112 ]
113+ deps += [ " //flutter/testing:metal" ]
114+ }
80115
81- defines = [ " ENABLE_SOFTWARE_BENCHMARKS" ]
82-
83- if (! is_fuchsia ) {
84- defines += [ " ENABLE_OPENGL_BENCHMARKS" ]
85- sources += [
86- " display_list_benchmarks_gl.cc" ,
87- " display_list_benchmarks_gl.h" ,
88- ]
89- deps += [ " //flutter/testing:opengl" ]
90- }
91-
92- if (is_mac ) {
93- defines += [ " ENABLE_METAL_BENCHMARKS" ]
94- sources += [
95- " display_list_benchmarks_metal.cc" ,
96- " display_list_benchmarks_metal.h" ,
97- ]
98- deps += [ " //flutter/testing:metal" ]
99- }
116+ # Don't snapshot test results on mobile platforms
117+ if (is_android || is_ios ) {
118+ defines += [ " BENCHMARKS_NO_SNAPSHOT" ]
100119 }
101120}
102121
122+ executable (" display_list_benchmarks" ) {
123+ testonly = true
124+
125+ deps = [ " :display_list_benchmarks_source" ]
126+ }
127+
103128if (is_ios ) {
104129 shared_library (" ios_display_list_benchmarks" ) {
105130 testonly = true
@@ -116,29 +141,9 @@ if (is_ios) {
116141 ]
117142 ldflags =
118143 [ " -Wl,-install_name,@rpath/libios_display_list_benchmarks.dylib" ]
119- defines = [
120- " BENCHMARKS_NO_SNAPSHOT" ,
121- " ENABLE_METAL_BENCHMARKS" ,
122- ]
123- sources = [
124- " display_list_benchmarks.cc" ,
125- " display_list_benchmarks.h" ,
126- " display_list_benchmarks_metal.cc" ,
127- " display_list_benchmarks_metal.h" ,
128- ]
129-
130144 deps = [
131- " :display_list" ,
132- " :display_list_benchmarks_fixtures" ,
145+ " :display_list_benchmarks_source" ,
133146 " //flutter/benchmarking:benchmarking_library" ,
134- " //flutter/common/graphics" ,
135- " //flutter/fml" ,
136- " //flutter/testing:metal" ,
137- " //flutter/testing:skia" ,
138- " //flutter/testing:testing_lib" ,
139- " //third_party/benchmark" ,
140- " //third_party/dart/runtime:libdart_jit" , # for tracing
141- " //third_party/skia" ,
142147 ]
143148 }
144149}
0 commit comments