1# Copyright (c) 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")
15
16config("cj_web_public_config") {
17  visibility = [ ":*" ]
18  include_dirs = [
19    "include",
20    "$target_gen_dir/../napi/protos",
21    "../../native",
22  ]
23}
24
25ohos_shared_library("cj_webview_ffi") {
26  branch_protector_ret = "pac_ret"
27  branch_protector_frt = "bti"
28
29  public_configs = [ ":cj_web_public_config" ]
30
31  if (!defined(defines)) {
32    defines = []
33  }
34
35  if (product_name != "ohos-sdk") {
36    sources = [
37      "$target_gen_dir/../napi/protos/web_download.pb.cc",
38      "$target_gen_dir/../napi/protos/web_download.pb.h",
39      "src/geolocation_permission.cpp",
40      "src/web_cookie_manager.cpp",
41      "src/web_data_base.cpp",
42      "src/web_download_delegate_impl.cpp",
43      "src/web_download_item_impl.cpp",
44      "src/web_download_manager_impl.cpp",
45      "src/web_storage.cpp",
46      "src/webview_controller_impl.cpp",
47      "src/webview_ffi.cpp",
48      "src/webview_function.cpp",
49      "src/webview_hasimage_callback.cpp",
50      "src/webview_javascript_execute_callback.cpp",
51      "src/webview_javascript_result_callback.cpp",
52      "src/webview_message_ffi.cpp",
53      "src/webview_utils.cpp",
54    ]
55
56    deps = [
57      "../../../ohos_adapter:nweb_ohos_adapter",
58      "../../../ohos_nweb:libnweb",
59      "../../native:ohweb",
60      "../napi/protos:proto_gen",
61    ]
62
63    external_deps = [
64      "ability_runtime:app_context",
65      "bundle_framework:appexecfwk_core",
66      "c_utils:utils",
67      "common_event_service:cesfwk_innerkits",
68      "hilog:libhilog",
69      "image_framework:cj_image_ffi",
70      "image_framework:image",
71      "image_framework:image_native",
72      "init:libbegetutil",
73      "napi:ace_napi",
74      "napi:cj_bind_ffi",
75      "napi:cj_bind_native",
76      "protobuf:protobuf_lite",
77    ]
78  } else {
79    defines += [ "PREVIEWER" ]
80    sources = [ "src/webview_mock.cpp" ]
81    external_deps = [ "napi:cj_bind_ffi" ]
82  }
83
84  if (current_os == "ohos") {
85    defines += [ "OHOS_PLATFORM" ]
86  }
87
88  if (current_os == "mingw") {
89    defines += [ "WINDOWS_PLATFORM" ]
90  }
91  innerapi_tags = [ "platformsdk" ]
92  part_name = "webview"
93  subsystem_name = "web"
94}
95