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("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
15import("//build/ohos.gni")
16SUBSYSTEM_DIR = "../../.."
17config("call_manager_js_config") {
18  include_dirs = [ "napi/include" ]
19}
20
21jspath = "napi/src/call.js"
22
23# compile .js to .abc.
24action("gen_call_abc") {
25  visibility = [ ":*" ]
26  script = "../../../../../arkcompiler/ets_frontend/es2panda/scripts/generate_js_bytecode.py"
27
28  args = [
29    "--src-js",
30    rebase_path(jspath),
31    "--dst-file",
32    rebase_path(target_out_dir + "/call.abc"),
33    "--frontend-tool-path",
34    rebase_path("${es2abc_build_path}"),
35    "--module",
36  ]
37  deps = [ "../../../../../arkcompiler/ets_frontend/es2panda:es2panda_build" ]
38  inputs = [ jspath ]
39  outputs = [ target_out_dir + "/call.abc" ]
40}
41
42base_output_path = get_label_info(":call_js", "target_out_dir")
43call_obj_path = base_output_path + "/call.o"
44gen_js_obj("call_js") {
45  input = jspath
46  output = call_obj_path
47  dep = ":gen_call_abc"
48}
49
50abc_output_path = get_label_info(":call_abc", "target_out_dir")
51call_abc_obj_path = abc_output_path + "/call_abc.o"
52gen_js_obj("call_abc") {
53  input = "$target_out_dir/call.abc"
54  output = call_abc_obj_path
55  dep = ":gen_call_abc"
56}
57
58ohos_shared_library("call") {
59  sanitize = {
60    cfi = false  # napi target, not required to enable cfi
61    cfi_cross_dso = false
62    debug = false
63  }
64  branch_protector_ret = "pac_ret"
65  sources = [
66    "napi/src/napi_call_ability_callback.cpp",
67    "napi/src/napi_call_manager.cpp",
68    "napi/src/napi_call_manager_callback.cpp",
69    "napi/src/napi_call_manager_utils.cpp",
70    "napi/src/native_module.cpp",
71  ]
72
73  public_configs = [ ":call_manager_js_config" ]
74
75  deps = [
76    ":call_abc",
77    ":call_js",
78    "$SUBSYSTEM_DIR/call_manager/frameworks/native:tel_call_manager_api",
79  ]
80
81  external_deps = [
82    "ability_base:base",
83    "ability_base:want",
84    "ability_runtime:ability_manager",
85    "c_utils:utils",
86    "core_service:libtel_common",
87    "core_service:tel_core_service_api",
88    "hilog:libhilog",
89    "image_framework:image",
90    "image_framework:image_native",
91    "init:libbegetutil",
92    "libuv:uv",
93    "napi:ace_napi",
94  ]
95
96  cflags_cc = [
97    "-Wunused",
98    "-Wunreachable-code",
99    "-fno-exceptions",
100    "-fno-rtti",
101    "-fstack-protector-all",
102    "-Os",
103    "-flto",
104    "-Wno-unused-but-set-variable",
105    "-fdata-sections",
106    "-ffunction-sections",
107    "-fno-asynchronous-unwind-tables",
108    "-fno-unwind-tables",
109  ]
110
111  ldflags = [
112    "-flto",
113    "-Wl,--gc-sections",
114  ]
115
116  defines = [
117    "TELEPHONY_LOG_TAG = \"CallManagerJsApi\"",
118    "LOG_DOMAIN = 0xD001F10",
119  ]
120
121  part_name = "call_manager"
122  subsystem_name = "telephony"
123  relative_install_dir = "module/telephony"
124}
125