• 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  }
68} else {
69  ohos_shared_library("drawable_descriptor") {
70    if (current_os == "ohos") {
71      sanitize = {
72        integer_overflow = true
73        boundary_sanitize = true
74        debug = ace_sanitize_debug
75      }
76    }
77    public_configs = [ ":drawable_config" ]
78    branch_protector_ret = "pac_ret"
79
80    configs = [ "$ace_root:ace_config" ]
81
82    sources = [
83      "base/source_info.cpp",
84      "core/pixelmap_drawable_descriptor.cpp",
85      "drawable_descriptor.cpp",
86      "loader/file_image_loader.cpp",
87      "loader/image_loader.cpp",
88      "loader/resource_image_loader.cpp",
89      "new_js_drawable_descriptor.cpp",
90      "utils/napi_utils.cpp",
91      "utils/resource_manager.cpp",
92    ]
93
94    external_deps = [
95      "bounds_checking_function:libsec_shared",
96      "cJSON:cjson",
97      "graphic_2d:2d_graphics",
98      "graphic_2d:librender_service_base",
99      "graphic_2d:librender_service_client",
100      "hilog:libhilog",
101      "napi:ace_napi",
102    ]
103
104    defines = []
105    if (current_os == "ohos") {
106      sources += [
107        "adapter/ohos/file_uri_utils_impl.cpp",
108        "adapter/ohos/image_data_impl.cpp",
109        "adapter/ohos/pixel_map_impl.cpp",
110        "adapter/ohos/resource_adapter_impl.cpp",
111        "adapter/ohos/task_pool_impl.cpp",
112      ]
113      external_deps += [
114        "ability_base:zuri",
115        "ability_runtime:app_context",
116        "app_file_service:fileuri_native",
117        "ffrt:libffrt",
118        "image_framework:image",
119        "image_framework:image_native",
120        "resource_management:global_resmgr",
121      ]
122    } else {
123      defines += [ "PREVIEW" ]
124
125      sources += [
126        "adapter/preview/file_uri_utils_preview.cpp",
127        "adapter/preview/image_data_preview.cpp",
128        "adapter/preview/pixel_map_preview.cpp",
129        "adapter/preview/resource_adapter_preview.cpp",
130        "adapter/preview/task_pool_preview.cpp",
131      ]
132      if (use_mingw_win) {
133        defines += [ "WINDOWS_PLATFORM" ]
134        external_deps += [ "resource_management:win_resmgr" ]
135      }
136
137      if (use_mac) {
138        defines += [ "MAC_PLATFORM" ]
139        external_deps += [ "resource_management:mac_resmgr" ]
140      }
141
142      if (use_linux) {
143        defines += [ "LINUX_PLATFORM" ]
144        external_deps += [ "resource_management:linux_resmgr" ]
145      }
146    }
147
148    cflags = [ "-Wno-inconsistent-dllimport" ]
149    subsystem_name = ace_engine_subsystem
150    innerapi_tags = [ "platformsdk" ]
151    part_name = ace_engine_part
152  }
153}
154