1# Copyright (c) 2021-2022 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  ohos_ndk_headers("ace_header") {
19    dest_dir = "$ndk_headers_out_dir/ace/xcomponent/"
20    sources = [
21      "native_interface_xcomponent.h",
22      "native_xcomponent_key_event.h",
23    ]
24  }
25
26  ohos_ndk_library("libace_ndk_rom") {
27    ndk_description_file = "./libace.ndk.json"
28    min_compact_version = "7"
29    output_name = "ace_ndk"
30  }
31}
32
33config("ace_ndk_public_configs") {
34  include_dirs = [ "$ace_root/interfaces" ]
35}
36
37ohos_shared_library("ace_ndk") {
38  if (current_os == "ohos") {
39    sanitize = {
40      integer_overflow = true
41      boundary_sanitize = true
42      debug = ace_sanitize_debug
43    }
44  }
45  include_dirs = [
46    "//foundation/arkui/ace_engine",
47    "//foundation/arkui/ace_engine/frameworks",
48    "//foundation/arkui/ace_engine/interfaces/native",
49  ]
50
51  public_configs = [ ":ace_ndk_public_configs" ]
52
53  sources = [
54    "//foundation/arkui/ace_engine/frameworks/core/accessibility/native_interface_accessibility_impl.cpp",
55    "//foundation/arkui/ace_engine/frameworks/core/accessibility/native_interface_accessibility_provider.cpp",
56    "//foundation/arkui/ace_engine/frameworks/core/components/common/properties/color.cpp",
57    "//foundation/arkui/ace_engine/frameworks/core/components/xcomponent/native_interface_xcomponent_impl.cpp",
58    "//foundation/arkui/ace_engine/frameworks/core/components_v2/inspector/inspector_constants.cpp",
59    "event/drag_and_drop_impl.cpp",
60    "event/key_event_impl.cpp",
61    "event/ui_input_event.cpp",
62    "native_interface_accessibility.cpp",
63    "native_interface_xcomponent.cpp",
64    "native_styled_string_descriptor.cpp",
65    "node/animate_impl.cpp",
66    "node/dialog_model.cpp",
67    "node/drawable_descriptor.cpp",
68    "node/event_converter.cpp",
69    "node/frame_information.cpp",
70    "node/gesture_impl.cpp",
71    "node/list_option.cpp",
72    "node/native_drawable_descriptor.cpp",
73    "node/native_impl.cpp",
74    "node/native_node_extented.cpp",
75    "node/native_node_napi.cpp",
76    "node/node_adapter_impl.cpp",
77    "node/node_animate.cpp",
78    "node/node_extened.cpp",
79    "node/node_model.cpp",
80    "node/node_node_relative_container.cpp",
81    "node/node_transition.cpp",
82    "node/node_transition_imp.cpp",
83    "node/node_utils.cpp",
84    "node/style_modifier.cpp",
85    "node/waterflow_section_option.cpp",
86  ]
87  external_deps = [ "bounds_checking_function:libsec_shared" ]
88  deps = []
89  cflags_cc = [ "-Wno-missing-braces" ]
90
91  if (target_os == "ohos") {
92    defines = [
93      "OHOS_PLATFORM",
94      "USE_HILOG",
95    ]
96    sources += [ "$ace_root/adapter/ohos/osal/log_wrapper.cpp" ]
97    deps += [
98      ":libace_ndk_rom",
99      "$ace_root/interfaces/inner_api/drawable_descriptor:drawable_descriptor",
100    ]
101    external_deps += [
102      "graphic_2d:native_drawing_ndk",
103      "hilog:libhilog",
104      "image_framework:pixelmap",
105      "napi:ace_napi",
106      "udmf:udmf_client",
107    ]
108    version_script =
109        get_label_info(":libace_ndk_rom", "target_gen_dir") + "/" +
110        get_label_info(":libace_ndk_rom", "name") + version_script_suffix
111  } else if (target_os == "android") {
112    sources += [ "$ace_root/adapter/android/osal/log_wrapper.cpp" ]
113    libs = [ "log" ]
114  }
115
116  subsystem_name = ace_engine_subsystem
117  part_name = ace_engine_part
118}
119
120if (is_arkui_x) {
121  ohos_source_set("ace_static_ndk") {
122    include_dirs = [
123      "$ace_root",
124      "$ace_root/frameworks",
125      "$ace_root/interfaces/native",
126    ]
127
128    sources = [
129      "$ace_root/frameworks/core/components/xcomponent/native_interface_xcomponent_impl.cpp",
130      "native_interface_xcomponent.cpp",
131    ]
132
133    deps = [ "//third_party/bounds_checking_function:libsec_static" ]
134
135    cflags_cc = [ "-Wno-missing-braces" ]
136
137    print("ace_static_ndk build.")
138    subsystem_name = ace_engine_subsystem
139    part_name = ace_engine_part
140  }
141}
142
143group("ace_packages_ndk") {
144  deps = [ ":ace_ndk" ]
145}
146