• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
16webview_root_path = "//base/web/webview"
17native_source_path = rebase_path("$webview_root_path")
18web_dir = "nweb_hap"
19position = exec_script(
20        "$webview_root_path/run_shell_cmd.py",
21        [ "cd $native_source_path; if [ -d $web_dir ]; then echo true; else echo false; fi" ],
22        "value")
23if (!position) {
24  if (target_cpu == "arm64") {
25    web_source = "prebuilts/arm64/NWeb.hap"
26    defines = [ "webview_arm64" ]
27  } else if (target_cpu == "arm") {
28    web_source = "prebuilts/arm/NWeb.hap"
29  }
30} else {
31  if (target_cpu == "arm64") {
32    if (use_musl) {
33      web_source = "../nweb_hap/arm64_musl/NWeb.hap"
34    } else {
35      web_source = "../nweb_hap/arm64/NWeb.hap"
36    }
37    defines = [ "webview_arm64" ]
38  } else if (target_cpu == "x86_64") {
39    web_source = "../nweb_hap/x86_64/NWeb.hap"
40    defines = [ "webview_x86_64" ]
41  }
42}
43
44config("nweb_config") {
45  include_dirs = [
46    "include",
47    "//commonlibrary/c_utils/base/include",
48    "//foundation/window/window_manager/interfaces/innerkits/wm",
49    "//foundation/multimodalinput/input/interfaces/native/innerkits/event/include",
50    "//foundation/graphic/graphic_2d/frameworks/surface/include",
51    "//foundation/graphic/graphic_2d/interfaces/innerkits/surface",
52    "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include",
53  ]
54
55  cflags = [
56    "-Wall",
57    "-Werror",
58    "-g3",
59  ]
60}
61
62config("nweb_public_interface") {
63  include_dirs = [ "//base/web/webview/ohos_nweb/include" ]
64}
65
66ohos_shared_library("libnweb") {
67  configs = [ ":nweb_config" ]
68  public_configs = [ ":nweb_public_interface" ]
69  sources = [
70    "src/nweb_enhance_surface_adapter.cpp",
71    "src/nweb_helper.cpp",
72    "src/nweb_input_event_consumer.cpp",
73    "src/nweb_surface_adapter.cpp",
74    "src/nweb_window_adapter.cpp",
75  ]
76
77  deps = [
78    "//foundation/graphic/graphic_2d/rosen/modules/composer:libcomposer",
79    "//foundation/graphic/graphic_2d/rosen/modules/render_service_client:librender_service_client",
80  ]
81
82  external_deps = [
83    "hiviewdfx_hilog_native:libhilog",
84    "input:libmmi-client",
85  ]
86
87  part_name = "webview"
88  subsystem_name = "web"
89}
90
91ohos_prebuilt_etc("nweb_hap") {
92  source = web_source
93  module_install_dir = "app/com.ohos.nweb"
94  part_name = "webview"
95  subsystem_name = "web"
96}
97