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("//build/ohos.gni")
15import("//build/templates/abc/ohos_abc.gni")
16import("//foundation/arkui/ace_engine/build/ace_gen_obj.gni")
17
18template("gen_js_src_binary") {
19  es2abc_gen_abc("gen_abc_" + target_name) {
20    src_js = rebase_path(invoker.js_source)
21    dst_file = rebase_path(target_out_dir + "/" +
22                           get_path_info(invoker.js_source, "name") + ".abc")
23    in_puts = [ invoker.js_source ]
24    out_puts = [ target_out_dir + "/" +
25                 get_path_info(invoker.js_source, "name") + ".abc" ]
26    extra_args = [ "--module" ]
27  }
28
29  gen_obj(target_name + "_js") {
30    input = invoker.js_source
31
32    if (is_mac || is_mingw) {
33      output = target_out_dir + "/" + invoker.target_name + "_js.c"
34    } else {
35      output = target_out_dir + "/" + invoker.target_name + "_js.o"
36    }
37
38    snapshot_dep = []
39  }
40
41  gen_obj(target_name + "_abc") {
42    input =
43        get_label_info(":gen_abc_" + invoker.target_name, "target_out_dir") +
44        "/" + get_path_info(invoker.js_source, "name") + ".abc"
45
46    if (is_mac || is_mingw) {
47      output = target_out_dir + "/" + invoker.target_name + "_abc.c"
48    } else {
49      output = target_out_dir + "/" + invoker.target_name + "_abc.o"
50    }
51
52    snapshot_dep = [ ":gen_abc_" + invoker.target_name ]
53  }
54}
55
56gen_js_src_binary("window_stage") {
57  js_source = "../../interfaces/kits/napi/window_runtime/window_stage_napi/window_stage.js"
58}
59
60ohos_shared_library("windowstage") {
61  if (is_mingw) {
62    defines = [ "WINDOWS_PLATFORM" ]
63  } else {
64    defines = [ "MAC_PLATFORM" ]
65  }
66
67  sources = [ "../../interfaces/kits/napi/window_runtime/window_stage_napi/window_stage_module.cpp" ]
68
69  deps = [
70    ":gen_obj_src_window_stage_abc",
71    ":gen_obj_src_window_stage_js",
72  ]
73  external_deps = [ "napi:ace_napi" ]
74
75  part_name = "window_manager"
76  subsystem_name = "window"
77}
78