|
5 | 5 | assert(is_fuchsia) |
6 | 6 |
|
7 | 7 | import("//build/fuchsia/sdk.gni") |
| 8 | +import("$flutter_root/shell/gpu/gpu.gni") |
| 9 | +import("$flutter_root/tools/fuchsia/package_dir.gni") |
8 | 10 |
|
9 | | -if (using_fuchsia_sdk) { |
10 | | - executable("flutter") { |
11 | | - output_name = "flutter_runner" |
| 11 | +shell_gpu_configuration("fuchsia_gpu_configuration") { |
| 12 | + enable_software = false |
| 13 | + enable_gl = false |
| 14 | + enable_vulkan = true |
| 15 | + enable_metal = false |
| 16 | +} |
| 17 | + |
| 18 | +# Builds a flutter_runner |
| 19 | +# |
| 20 | +# Parameters: |
| 21 | +# |
| 22 | +# output_name (required): |
| 23 | +# The name of the resulting binary. |
| 24 | +# |
| 25 | +# extra_deps (required): |
| 26 | +# Any additional dependencies. |
| 27 | +# extra_defines (optional): |
| 28 | +# Any additional preprocessor defines. |
| 29 | +template("flutter_runner") { |
| 30 | + assert(defined(invoker.output_name), "flutter_runner must define output_name") |
| 31 | + assert(defined(invoker.extra_deps), "flutter_runner must define extra_deps") |
| 32 | + |
| 33 | + invoker_output_name = invoker.output_name |
| 34 | + extra_deps = invoker.extra_deps |
| 35 | + |
| 36 | + extra_defines = [] |
| 37 | + if (defined(invoker.extra_defines)) { |
| 38 | + extra_defines += invoker.extra_defines |
| 39 | + } |
| 40 | + |
| 41 | + executable(target_name) { |
| 42 | + output_name = invoker_output_name |
| 43 | + |
| 44 | + defines = extra_defines |
| 45 | + |
| 46 | + libs = [] |
12 | 47 |
|
13 | 48 | sources = [ |
14 | 49 | "component.cc", |
@@ -57,35 +92,109 @@ if (using_fuchsia_sdk) { |
57 | 92 | ] |
58 | 93 |
|
59 | 94 | deps = [ |
60 | | - "$flutter_root/common", |
61 | | - "$flutter_root/flow", |
62 | | - "$flutter_root/fml", |
63 | | - "$flutter_root/lib/ui", |
64 | | - "$flutter_root/runtime", |
65 | | - "$flutter_root/runtime:libdart", |
66 | | - "$flutter_root/shell/common", |
67 | | - "$flutter_root/shell/platform/fuchsia/dart-pkg/fuchsia", |
68 | | - "$flutter_root/shell/platform/fuchsia/dart-pkg/zircon", |
69 | | - "$flutter_root/shell/platform/fuchsia/runtime/dart/utils", |
70 | | - "$flutter_root/vulkan", |
71 | | - "$fuchsia_sdk_root/fidl:fuchsia.fonts", |
72 | | - "$fuchsia_sdk_root/fidl:fuchsia.images", |
73 | | - "$fuchsia_sdk_root/fidl:fuchsia.io", |
74 | | - "$fuchsia_sdk_root/fidl:fuchsia.modular", |
75 | | - "$fuchsia_sdk_root/fidl:fuchsia.sys", |
76 | | - "$fuchsia_sdk_root/fidl:fuchsia.ui.app", |
77 | | - "$fuchsia_sdk_root/fidl:fuchsia.ui.scenic", |
78 | | - "$fuchsia_sdk_root/pkg:async-cpp", |
79 | | - "$fuchsia_sdk_root/pkg:async-loop", |
80 | | - "$fuchsia_sdk_root/pkg:async-loop-cpp", |
81 | | - "$fuchsia_sdk_root/pkg:fdio", |
82 | | - "$fuchsia_sdk_root/pkg:fidl_cpp", |
83 | | - "$fuchsia_sdk_root/pkg:scenic_cpp", |
84 | | - "$fuchsia_sdk_root/pkg:syslog", |
85 | | - "$fuchsia_sdk_root/pkg:zx", |
86 | | - "$fuchsia_sdk_root/pkg/lib/sys/cpp", |
87 | | - "$fuchsia_sdk_root/pkg/lib/vfs/cpp", |
88 | | - "//third_party/tonic", |
| 95 | + ":fuchsia_gpu_configuration", |
| 96 | + "$flutter_root/common", |
| 97 | + "$flutter_root/flow", |
| 98 | + "$flutter_root/fml", |
| 99 | + "$flutter_root/lib/ui", |
| 100 | + "$flutter_root/runtime", |
| 101 | + "$flutter_root/runtime:libdart", |
| 102 | + "$flutter_root/shell/common", |
| 103 | + "$flutter_root/shell/platform/fuchsia/dart-pkg/fuchsia", |
| 104 | + "$flutter_root/shell/platform/fuchsia/dart-pkg/zircon", |
| 105 | + "$flutter_root/shell/platform/fuchsia/runtime/dart/utils", |
| 106 | + "$flutter_root/vulkan", |
| 107 | + "$fuchsia_sdk_root/fidl:fuchsia.fonts", |
| 108 | + "$fuchsia_sdk_root/fidl:fuchsia.images", |
| 109 | + "$fuchsia_sdk_root/fidl:fuchsia.io", |
| 110 | + "$fuchsia_sdk_root/fidl:fuchsia.modular", |
| 111 | + "$fuchsia_sdk_root/fidl:fuchsia.sys", |
| 112 | + "$fuchsia_sdk_root/fidl:fuchsia.ui.app", |
| 113 | + "$fuchsia_sdk_root/fidl:fuchsia.ui.scenic", |
| 114 | + "$fuchsia_sdk_root/pkg:async-cpp", |
| 115 | + "$fuchsia_sdk_root/pkg:async-loop", |
| 116 | + "$fuchsia_sdk_root/pkg:async-loop-cpp", |
| 117 | + "$fuchsia_sdk_root/pkg:fdio", |
| 118 | + "$fuchsia_sdk_root/pkg:fidl_cpp", |
| 119 | + "$fuchsia_sdk_root/pkg:scenic_cpp", |
| 120 | + "$fuchsia_sdk_root/pkg:syslog", |
| 121 | + "$fuchsia_sdk_root/pkg:zx", |
| 122 | + "$fuchsia_sdk_root/pkg/lib/sys/cpp", |
| 123 | + "$fuchsia_sdk_root/pkg/lib/vfs/cpp", |
| 124 | + "//third_party/tonic", |
| 125 | + ] + extra_deps |
| 126 | + |
| 127 | + # The flags below are needed so that Dart's CPU profiler can walk the |
| 128 | + # C++ stack. |
| 129 | + cflags = [ "-fno-omit-frame-pointer" ] |
| 130 | + } |
| 131 | +} |
| 132 | + |
| 133 | +# Things that explicitly being excluded: |
| 134 | +# 1. flutter_profile flag. |
| 135 | +# 2. Injecting flutter tool specific stuff. |
| 136 | +# 3. Product mode is going to be false for now. |
| 137 | +# 4. Kernel snapshot: framework and product. |
| 138 | +# 5. Observatoory stuff. |
| 139 | +# 6. Profiler symbols. |
| 140 | +# 7. framework and product!! (_framework snapshots and dilp files.) |
| 141 | +# 8. CMX files are also ignored. |
| 142 | + |
| 143 | +flutter_runner("jit") { |
| 144 | + output_name = "flutter_jit_runner" |
| 145 | + |
| 146 | + extra_deps = [ "$flutter_root/runtime:libdart" ] |
| 147 | +} |
| 148 | + |
| 149 | +template("jit_runner") { |
| 150 | + product_suffix = "" |
| 151 | + |
| 152 | + if (defined(invoker.product) && invoker.product) { |
| 153 | + product_suffix = "product" |
| 154 | + } |
| 155 | + |
| 156 | + package_dir(target_name) { |
| 157 | + snapshot_gen_dir = "$root_build_dir/gen/flutter/lib/snapshot" |
| 158 | + |
| 159 | + deps = [ |
| 160 | + ":jit${product_suffix}", |
| 161 | + "$flutter_root/lib/snapshot:generate_snapshot_bin", |
| 162 | + ] |
| 163 | + |
| 164 | + binary = "flutter_jit${product_suffix}_runner" |
| 165 | + |
| 166 | + resources = [ |
| 167 | + { |
| 168 | + path = rebase_path( |
| 169 | + "$snapshot_gen_dir/vm_isolate_snapshot${product_suffix}.bin") |
| 170 | + dest = "vm_snapshot_data.bin" |
| 171 | + }, |
| 172 | + { |
| 173 | + path = rebase_path( |
| 174 | + "$snapshot_gen_dir/vm_snapshot_instructions${product_suffix}.bin") |
| 175 | + dest = "vm_snapshot_instructions.bin" |
| 176 | + }, |
| 177 | + { |
| 178 | + path = rebase_path( |
| 179 | + "$snapshot_gen_dir/isolate_snapshot${product_suffix}.bin") |
| 180 | + dest = "isolate_core_snapshot_data.bin" |
| 181 | + }, |
| 182 | + { |
| 183 | + path = rebase_path( |
| 184 | + "$snapshot_gen_dir/isolate_snapshot_instructions${product_suffix}.bin") |
| 185 | + dest = "isolate_core_snapshot_instructions.bin" |
| 186 | + }, |
| 187 | + ] |
| 188 | + |
| 189 | + meta = [ |
| 190 | + { |
| 191 | + path = rebase_path("meta/flutter_jit${product_suffix}_runner.cmx") |
| 192 | + dest = "flutter_jit${product_suffix}_runner.cmx" |
| 193 | + }, |
89 | 194 | ] |
90 | 195 | } |
91 | 196 | } |
| 197 | + |
| 198 | +jit_runner("flutter_jit_runner") { |
| 199 | + product = false |
| 200 | +} |
0 commit comments