1# Copyright (c) 2023 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/config/components/ets_frontend/es2abc_config.gni")
15import("//build/ohos.gni")
16import("//build/ohos/ace/ace.gni")
17import("//domains/advertising/advertising/advertising.gni")
18
19es2abc_gen_abc("gen_advertising_abc") {
20  src_js = rebase_path("src/advertising.js")
21  dst_file = rebase_path(target_out_dir + "/advertising.abc")
22  in_puts = [ "src/advertising.js" ]
23  out_puts = [ target_out_dir + "/advertising.abc" ]
24  extra_args = [ "--module" ]
25}
26
27gen_js_obj("advertising_js") {
28  input = "src/advertising.js"
29  output = target_out_dir + "/advertising.o"
30}
31
32gen_js_obj("advertising_abc") {
33  input = get_label_info(":gen_advertising_abc", "target_out_dir") +
34          "/advertising.abc"
35  output = target_out_dir + "/advertising_abc.o"
36  dep = ":gen_advertising_abc"
37}
38
39cflags = []
40
41config("native_module_config") {
42  visibility = [ ":*" ]
43
44  include_dirs = [ "${advertising_common_path}/ipc/include" ]
45
46  if (target_cpu == "arm") {
47    cflags += [ "-DBINDER_IPC_32BIT" ]
48  }
49
50  defines = []
51}
52
53ohos_shared_library("advertising") {
54  branch_protector_ret = "pac_ret"
55
56  include_dirs = [
57    "//domains/advertising/advertising/common/error_code",
58    "//domains/advertising/advertising/common/log/include",
59    "//domains/advertising/advertising/common/utils/include",
60    "//domains/advertising/advertising/common/ipc/include",
61    "//domains/advertising/advertising/common/model/include",
62    "./include",
63  ]
64
65  sanitize = {
66    cfi = true
67    cfi_cross_dso = true
68    debug = false
69    boundary_sanitize = true
70    integer_overflow = true
71    ubsan = true
72  }
73
74  configs = [ ":native_module_config" ]
75
76  sources = [
77    "src/ad_init.cpp",
78    "src/ad_load_napi_common.cpp",
79    "src/ad_load_service.cpp",
80    "src/ad_napi_common_error.cpp",
81    "src/advertising.cpp",
82  ]
83
84  deps = [
85    ":advertising_abc",
86    ":advertising_js",
87    "${advertising_common_path}:advertising_common",
88    "//third_party/libuv:uv_static",
89  ]
90
91  external_deps = [
92    "ability_runtime:ability_connect_callback_stub",
93    "ability_runtime:ability_context_native",
94    "ability_runtime:ability_manager",
95    "ability_runtime:abilitykit_native",
96    "ability_runtime:napi_base_context",
97    "ability_runtime:napi_common",
98    "ace_engine:ace_uicontent",
99    "bundle_framework:appexecfwk_core",
100    "cJSON:cjson",
101    "c_utils:utils",
102    "config_policy:configpolicy_util",
103    "hilog:libhilog",
104    "ipc:ipc_core",
105    "napi:ace_napi",
106  ]
107
108  relative_install_dir = "module"
109  subsystem_name = "advertising"
110  part_name = "advertising"
111}
112
113ohos_prebuilt_etc("ad_service_config_json") {
114  source = "resource/ad_service_config.json"
115  relative_install_dir = "advertising/ads_framework"
116  part_name = "advertising"
117  subsystem_name = "advertising"
118}
119