1# Copyright (c) 2023-2024 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
17if (is_arkui_x) {
18  import("//plugins/drawable_descriptor/drawable_descriptor.gni")
19  template("napi_drawabledescriptor_static") {
20    forward_variables_from(invoker, "*")
21
22    ohos_source_set(target_name) {
23      defines += invoker.defines
24      cflags_cc += invoker.cflags_cc
25
26      public_configs = [ "$ace_root:ace_config" ]
27      include_dirs = drawable_napi_include
28
29      sources = [ "drawable_register.cpp" ]
30      if (platform != "" && is_arkui_x) {
31        deps = [ "//plugins/libs/napi:napi_$platform" ]
32      }
33      subsystem_name = "arkui"
34      part_name = ace_engine_part
35    }
36  }
37
38  foreach(item, ace_platforms) {
39    napi_drawabledescriptor_static("drawabledescriptor_static_" + item.name) {
40      defines = []
41      cflags_cc = []
42      platform = item.name
43      config = {
44      }
45
46      if (defined(item.config)) {
47        config = item.config
48      }
49
50      if (defined(config.defines)) {
51        defines = config.defines
52      }
53
54      if (defined(config.cflags_cc)) {
55        cflags_cc = config.cflags_cc
56      }
57    }
58  }
59} else {
60  ohos_shared_library("drawabledescriptor") {
61    configs = [ "$ace_root:ace_config" ]
62
63    sources = [ "drawable_register.cpp" ]
64
65    deps = [
66      "$ace_root/interfaces/inner_api/drawable_descriptor:drawable_descriptor",
67    ]
68
69    external_deps = [
70      "graphic_2d:librender_service_client",
71      "hilog:libhilog",
72      "napi:ace_napi",
73    ]
74
75    if (current_os == "ohos") {
76      external_deps += [
77        "graphic_2d:2d_graphics",
78        "image_framework:image",
79        "image_framework:image_native",
80      ]
81    } else {
82      defines = [ "PREVIEW" ]
83    }
84
85    relative_install_dir = "module/arkui"
86    subsystem_name = ace_engine_subsystem
87    part_name = ace_engine_part
88  }
89}
90