• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15import("//foundation/arkui/ace_engine/ace_config.gni")
16import("//foundation/arkui/ace_engine/build/ace_ext.gni")
17import("//third_party/flutter/flutter_config.gni")
18
19# ------------------------------------------------
20#      Flutter engine config begin
21# ------------------------------------------------
22config("flutter_config") {
23  visibility = [ "./*" ]
24  visibility += [
25    "$ace_graphic/rosen/*",
26    "$ace_root/*",
27    "$flutter_root/engine/flutter/*",
28    "$multimedia_root/image_framework/plugins/common/libs/image/libjpegplugin/*",
29  ]
30
31  include_dirs = []
32
33  include_dirs += [
34    "$flutter_root",
35    "$flutter_root/engine",
36    "$flutter_root/engine/flutter",
37  ]
38
39  if (defined(use_new_skia) && use_new_skia) {
40    include_dirs += [
41      "$flutter_root/txt/src",
42      "//third_party/skia",
43      "//third_party/skia/third_party/externals/harfbuzz/src",
44    ]
45  } else {
46    include_dirs += [ "$flutter_root/engine/flutter/third_party/txt/src" ]
47  }
48
49  cflags = [
50    "-fvisibility=hidden",
51    "-fdata-sections",
52    "-ffunction-sections",
53  ]
54
55  cflags_cc = [ "-fvisibility-inlines-hidden" ]
56  defines = []
57  defines += ace_common_defines
58}
59
60template("flutter_engine") {
61  forward_variables_from(invoker, "*")
62
63  ohos_source_set(target_name) {
64    part_name = flutter_part
65    subsystem_name = flutter_subsystem
66    license_file = "$flutter_root/engine/flutter/LICENSE"
67    deps = [
68      ":flutter_engine_asset_manager",
69      ":flutter_engine_common_$platform",
70      ":flutter_engine_flow_$platform",
71      ":flutter_engine_fml_$platform",
72      ":flutter_engine_lib_ui_$platform",
73      ":flutter_engine_shell_$platform",
74      "libtxt:thirdparty_lib_txt_$platform",
75    ]
76    public_configs = [
77      ":flutter_config",
78      "icu:icu_config_$platform",
79    ]
80  }
81}
82
83foreach(item, ace_platforms) {
84  flutter_engine("third_party_flutter_engine_" + item.name) {
85    platform = item.name
86  }
87}
88
89# ------------------------------------------------
90#      Flutter engine config end
91# ------------------------------------------------
92
93# ------------------------------------------------
94#      Flutter asset_manager config begin
95# ------------------------------------------------
96ohos_source_set("flutter_engine_asset_manager") {
97  part_name = flutter_part
98  subsystem_name = flutter_subsystem
99  sources = [
100    "$flutter_root/engine/flutter/assets/asset_manager.cc",
101    "$flutter_root/engine/flutter/assets/directory_asset_bundle.cc",
102  ]
103
104  configs = [ ":flutter_config" ]
105}
106
107# ------------------------------------------------
108#      Flutter asset_manager config end
109# ------------------------------------------------
110
111# ------------------------------------------------
112#      Flutter fml config begin
113# ------------------------------------------------
114config("flutter_engine_fml_mac_config") {
115  cflags = [
116    "-Wno-thread-safety-attributes",
117    "-Wno-thread-safety-analysis",
118  ]
119}
120
121template("flutter_engine_fml") {
122  forward_variables_from(invoker, "*")
123  ohos_source_set(target_name) {
124    part_name = flutter_part
125    subsystem_name = flutter_subsystem
126    defines += invoker.defines
127    cflags_cc += invoker.cflags_cc
128    configs = [
129      ":flutter_config",
130      "icu:icu_config_$platform",
131    ]
132    if (platform == "android") {
133      configs += [ "$ace_root/build:reduce_eh_frame_config" ]
134    }
135
136    sources = [
137      "$flutter_root/engine/flutter/fml/base32.cc",
138      "$flutter_root/engine/flutter/fml/command_line.cc",
139      "$flutter_root/engine/flutter/fml/concurrent_message_loop.cc",
140      "$flutter_root/engine/flutter/fml/delayed_task.cc",
141      "$flutter_root/engine/flutter/fml/file.cc",
142      "$flutter_root/engine/flutter/fml/gpu_thread_merger.cc",
143      "$flutter_root/engine/flutter/fml/icu_util.cc",
144      "$flutter_root/engine/flutter/fml/log_settings.cc",
145      "$flutter_root/engine/flutter/fml/log_settings_state.cc",
146      "$flutter_root/engine/flutter/fml/logging.cc",
147      "$flutter_root/engine/flutter/fml/mapping.cc",
148      "$flutter_root/engine/flutter/fml/memory/weak_ptr_internal.cc",
149      "$flutter_root/engine/flutter/fml/message.cc",
150      "$flutter_root/engine/flutter/fml/message_loop.cc",
151      "$flutter_root/engine/flutter/fml/message_loop_impl.cc",
152      "$flutter_root/engine/flutter/fml/message_loop_task_queues.cc",
153      "$flutter_root/engine/flutter/fml/paths.cc",
154      "$flutter_root/engine/flutter/fml/synchronization/count_down_latch.cc",
155      "$flutter_root/engine/flutter/fml/synchronization/semaphore.cc",
156      "$flutter_root/engine/flutter/fml/synchronization/waitable_event.cc",
157      "$flutter_root/engine/flutter/fml/task_runner.cc",
158      "$flutter_root/engine/flutter/fml/thread.cc",
159      "$flutter_root/engine/flutter/fml/thread_local.cc",
160      "$flutter_root/engine/flutter/fml/time/time_point.cc",
161      "$flutter_root/engine/flutter/fml/trace_event.cc",
162      "$flutter_root/engine/flutter/fml/unique_fd.cc",
163    ]
164
165    if (platform == "windows") {
166      sources += [
167        "$flutter_root/engine/flutter/fml/platform/win/errors_win.cc",
168        "$flutter_root/engine/flutter/fml/platform/win/file_win.cc",
169        "$flutter_root/engine/flutter/fml/platform/win/mapping_win.cc",
170        "$flutter_root/engine/flutter/fml/platform/win/message_loop_win.cc",
171        "$flutter_root/engine/flutter/fml/platform/win/native_library_win.cc",
172        "$flutter_root/engine/flutter/fml/platform/win/paths_win.cc",
173      ]
174
175      libs = [ "//prebuilts/mingw-w64/ohos/linux-x86_64/clang-mingw/x86_64-w64-mingw32/lib/librpcrt4.a" ]
176    } else if (platform == "mac" || platform == "ios") {
177      public_configs = [ ":flutter_engine_fml_mac_config" ]
178
179      cflags = [ "-DNS_FORMAT_ARGUMENT(A)=" ]
180      sources += [
181        "$flutter_root/engine/flutter/fml/platform/darwin/cf_utils.cc",
182        "$flutter_root/engine/flutter/fml/platform/darwin/message_loop_darwin.mm",
183        "$flutter_root/engine/flutter/fml/platform/darwin/paths_darwin.mm",
184        "$flutter_root/engine/flutter/fml/platform/darwin/platform_version.mm",
185        "$flutter_root/engine/flutter/fml/platform/darwin/scoped_block.mm",
186        "$flutter_root/engine/flutter/fml/platform/darwin/scoped_nsobject.mm",
187        "$flutter_root/engine/flutter/fml/platform/darwin/string_range_sanitization.mm",
188        "$flutter_root/engine/flutter/fml/platform/posix/file_posix.cc",
189        "$flutter_root/engine/flutter/fml/platform/posix/mapping_posix.cc",
190        "$flutter_root/engine/flutter/fml/platform/posix/native_library_posix.cc",
191        "$flutter_root/engine/flutter/fml/platform/posix/paths_posix.cc",
192        "$flutter_root/engine/flutter/fml/platform/posix/shared_mutex_posix.cc",
193      ]
194      if (defined(enable_gn_2021)) {
195        frameworks = [
196          "CoreFoundation.framework",
197          "Foundation.framework",
198        ]
199      } else {
200        libs = [
201          "CoreFoundation.framework",
202          "Foundation.framework",
203        ]
204      }
205    } else if (platform == "linux") {
206      sources += [
207        "$flutter_root/engine/flutter/fml/platform/linux/message_loop_linux.cc",
208        "$flutter_root/engine/flutter/fml/platform/linux/paths_linux.cc",
209        "$flutter_root/engine/flutter/fml/platform/linux/timerfd.cc",
210        "$flutter_root/engine/flutter/fml/platform/posix/file_posix.cc",
211        "$flutter_root/engine/flutter/fml/platform/posix/mapping_posix.cc",
212        "$flutter_root/engine/flutter/fml/platform/posix/native_library_posix.cc",
213        "$flutter_root/engine/flutter/fml/platform/posix/paths_posix.cc",
214      ]
215    } else {
216      sources += [
217        "$flutter_root/engine/flutter/fml/platform/linux/timerfd.cc",
218        "$flutter_root/engine/flutter/fml/platform/posix/file_posix.cc",
219        "$flutter_root/engine/flutter/fml/platform/posix/mapping_posix.cc",
220        "$flutter_root/engine/flutter/fml/platform/posix/native_library_posix.cc",
221        "$flutter_root/engine/flutter/fml/platform/posix/paths_posix.cc",
222      ]
223
224      if (is_ohos_standard_system) {
225        sources += [
226          "$flutter_root/engine/flutter/fml/platform/linux/message_loop_linux.cc",
227          "$flutter_root/engine/flutter/fml/platform/linux/paths_linux.cc",
228        ]
229        external_deps = [ "hilog:libhilog" ]
230      } else {
231        sources += [
232          "$flutter_root/engine/flutter/fml/platform/android/jni_util.cc",
233          "$flutter_root/engine/flutter/fml/platform/android/jni_weak_ref.cc",
234          "$flutter_root/engine/flutter/fml/platform/android/message_loop_android.cc",
235          "$flutter_root/engine/flutter/fml/platform/android/paths_android.cc",
236          "$flutter_root/engine/flutter/fml/platform/android/scoped_java_ref.cc",
237        ]
238        libs = [
239          "android",
240          "log",
241        ]
242      }
243    }
244  }
245}
246
247foreach(item, ace_platforms) {
248  flutter_engine_fml("flutter_engine_fml_" + item.name) {
249    platform = item.name
250    defines = []
251    cflags_cc = []
252    config = {
253    }
254
255    if (defined(item.config)) {
256      config = item.config
257    }
258
259    if (defined(config.defines)) {
260      defines = config.defines
261    }
262
263    if (defined(config.cflags_cc)) {
264      cflags_cc = config.cflags_cc
265    }
266  }
267}
268
269# ------------------------------------------------
270#      Flutter fml config end
271# ------------------------------------------------
272
273# ------------------------------------------------
274#      Flutter common config begin
275# ------------------------------------------------
276template("flutter_engine_common") {
277  forward_variables_from(invoker, "*")
278
279  ohos_source_set(target_name) {
280    part_name = flutter_part
281    subsystem_name = flutter_subsystem
282    defines += invoker.defines
283    cflags_cc += invoker.cflags_cc
284    configs = [ ":flutter_config" ]
285    if (platform == "android") {
286      configs += [ "$ace_root/build:reduce_eh_frame_config" ]
287    }
288
289    sources = [
290      "$flutter_root/engine/flutter/common/settings.cc",
291      "$flutter_root/engine/flutter/common/task_runners.cc",
292    ]
293
294    deps = [ ":flutter_engine_fml_$platform" ]
295  }
296}
297
298foreach(item, ace_platforms) {
299  flutter_engine_common("flutter_engine_common_" + item.name) {
300    platform = item.name
301    defines = []
302    cflags_cc = []
303    config = {
304    }
305
306    if (defined(item.config)) {
307      config = item.config
308    }
309
310    if (defined(config.defines)) {
311      defines = config.defines
312    }
313
314    if (defined(config.cflags_cc)) {
315      cflags_cc = config.cflags_cc
316    }
317  }
318}
319
320# ------------------------------------------------
321#      Flutter common config end
322# ------------------------------------------------
323
324# ------------------------------------------------
325#      Flutter flow config begin
326# ------------------------------------------------
327template("flutter_engine_flow") {
328  forward_variables_from(invoker, "*")
329
330  ohos_source_set(target_name) {
331    part_name = flutter_part
332    subsystem_name = flutter_subsystem
333    defines += invoker.defines
334    cflags_cc += invoker.cflags_cc
335
336    configs = [ ":flutter_config" ]
337    if (platform == "android") {
338      configs += [ "$ace_root/build:reduce_eh_frame_config" ]
339    }
340
341    sources = [
342      "$flutter_root/engine/flutter/flow/compositor_context.cc",
343      "$flutter_root/engine/flutter/flow/debug_print.cc",
344      "$flutter_root/engine/flutter/flow/embedded_views.cc",
345      "$flutter_root/engine/flutter/flow/instrumentation.cc",
346      "$flutter_root/engine/flutter/flow/layers/backdrop_filter_layer.cc",
347      "$flutter_root/engine/flutter/flow/layers/clip_path_layer.cc",
348      "$flutter_root/engine/flutter/flow/layers/clip_rect_layer.cc",
349      "$flutter_root/engine/flutter/flow/layers/clip_rrect_layer.cc",
350      "$flutter_root/engine/flutter/flow/layers/color_filter_layer.cc",
351      "$flutter_root/engine/flutter/flow/layers/container_layer.cc",
352      "$flutter_root/engine/flutter/flow/layers/filter_layer.cc",
353      "$flutter_root/engine/flutter/flow/layers/hole_layer.cc",
354      "$flutter_root/engine/flutter/flow/layers/layer.cc",
355      "$flutter_root/engine/flutter/flow/layers/layer_tree.cc",
356      "$flutter_root/engine/flutter/flow/layers/mask_layer.cc",
357      "$flutter_root/engine/flutter/flow/layers/opacity_layer.cc",
358      "$flutter_root/engine/flutter/flow/layers/performance_overlay_layer.cc",
359      "$flutter_root/engine/flutter/flow/layers/physical_shape_layer.cc",
360      "$flutter_root/engine/flutter/flow/layers/picture_layer.cc",
361      "$flutter_root/engine/flutter/flow/layers/platform_view_layer.cc",
362      "$flutter_root/engine/flutter/flow/layers/shader_mask_layer.cc",
363      "$flutter_root/engine/flutter/flow/layers/texture_layer.cc",
364      "$flutter_root/engine/flutter/flow/layers/transform_layer.cc",
365      "$flutter_root/engine/flutter/flow/matrix_decomposition.cc",
366      "$flutter_root/engine/flutter/flow/paint_utils.cc",
367      "$flutter_root/engine/flutter/flow/raster_cache.cc",
368      "$flutter_root/engine/flutter/flow/raster_cache_key.cc",
369      "$flutter_root/engine/flutter/flow/skia_gpu_object.cc",
370      "$flutter_root/engine/flutter/flow/texture.cc",
371    ]
372
373    deps = [
374      ":flutter_engine_fml_$platform",
375      "skia:ace_skia_$platform",
376    ]
377  }
378}
379
380foreach(item, ace_platforms) {
381  flutter_engine_flow("flutter_engine_flow_" + item.name) {
382    platform = item.name
383    defines = []
384    cflags_cc = []
385    config = {
386    }
387
388    if (defined(item.config)) {
389      config = item.config
390    }
391
392    if (defined(config.defines)) {
393      defines = config.defines
394    }
395
396    if (defined(config.cflags_cc)) {
397      cflags_cc = config.cflags_cc
398    }
399  }
400}
401
402# ------------------------------------------------
403#      Flutter flow config end
404# ------------------------------------------------
405
406# ------------------------------------------------
407#      Flutter shell config begin
408# ------------------------------------------------
409template("flutter_engine_shell") {
410  forward_variables_from(invoker, "*")
411
412  ohos_source_set(target_name) {
413    part_name = flutter_part
414    subsystem_name = flutter_subsystem
415    defines += invoker.defines
416    defines += [
417      "FLUTTER_ENGINE_VERSION=\"cc88fa45dbf4c55bc23cecea17fb90f43bccf588\"",
418      "SKIA_VERSION=\"4b567cd679ab964b5f6281a67a96c694c950f597\"",
419      "DART_VERSION=\"fake version\"",
420    ]
421    cflags_cc += invoker.cflags_cc
422
423    include_dirs = []
424
425    if ((!defined(config.enable_rosen_backend) ||
426         !config.enable_rosen_backend) && defined(vendor_configs.vendor_root)) {
427      include_dirs += vendor_configs.vendor_root
428    }
429
430    configs = [
431      ":flutter_config",
432      "icu:icu_config_$platform",
433    ]
434    if (platform == "android") {
435      configs += [ "$ace_root/build:reduce_eh_frame_config" ]
436    }
437
438    sources = [
439      "$flutter_root/engine/flutter/shell/common/animator.cc",
440      "$flutter_root/engine/flutter/shell/common/persistent_cache.cc",
441      "$flutter_root/engine/flutter/shell/common/pipeline.cc",
442      "$flutter_root/engine/flutter/shell/common/rasterizer.cc",
443      "$flutter_root/engine/flutter/shell/common/shell_io_manager.cc",
444      "$flutter_root/engine/flutter/shell/common/surface.cc",
445      "$flutter_root/engine/flutter/shell/common/thread_host.cc",
446      "$flutter_root/engine/flutter/shell/common/vsync_waiter.cc",
447      "$flutter_root/engine/flutter/shell/common/vsync_waiter_fallback.cc",
448
449      # only support gl and software
450      "$flutter_root/engine/flutter/shell/gpu/gpu_surface_gl.cc",
451      "$flutter_root/engine/flutter/shell/gpu/gpu_surface_gl_delegate.cc",
452      "$flutter_root/engine/flutter/shell/gpu/gpu_surface_software.cc",
453      "$flutter_root/engine/flutter/shell/gpu/gpu_surface_software_delegate.cc",
454      "$flutter_root/engine/flutter/shell/version/version.cc",
455
456      # Ability Cross-platform Environment(ACE) override implementation
457      "$flutter_root/engine/flutter/runtime/ace_runtime_controller.cc",
458      "$flutter_root/engine/flutter/runtime/window_manager.cc",
459      "$flutter_root/engine/flutter/shell/common/ace_engine.cc",
460      "$flutter_root/engine/flutter/shell/common/ace_platform_view.cc",
461      "$flutter_root/engine/flutter/shell/common/ace_run_configuration.cc",
462      "$flutter_root/engine/flutter/shell/common/ace_shell.cc",
463    ]
464
465    if (defined(config.disable_gpu) && config.disable_gpu) {
466      sources -= [ "$flutter_root/engine/flutter/shell/gpu/gpu_surface_gl.cc" ]
467    }
468
469    deps = [
470      ":flutter_engine_fml_$platform",
471      "skia:ace_skia_$platform",
472    ]
473
474    if (is_standard_system && platform == "ohos") {
475      include_dirs += [ "$window_manager_path/interfaces/innerkits" ]
476      sources += [
477        "$flutter_root/engine/flutter/shell/platform/ohos/ace_vsync_waiter_embedder.cc",
478        "$flutter_root/engine/flutter/shell/platform/ohos/ohos_shell_holder.cc",
479        "$flutter_root/engine/flutter/shell/platform/ohos/ohos_surface_software.cc",
480        "$flutter_root/engine/flutter/shell/platform/ohos/platform_task_runner.cc",
481        "$flutter_root/engine/flutter/shell/platform/ohos/platform_task_runner_adapter.cc",
482        "$flutter_root/engine/flutter/shell/platform/ohos/platform_view_ohos.cc",
483      ]
484      if ((!defined(config.disable_gpu) || !config.disable_gpu) &&
485          (!defined(config.enable_rosen_backend) ||
486           !config.enable_rosen_backend)) {
487        if (defined(vendor_configs.flutter_vendor_sources)) {
488          sources -= [
489            "$flutter_root/engine/flutter/shell/platform/ohos/ace_vsync_waiter_embedder.cc",
490            "$flutter_root/engine/flutter/shell/platform/ohos/platform_view_ohos.cc",
491          ]
492          sources += vendor_configs.flutter_vendor_sources
493        } else {
494          sources += [ "$flutter_root/engine/flutter/shell/platform/ohos/ohos_surface_gl.cc" ]
495        }
496
497        public_deps = [ "$ace_graphic:libgl" ]
498      }
499      deps += [
500        "$ace_graphic/rosen/modules/render_service_client:librender_service_client",
501        "$window_manager_path/wm:libwm",
502      ]
503      external_deps = [
504        "eventhandler:libeventhandler",
505        "graphic_2d:libcomposer",
506        "ipc:ipc_core",
507      ]
508    } else if (platform == "ohos" || platform == "android") {
509      sources += [
510        # Ability Cross-platform Environment(ACE) override implementation
511        "$flutter_root/engine/flutter/shell/common/ace_display_manager_jni.cc",
512        "$flutter_root/engine/flutter/shell/platform/android/ace_platform_view_android.cc",
513        "$flutter_root/engine/flutter/shell/platform/android/ace_vsync_waiter_android.cc",
514        "$flutter_root/engine/flutter/shell/platform/android/android_context_gl.cc",
515        "$flutter_root/engine/flutter/shell/platform/android/android_environment_gl.cc",
516        "$flutter_root/engine/flutter/shell/platform/android/android_external_texture_gl.cc",
517        "$flutter_root/engine/flutter/shell/platform/android/android_native_window.cc",
518        "$flutter_root/engine/flutter/shell/platform/android/android_shell_holder.cc",
519        "$flutter_root/engine/flutter/shell/platform/android/android_surface.cc",
520        "$flutter_root/engine/flutter/shell/platform/android/android_surface_gl.cc",
521        "$flutter_root/engine/flutter/shell/platform/android/android_surface_software.cc",
522        "$flutter_root/engine/flutter/shell/platform/android/apk_asset_provider.cc",
523        "$flutter_root/engine/flutter/shell/platform/android/platform_message_response_android.cc",
524      ]
525
526      if (platform == "android") {
527        include_dirs += [
528          "$ability_runtime_root/cross_platform/frameworks/native/base/event_handler/include",
529          "$ability_runtime_root/cross_platform/interfaces/inner_api/error",
530        ]
531        sources += [
532          "$flutter_root/engine/flutter/shell/platform/ohos/platform_task_runner.cc",
533          "$flutter_root/engine/flutter/shell/platform/ohos/platform_task_runner_adapter.cc",
534        ]
535        deps += [ "$ability_runtime_root/cross_platform/frameworks/native/base/event_handler:cross_platform_event_handler" ]
536      }
537
538      libs = [
539        "EGL",
540        "GLESv2",
541      ]
542
543      if (defined(config.use_agp_vsync) && config.use_agp_vsync) {
544        sources += [ "$flutter_root/engine/flutter/shell/platform/ohos/ace_vsync_waiter_embedder.cc" ]
545        external_deps = [
546          "graphic:libagp",
547          "graphic:libagpcoreui",
548          "graphic:libagpcoreui_adapter",
549          "graphic:libagpwindow",
550        ]
551      }
552    } else if (platform == "ios") {
553      ios_prefix = "$flutter_root/engine/flutter/shell/platform/darwin/ios"
554      include_dirs = [
555        "$ios_prefix",
556        "$ios_prefix/framework/Headers",
557        "$flutter_root/engine/flutter/shell/platform/darwin/common/framework/Headers",
558        "$ability_runtime_root/cross_platform/frameworks/native/base/event_handler/include",
559        "$ability_runtime_root/cross_platform/interfaces/inner_api/error",
560      ]
561      sources += [
562        "$flutter_root/engine/flutter/shell/platform/ohos/platform_task_runner.cc",
563        "$flutter_root/engine/flutter/shell/platform/ohos/platform_task_runner_adapter.cc",
564      ]
565
566      deps += [ "$ability_runtime_root/cross_platform/frameworks/native/base/event_handler:cross_platform_event_handler" ]
567
568      _flutter_framework_headers = [
569        "$ios_prefix/framework/Headers/Flutter.h",
570        "$ios_prefix/framework/Headers/FlutterAppDelegate.h",
571        "$ios_prefix/framework/Headers/FlutterDartProject.h",
572        "$ios_prefix/framework/Headers/FlutterEngine.h",
573        "$ios_prefix/framework/Headers/FlutterHeadlessDartRunner.h",
574        "$ios_prefix/framework/Headers/FlutterPlatformViews.h",
575        "$ios_prefix/framework/Headers/FlutterPlugin.h",
576        "$ios_prefix/framework/Headers/FlutterPluginAppLifeCycleDelegate.h",
577        "$ios_prefix/framework/Headers/FlutterTexture.h",
578        "$ios_prefix/framework/Headers/FlutterViewController.h",
579      ]
580
581      _flutter_shell_ios = [
582        "$flutter_root/engine/flutter/shell/platform/darwin/common/buffer_conversions.mm",
583        "$flutter_root/engine/flutter/shell/platform/darwin/common/command_line.mm",
584        "$flutter_root/engine/flutter/shell/common/switches.cc",
585        "$flutter_root/engine/flutter/shell/common/switches.h",
586        "$ios_prefix/framework/Source/FlutterAppDelegate.mm",
587        "$ios_prefix/framework/Source/FlutterAppDelegate_Internal.h",
588        "$ios_prefix/framework/Source/FlutterBinaryMessengerRelay.mm",
589        "$ios_prefix/framework/Source/FlutterDartProject.mm",
590        "$ios_prefix/framework/Source/FlutterDartProject_Internal.h",
591        "$ios_prefix/framework/Source/FlutterEngine.mm",
592        "$ios_prefix/framework/Source/FlutterEngine_Internal.h",
593        "$ios_prefix/framework/Source/FlutterHeadlessDartRunner.mm",
594        "$ios_prefix/framework/Source/FlutterOverlayView.h",
595        "$ios_prefix/framework/Source/FlutterOverlayView.mm",
596        "$ios_prefix/framework/Source/FlutterPlatformPlugin.h",
597        "$ios_prefix/framework/Source/FlutterPlatformPlugin.mm",
598        "$ios_prefix/framework/Source/FlutterPlatformViews.mm",
599        "$ios_prefix/framework/Source/FlutterPlatformViews_Internal.h",
600        "$ios_prefix/framework/Source/FlutterPlatformViews_Internal.mm",
601        "$ios_prefix/framework/Source/FlutterPluginAppLifeCycleDelegate.mm",
602        "$ios_prefix/framework/Source/FlutterTextInputDelegate.h",
603        "$ios_prefix/framework/Source/FlutterView.h",
604        "$ios_prefix/framework/Source/FlutterView.mm",
605        "$ios_prefix/framework/Source/FlutterViewController.mm",
606        "$ios_prefix/framework/Source/FlutterViewController_Internal.h",
607        "$ios_prefix/framework/Source/platform_message_response_darwin.h",
608        "$ios_prefix/framework/Source/platform_message_response_darwin.mm",
609        "$ios_prefix/framework/Source/platform_message_router.h",
610        "$ios_prefix/framework/Source/platform_message_router.mm",
611        "$ios_prefix/framework/Source/vsync_waiter_ios.h",
612        "$ios_prefix/framework/Source/vsync_waiter_ios.mm",
613        "$ios_prefix/ios_external_texture_gl.h",
614        "$ios_prefix/ios_external_texture_gl.mm",
615        "$ios_prefix/ios_gl_context.h",
616        "$ios_prefix/ios_gl_context.mm",
617        "$ios_prefix/ios_gl_render_target.h",
618        "$ios_prefix/ios_gl_render_target.mm",
619        "$ios_prefix/ios_surface.h",
620        "$ios_prefix/ios_surface.mm",
621        "$ios_prefix/ios_surface_gl.h",
622        "$ios_prefix/ios_surface_gl.mm",
623        "$ios_prefix/ios_surface_software.h",
624        "$ios_prefix/ios_surface_software.mm",
625        "$ios_prefix/platform_view_ios.h",
626        "$ios_prefix/platform_view_ios.mm",
627      ]
628
629      sources += _flutter_framework_headers
630      sources += _flutter_shell_ios
631
632      defines += [
633        "FLUTTER_FRAMEWORK=1",
634        "FLUTTER_RUNTIME_MODE=3",
635      ]
636
637      frameworks = [
638        "CoreMedia.framework",
639        "CoreVideo.framework",
640        "UIKit.framework",
641        "OpenGLES.framework",
642        "AudioToolbox.framework",
643        "QuartzCore.framework",
644      ]
645    }
646  }
647}
648
649foreach(item, ace_platforms) {
650  flutter_engine_shell("flutter_engine_shell_" + item.name) {
651    platform = item.name
652    defines = []
653    cflags_cc = []
654    config = {
655    }
656
657    if (defined(item.config)) {
658      config = item.config
659    }
660
661    if (defined(config.defines)) {
662      defines = config.defines
663    }
664
665    if (defined(config.cflags_cc)) {
666      cflags_cc = config.cflags_cc
667    }
668  }
669}
670
671# ------------------------------------------------
672#      Flutter shell config end
673# ------------------------------------------------
674
675# ------------------------------------------------
676#      Flutter lib_ui config begin
677# ------------------------------------------------
678template("flutter_engine_lib_ui") {
679  forward_variables_from(invoker, "*")
680  ohos_source_set(target_name) {
681    part_name = flutter_part
682    subsystem_name = flutter_subsystem
683    defines += invoker.defines
684    cflags_cc += invoker.cflags_cc
685
686    configs = [
687      ":flutter_config",
688      "icu:icu_config_$platform",
689    ]
690    if (platform == "android") {
691      configs += [ "$ace_root/build:reduce_eh_frame_config" ]
692    }
693
694    sources = [
695      "$flutter_root/engine/flutter/lib/ui/compositing/scene.cc",
696      "$flutter_root/engine/flutter/lib/ui/compositing/scene_builder.cc",
697      "$flutter_root/engine/flutter/lib/ui/painting/canvas.cc",
698      "$flutter_root/engine/flutter/lib/ui/painting/color_filter.cc",
699      "$flutter_root/engine/flutter/lib/ui/painting/engine_layer.cc",
700      "$flutter_root/engine/flutter/lib/ui/painting/gradient.cc",
701      "$flutter_root/engine/flutter/lib/ui/painting/image.cc",
702      "$flutter_root/engine/flutter/lib/ui/painting/image_filter.cc",
703      "$flutter_root/engine/flutter/lib/ui/painting/matrix.cc",
704      "$flutter_root/engine/flutter/lib/ui/painting/path.cc",
705      "$flutter_root/engine/flutter/lib/ui/painting/picture_recorder.cc",
706      "$flutter_root/engine/flutter/lib/ui/painting/shader.cc",
707      "$flutter_root/engine/flutter/lib/ui/painting/vertices.cc",
708      "$flutter_root/engine/flutter/lib/ui/window/platform_message.cc",
709      "$flutter_root/engine/flutter/lib/ui/window/platform_message_response.cc",
710      "$flutter_root/engine/flutter/lib/ui/window/pointer_data_packet.cc",
711      "$flutter_root/engine/flutter/lib/ui/window/viewport_metrics.cc",
712
713      # Ability Cross-platform Environment(ACE) override implementation
714      "$flutter_root/engine/flutter/lib/ui/painting/image_encoding.cc",
715      "$flutter_root/engine/flutter/lib/ui/painting/paint.cc",
716      "$flutter_root/engine/flutter/lib/ui/painting/picture.cc",
717      "$flutter_root/engine/flutter/lib/ui/text/font_collection.cc",
718      "$flutter_root/engine/flutter/lib/ui/text/text_box.cc",
719      "$flutter_root/engine/flutter/lib/ui/ui_dart_state.cc",
720      "$flutter_root/engine/flutter/lib/ui/window/window.cc",
721    ]
722
723    if (platform == "mac" || platform == "windows" || platform == "ios" ||
724        platform == "linux") {
725      sources +=
726          [ "$flutter_root/engine/flutter/lib/ui/window/pointer_data.cc" ]
727    }
728
729    deps = [
730      ":flutter_engine_fml_$platform",
731      "skia:ace_skia_$platform",
732    ]
733  }
734}
735
736foreach(item, ace_platforms) {
737  flutter_engine_lib_ui("flutter_engine_lib_ui_" + item.name) {
738    platform = item.name
739    defines = []
740    cflags_cc = []
741    config = {
742    }
743
744    if (defined(item.config)) {
745      config = item.config
746    }
747
748    if (defined(config.defines)) {
749      defines = config.defines
750    }
751
752    if (defined(config.cflags_cc)) {
753      cflags_cc = config.cflags_cc
754    }
755  }
756}
757
758# ------------------------------------------------
759#      Flutter lib_ui config end
760# ------------------------------------------------
761
762# ------------------------------------------------
763#      Flutter dependency for NG BUILD begin
764# ------------------------------------------------
765
766if (is_arkui_x) {
767  ohos_source_set("flutter_for_ng") {
768    part_name = flutter_part
769    subsystem_name = flutter_subsystem
770    sources = [
771      "$flutter_root/engine/flutter/common/task_runners.cc",
772      "$flutter_root/engine/flutter/lib/ui/window/pointer_data_packet.cc",
773      "$flutter_root/engine/flutter/lib/ui/window/viewport_metrics.cc",
774      "$flutter_root/engine/flutter/shell/common/thread_host.cc",
775      "$flutter_root/engine/flutter/shell/common/vsync_waiter.cc",
776      "$flutter_root/engine/flutter/shell/platform/ohos/platform_task_runner.cc",
777      "$flutter_root/engine/flutter/shell/platform/ohos/platform_task_runner_adapter.cc",
778    ]
779
780    include_dirs = [
781      "//foundation/appframework/ability/ability_runtime/cross_platform/frameworks/native/base/event_handler/include",
782      "//foundation/appframework/ability/ability_runtime/cross_platform/interfaces/inner_api/error",
783    ]
784
785    if (is_android) {
786      sources += [
787        "$flutter_root/engine/flutter/shell/platform/android/ace_vsync_waiter_android.cc",
788        "$flutter_root/engine/flutter/shell/platform/android/apk_asset_provider.cc",
789      ]
790    }
791
792    if (is_ios) {
793      sources += [
794        "$flutter_root/engine/flutter/lib/ui/window/pointer_data.cc",
795        "$flutter_root/engine/flutter/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.mm",
796      ]
797
798      include_dirs += [ "//third_party/skia" ]
799    }
800
801    public_configs = [ ":flutter_config" ]
802  }
803}
804# ------------------------------------------------
805#      Flutter dependency for NG BUILD end
806# ------------------------------------------------
807