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") 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 || target_os == "ios") { 26 objcopy_tool = objcopy_clang 27 script = "$ace_root/build/tools/build_resource_to_bytecode.py" 28 } else if (use_linux) { 29 objcopy_tool = objcopy_x86_64 30 script = "$ace_root/build/tools/build_resource_to_bytecode.py" 31 } else if (target_cpu == "x86_64") { 32 objcopy_tool = objcopy_x86_64 33 script = "$ace_root/build/tools/run_objcopy.py" 34 } else { 35 objcopy_tool = objcopy_default 36 script = "$ace_root/build/tools/run_objcopy.py" 37 } 38 39 args = [ 40 "--objcopy", 41 rebase_path(objcopy_tool), 42 "--input", 43 rebase_path(invoker.input), 44 "--output", 45 rebase_path(invoker.output), 46 "--arch", 47 current_cpu, 48 ] 49 50 deps = [] 51 deps += invoker.snapshot_dep 52 53 inputs = [ invoker.input ] 54 outputs = [ invoker.output ] 55 } 56 57 source_set("gen_obj_src_" + name) { 58 sources = [ invoker.output ] 59 deps = [ ":gen_obj_" + name ] 60 } 61} 62