1# Copyright (c) 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("napi_dragcontroller_static") {
18  forward_variables_from(invoker, "*")
19
20  ohos_source_set(target_name) {
21    defines += invoker.defines
22    defines += [ "USE_ARK_ENGINE" ]
23    cflags_cc += invoker.cflags_cc
24    configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ]
25
26    sources = [ "js_drag_controller.cpp" ]
27    deps = [ "../utils:napi_utils_static_${platform}" ]
28    external_deps = []
29    if (defined(config.libace_target)) {
30      deps += [ config.libace_target ]
31    }
32
33    if (platform != "" && is_arkui_x) {
34      deps += [ "$crossplatform_plugin_root/libs/napi:napi_$platform" ]
35    } else {
36      external_deps += [
37        "ets_runtime:libark_jsruntime",
38        "napi:ace_napi",
39      ]
40    }
41    if (use_hilog) {
42      external_deps += [ "hilog:libhilog" ]
43    }
44    if (is_arkui_x) {
45      if (defined(config.pixel_map_support) && config.pixel_map_support) {
46        configs += [ "$crossplatform_multimedia_root/image_framework/interfaces/innerkits:image_external_config" ]
47      }
48    } else {
49      if (defined(config.pixel_map_support)) {
50        external_deps += [
51          "image_framework:image",
52          "image_framework:image_native",
53        ]
54      }
55    }
56
57    if (!is_arkui_x && defined(config.enable_drag_framework) &&
58        config.enable_drag_framework) {
59      external_deps += [
60        "device_status:devicestatus_client",
61        "graphic_2d:librender_service_client",
62      ]
63    }
64
65    if (defined(config.enable_drag_framework) && config.enable_drag_framework) {
66      if (defined(global_parts_info.distributeddatamgr_udmf)) {
67        external_deps += [ "udmf:udmf_client" ]
68        external_deps += [ "udmf:udmf_data_napi" ]
69        external_deps += [ "napi:ace_container_scope" ]
70      }
71      external_deps += [ "kv_store:distributeddata_inner" ]
72    }
73
74    subsystem_name = ace_engine_subsystem
75    part_name = ace_engine_part
76  }
77}
78
79foreach(item, ace_platforms) {
80  napi_dragcontroller_static("dragcontroller_static_" + item.name) {
81    defines = []
82    cflags_cc = []
83    config = {
84    }
85    platform = item.name
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