• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2023-2025 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  visibility = [ ":*" ]
19  include_dirs = [
20    "$ace_root/interfaces/inner_api",
21    "$ace_root/interfaces/inner_api/drawable_descriptor",
22  ]
23  if (current_os != "ohos") {
24    include_dirs += [
25      "//base/global/resource_management/frameworks/resmgr/include",
26      "//base/global/resource_management/interfaces/inner_api/include",
27    ]
28  }
29}
30
31if (is_arkui_x) {
32  import("//foundation/graphic/graphic_2d/graphic_config.gni")
33  import("//foundation/multimedia/image_framework/ide/image_decode_config.gni")
34  import("//plugins/drawable_descriptor/drawable_descriptor.gni")
35  ohos_source_set("native_drawabledescriptor_static") {
36    configs = [
37      "$ace_root:ace_config",
38      "$ace_root:ace_coverage_config",
39    ]
40    cflags_cc = [
41      "-std=c++17",
42      "-fno-rtti",
43    ]
44    include_dirs = [
45      "${ace_root}/interfaces/napi/kits/utils",
46      "${ace_root}/interfaces/inner_api/drawable_descriptor",
47      "${ace_root}/interfaces/napi/kits/drawabledescriptor",
48      "${graphic_2d_path}/utils/color_manager/export",
49      "${ace_root}/frameworks/core/interfaces/native/svg",
50    ]
51
52    include_dirs += drawable_native_include
53
54    sources = [
55      "drawable_descriptor.cpp",
56      "js_drawable_descriptor.cpp",
57    ]
58    if (use_clang_android) {
59      defines = image_decode_android_defines
60    }
61    if (use_clang_ios) {
62      defines = image_decode_ios_defines
63    }
64    if (ace_enable_gpu) {
65      defines += [ "RS_ENABLE_GPU" ]
66    }
67    if (ace_engine_feature_enable_upgrade_skia) {
68      defines += [ "USE_M133_SKIA" ]
69    }
70  }
71} else {
72  ohos_shared_library("drawable_descriptor") {
73    if (current_os == "ohos") {
74      sanitize = {
75        integer_overflow = true
76        boundary_sanitize = true
77        debug = ace_sanitize_debug
78      }
79    }
80    public_configs = [ ":drawable_config" ]
81    branch_protector_ret = "pac_ret"
82
83    configs = [ "$ace_root:ace_config" ]
84
85    sources = [
86      "base/source_info.cpp",
87      "core/pixelmap_drawable_descriptor.cpp",
88      "drawable_descriptor.cpp",
89      "loader/file_image_loader.cpp",
90      "loader/image_loader.cpp",
91      "loader/resource_image_loader.cpp",
92      "new_js_drawable_descriptor.cpp",
93      "utils/napi_utils.cpp",
94      "utils/resource_manager.cpp",
95    ]
96
97    external_deps = [
98      "bounds_checking_function:libsec_shared",
99      "cJSON:cjson",
100      "graphic_2d:2d_graphics",
101      "graphic_2d:librender_service_base",
102      "graphic_2d:librender_service_client",
103      "hilog:libhilog",
104      "napi:ace_napi",
105    ]
106
107    defines = []
108    if (current_os == "ohos") {
109      sources += [
110        "adapter/ohos/file_uri_utils_impl.cpp",
111        "adapter/ohos/image_data_impl.cpp",
112        "adapter/ohos/pixel_map_impl.cpp",
113        "adapter/ohos/resource_adapter_impl.cpp",
114        "adapter/ohos/task_pool_impl.cpp",
115      ]
116      external_deps += [
117        "ability_base:zuri",
118        "ability_runtime:app_context",
119        "app_file_service:fileuri_native",
120        "ffrt:libffrt",
121        "image_framework:image",
122        "image_framework:image_native",
123        "resource_management:global_resmgr",
124      ]
125    } else {
126      defines += [ "PREVIEW" ]
127
128      sources += [
129        "adapter/preview/file_uri_utils_preview.cpp",
130        "adapter/preview/image_data_preview.cpp",
131        "adapter/preview/pixel_map_preview.cpp",
132        "adapter/preview/resource_adapter_preview.cpp",
133        "adapter/preview/task_pool_preview.cpp",
134      ]
135      if (use_mingw_win) {
136        defines += [ "WINDOWS_PLATFORM" ]
137        external_deps += [ "resource_management:win_resmgr" ]
138      }
139
140      if (use_mac) {
141        defines += [ "MAC_PLATFORM" ]
142        external_deps += [ "resource_management:mac_resmgr" ]
143      }
144
145      if (use_linux) {
146        defines += [ "LINUX_PLATFORM" ]
147        external_deps += [ "resource_management:linux_resmgr" ]
148      }
149    }
150
151    cflags = [ "-Wno-inconsistent-dllimport" ]
152    subsystem_name = ace_engine_subsystem
153    innerapi_tags = [ "platformsdk" ]
154    part_name = ace_engine_part
155  }
156}
157