• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 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")
15import("//foundation/arkui/ace_engine/ace_config.gni")
16import("napi_lib.gni")
17
18config("ace_napi_config") {
19  include_dirs = [
20    "$ace_root",
21    "$arkui_root",
22    "$ace_root/frameworks",
23    "$ace_root/interfaces/inner_api/ace_kit/include",
24    "$root_out_dir/arkui",
25    "$root_out_dir/arkui/framework",
26    "//third_party/zlib",
27  ]
28  cflags_cc = []
29  defines = []
30  if (use_mingw_win) {
31    cflags_cc += [ "-std=c++17" ]
32  }
33
34  if (use_linux) {
35    cflags_cc += [ "-std=c++17" ]
36  }
37
38  if (use_hilog) {
39    include_dirs += [ "$hilog_root/interfaces/native/innerkits/include" ]
40    defines += [ "USE_HILOG" ]
41  }
42
43  if (is_mac) {
44    cflags_cc = [ "-O0" ]
45  }
46}
47
48common_targets = []
49foreach(module, common_napi_libs) {
50  if (use_mac) {
51    ace_napi_lib(module) {
52      platform = "mac"
53    }
54  } else if (use_mingw_win) {
55    ace_napi_lib(module) {
56      platform = "windows"
57    }
58  } else if (use_linux) {
59    ace_napi_lib(module) {
60      platform = "linux"
61    }
62  } else if (!is_arkui_x) {
63    ace_napi_lib(module) {
64      # napi libs remain isolate in libace.z.so and asan version
65      if (is_asan) {
66        platform = "ohos"
67      } else {
68        platform = "ohos_ng"
69      }
70    }
71  }
72
73  module_path_names = []
74  module_path_names = string_split(module, "/")
75  prefix_dir = module_path_names[0]
76
77  module_path = prefix_dir
78  if (prefix_dir != module) {
79    module_path = module_path_names[1]
80  }
81
82  module_name = string_replace(module_path, "_", "")
83  common_targets += [ ":$module_name" ]
84}
85
86group("napi_group") {
87  if (use_mac || use_mingw_win || use_linux) {
88    public_deps = common_targets
89  } else {
90    deps = common_targets
91    deps += [
92      "$ace_root/interfaces/napi/kits/drawabledescriptor:drawabledescriptor",
93      "$ace_root/interfaces/napi/kits/plugincomponent:plugincomponent",
94    ]
95  }
96}
97