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/ace/ace_engine/ace_config.gni") 16 17template("gen_obj") { 18 name = target_name 19 action("gen_obj_" + name) { 20 visibility = [ ":*" ] # Only targets in this file can depend on this. 21 22 if (use_mingw_win) { 23 objcopy_tool = objcopy_mingw 24 script = "$ace_root/build/tools/build_resource_to_bytecode.py" 25 } else if (use_mac) { 26 objcopy_tool = objcopy_clang 27 script = "$ace_root/build/tools/build_resource_to_bytecode.py" 28 } else if (target_cpu == "x86_64") { 29 objcopy_tool = objcopy_x86_64 30 script = "$flutter_root/engine/flutter/sky/tools/objcopy.py" 31 } else { 32 objcopy_tool = objcopy_default 33 script = "$flutter_root/engine/flutter/sky/tools/objcopy.py" 34 } 35 36 args = [ 37 "--objcopy", 38 rebase_path(objcopy_tool), 39 "--input", 40 rebase_path(invoker.input), 41 "--output", 42 rebase_path(invoker.output), 43 "--arch", 44 current_cpu, 45 ] 46 47 deps = [] 48 deps += invoker.snapshot_dep 49 50 inputs = [ invoker.input ] 51 outputs = [ invoker.output ] 52 } 53 54 source_set("gen_obj_src_" + name) { 55 sources = [ invoker.output ] 56 deps = [ ":gen_obj_" + name ] 57 } 58} 59