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
17config("drawable_config") {
18  include_dirs = [
19    "$ace_root/interfaces/inner_api",
20    "${ace_root}/interfaces/inner_api/drawable_descriptor",
21  ]
22  if (current_os != "ohos") {
23    include_dirs += [
24      "//base/global/resource_management/frameworks/resmgr/include",
25      "//base/global/resource_management/interfaces/inner_api/include",
26    ]
27  }
28}
29if (is_arkui_x) {
30  import("//foundation/graphic/graphic_2d/graphic_config.gni")
31  import("//foundation/multimedia/image_framework/ide/image_decode_config.gni")
32  import("//plugins/drawable_descriptor/drawable_descriptor.gni")
33  ohos_source_set("native_drawabledescriptor_static") {
34    configs = [
35      "$ace_root:ace_config",
36      "$ace_root:ace_coverage_config",
37    ]
38    cflags_cc = [
39      "-std=c++17",
40      "-fno-rtti",
41    ]
42    include_dirs = [
43      "${ace_root}/interfaces/napi/kits/utils",
44      "${ace_root}/interfaces/inner_api/drawable_descriptor",
45      "${ace_root}/interfaces/napi/kits/drawabledescriptor",
46      "${graphic_2d_path}/utils/color_manager/export",
47      "${ace_root}/frameworks/core/interfaces/native/svg",
48    ]
49
50    include_dirs += drawable_native_include
51
52    sources = [
53      "drawable_descriptor.cpp",
54      "image_converter.cpp",
55      "js_drawable_descriptor.cpp",
56    ]
57    if (use_clang_android) {
58      defines = image_decode_android_defines
59    }
60    if (use_clang_ios) {
61      defines = image_decode_ios_defines
62    }
63    if (ace_enable_gpu) {
64      defines += [ "RS_ENABLE_GPU" ]
65    }
66  }
67} else {
68  ohos_shared_library("drawable_descriptor") {
69    if (current_os == "ohos") {
70      sanitize = {
71        integer_overflow = true
72        boundary_sanitize = true
73        debug = ace_sanitize_debug
74      }
75    }
76    public_configs = [ ":drawable_config" ]
77    branch_protector_ret = "pac_ret"
78
79    configs = [
80      "$ace_root:ace_config",
81      "$ace_root:ace_coverage_config",
82    ]
83
84    sources = [
85      "drawable_descriptor.cpp",
86      "image_converter.cpp",
87      "js_drawable_descriptor.cpp",
88    ]
89
90    defines = []
91    external_deps = [
92      "cJSON:cjson",
93      "graphic_2d:librender_service_client",
94      "hilog:libhilog",
95      "napi:ace_napi",
96    ]
97
98    if (current_os == "ohos") {
99      external_deps += [
100        "graphic_2d:2d_graphics",
101        "image_framework:image",
102        "resource_management:global_resmgr",
103      ]
104      public_external_deps = [
105        "graphic_2d:color_manager",
106        "image_framework:image_native",
107      ]
108    } else {
109      defines += [ "PREVIEW" ]
110      if (use_mingw_win) {
111        defines += [ "WINDOWS_PLATFORM" ]
112        external_deps += [ "resource_management:win_resmgr" ]
113      }
114
115      if (use_mac) {
116        defines += [ "MAC_PLATFORM" ]
117        external_deps += [ "resource_management:mac_resmgr" ]
118      }
119
120      if (use_linux) {
121        defines += [ "LINUX_PLATFORM" ]
122        external_deps += [ "resource_management:linux_resmgr" ]
123      }
124    }
125
126    subsystem_name = ace_engine_subsystem
127    innerapi_tags = [ "platformsdk" ]
128    part_name = ace_engine_part
129  }
130}
131