1# Copyright (c) 2021-2023 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") 16 17template("preview_entrance_source") { 18 forward_variables_from(invoker, "*") 19 20 ohos_source_set(target_name) { 21 subsystem_name = ace_engine_subsystem 22 part_name = ace_engine_part 23 defines += invoker.defines 24 cflags_cc += invoker.cflags_cc 25 configs = [ "$ace_root:ace_config" ] 26 27 # set icu_data_path for ark preview 28 defines += [ "INIT_ICU_DATA_PATH" ] 29 30 sources = [ 31 "$ace_root/adapter/ohos/entrance/ace_new_pipe_judgement.cpp", 32 "ace_ability.cpp", 33 "ace_application_info.cpp", 34 "ace_container.cpp", 35 "ace_resource_register.cpp", 36 "clipboard/clipboard_impl.cpp", 37 "clipboard/clipboard_proxy_impl.cpp", 38 "editing/text_input_client_mgr.cpp", 39 "editing/text_input_connection_impl.cpp", 40 "editing/text_input_impl.cpp", 41 "event_dispatcher.cpp", 42 "flutter_ace_view.cpp", 43 "subwindow_preview.cpp", 44 ] 45 46 deps = [ 47 "$ace_flutter_engine_root/glfw:flutter_glfw_preview_$platform", 48 "$ace_flutter_engine_root/skia:ace_skia_$platform", 49 "$ace_napi:ace_napi", 50 "$ace_root/frameworks/core/components/theme:build_theme_code", 51 ] 52 53 if (defined(config.enable_rosen_backend) && config.enable_rosen_backend) { 54 sources -= [ "flutter_ace_view.cpp" ] 55 sources += [ "rs_ace_view.cpp" ] 56 deps += [ "//foundation/graphic/graphic_2d/rosen/modules/render_service_client:librender_service_client" ] 57 } 58 59 if (!is_cross_platform_build) { 60 if (platform == "windows") { 61 defines -= [ "UNICODE" ] 62 deps += [ "//base/global/resource_management/frameworks/resmgr:global_resmgr_win" ] 63 cflags_cc += [ "-DNONLS" ] 64 } 65 66 if (platform == "mac") { 67 deps += [ "//base/global/resource_management/frameworks/resmgr:global_resmgr_mac" ] 68 } 69 70 if (platform == "linux") { 71 deps += [ "//base/global/resource_management/frameworks/resmgr:global_resmgr_linux" ] 72 } 73 } 74 } 75} 76 77foreach(item, ace_platforms) { 78 platform = item.name 79 if (platform == "windows" || platform == "mac" || platform == "linux") { 80 preview_entrance_source("ace_preview_entrance_" + item.name) { 81 platform = item.name 82 defines = [] 83 cflags_cc = [] 84 config = { 85 } 86 87 if (defined(item.config)) { 88 config = item.config 89 } 90 91 if (defined(config.defines)) { 92 defines = config.defines 93 } 94 95 if (defined(config.cflags_cc)) { 96 cflags_cc = config.cflags_cc 97 } 98 } 99 } 100} 101