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    "../../native",
21  ]
22}
23
24ohos_shared_library("cj_webview_ffi") {
25  branch_protector_ret = "pac_ret"
26  branch_protector_frt = "bti"
27
28  public_configs = [ ":cj_web_public_config" ]
29
30  if (!defined(defines)) {
31    defines = []
32  }
33
34  if (product_name != "ohos-sdk") {
35    sources = [
36      "src/web_cookie_manager.cpp",
37      "src/webview_controller_impl.cpp",
38      "src/webview_ffi.cpp",
39      "src/webview_javascript_execute_callback.cpp",
40      "src/webview_javascript_result_callback.cpp",
41      "src/webview_utils.cpp",
42    ]
43
44    deps = [
45      "../../../ohos_adapter:nweb_ohos_adapter",
46      "../../../ohos_nweb:libnweb",
47      "../../native:ohweb",
48    ]
49
50    external_deps = [
51      "ability_runtime:app_context",
52      "bundle_framework:appexecfwk_core",
53      "c_utils:utils",
54      "common_event_service:cesfwk_innerkits",
55      "hilog:libhilog",
56      "image_framework:cj_image_ffi",
57      "image_framework:image",
58      "image_framework:image_native",
59      "init:libbegetutil",
60      "napi:ace_napi",
61      "napi:cj_bind_ffi",
62      "napi:cj_bind_native",
63    ]
64  } else {
65    defines += [ "PREVIEWER" ]
66    sources = [ "src/webview_mock.cpp" ]
67    external_deps = [ "napi:cj_bind_ffi" ]
68  }
69
70  if (current_os == "ohos") {
71    defines += [ "OHOS_PLATFORM" ]
72  }
73
74  if (current_os == "mingw") {
75    defines += [ "WINDOWS_PLATFORM" ]
76  }
77  innerapi_tags = [ "platformsdk" ]
78  part_name = "webview"
79  subsystem_name = "web"
80}
81