• 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/config/clang/clang.gni")
15import("//build/config/python.gni")
16import("//build/templates/common/copy.gni")
17
18template("js_declaration") {
19  group(target_name) {
20    not_needed(invoker, "*")
21  }
22}
23
24template("gen_js_obj") {
25  name = target_name
26  action("gen_js_obj_" + name) {
27    visibility = [ ":*" ]
28
29    objcopy_tool = "${clang_base_path}/bin/llvm-objcopy"
30    platform = "${current_os}_${current_cpu}"
31    if (platform == "mingw_x86_64") {
32      script =
33          "//third_party/flutter/engine/flutter/sky/tools/objcopy_pc_mac.py"
34    } else if (platform == "mac_x64") {
35      script =
36          "//third_party/flutter/engine/flutter/sky/tools/objcopy_pc_mac.py"
37    } else if (platform == "linux_x64") {
38      script =
39          "//third_party/flutter/engine/flutter/sky/tools/objcopy_pc_mac.py"
40    } else if (target_cpu == "x86_64") {
41      script = "//third_party/flutter/engine/flutter/sky/tools/objcopy.py"
42    } else if (target_cpu == "arm" || target_cpu == "arm64") {
43      script = "//third_party/flutter/engine/flutter/sky/tools/objcopy.py"
44    }
45
46    args = [
47      "--objcopy",
48      rebase_path(objcopy_tool),
49      "--input",
50      rebase_path(invoker.input),
51      "--output",
52      rebase_path(invoker.output),
53      "--arch",
54      current_cpu,
55    ]
56
57    deps = []
58    if (defined(invoker.dep)) {
59      deps += [ invoker.dep ]
60    }
61
62    inputs = [ invoker.input ]
63    outputs = [ invoker.output ]
64  }
65
66  source_set(name) {
67    sources = [ invoker.output ]
68    deps = [ ":gen_js_obj_" + name ]
69  }
70}
71