1# 2# Copyright (c) 2020 Huawei Device Co., Ltd. 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14# 15 16# Defines a subsystem 17# 18# The lite_subsystem template defines all the modules contained in a subsystem 19# 20# Parameters 21# 22# subsystem_components (required) 23# [list of scopes] Defines all modules in the subsystem. 24# 25template("lite_subsystem") { 26 assert(defined(invoker.subsystem_components), 27 "subsystem_components in required.") 28 29 lite_subsystem_components = invoker.subsystem_components 30 31 group(target_name) { 32 deps = [] 33 if (defined(invoker.deps)) { 34 deps += invoker.deps 35 } 36 37 # add subsystem packages 38 foreach(pkg_label, lite_subsystem_components) { 39 deps += [ pkg_label ] 40 } 41 } 42} 43 44template("lite_subsystem_test") { 45 assert(defined(invoker.subsystem_components), 46 "subsystem_components in required.") 47 48 lite_subsystem_components = invoker.subsystem_components 49 50 group(target_name) { 51 deps = [] 52 if (defined(invoker.deps)) { 53 deps += invoker.deps 54 } 55 56 # add subsystem packages 57 foreach(pkg_label, lite_subsystem_components) { 58 deps += [ pkg_label ] 59 } 60 } 61} 62 63template("lite_subsystem_sdk") { 64 assert(defined(invoker.interface_header), "interface_header in required.") 65 assert(defined(invoker.sdk_libs_path), "sdk_libs_path in required.") 66 assert(defined(invoker.subsystem_name), "subsystem_name in required.") 67 68 interface_header = invoker.interface_header 69 sdk_libs_path = invoker.sdk_libs_path 70 subsystem_name = invoker.subsystem_name 71 deps = [ ":${subsystem_name}" ] 72 73 outdir = rebase_path("$root_out_dir/${subsystem_name}") 74 prebuilts = "mkdir -p $outdir/interface $outdir/sdk_libs" 75 command = "cp -r $interface_header $outdir/interface && cp -r $sdk_libs_path $outdir/sdk_libs" 76 exec_path = rebase_path(".", root_build_dir) 77 action(target_name) { 78 args = [ 79 "--path=$exec_path", 80 "--prebuilts=$prebuilts", 81 "--command=$command", 82 "--enable=$LOSCFG_SDK_BUILD", 83 ] 84 script = "//build/lite/build_ext_components.py" 85 outputs = [ "$target_out_dir/sdk_build_file_log.txt" ] 86 } 87} 88 89template("lite_vendor_sdk") { 90 prebuilts = invoker.prebuilts 91 command = invoker.command 92 exec_path = rebase_path(".", root_build_dir) 93 action(target_name) { 94 args = [ 95 "--path=$exec_path", 96 "--prebuilts=$prebuilts", 97 "--command=$command", 98 "--enable=$LOSCFG_SDK_BUILD", 99 ] 100 script = "//build/lite/build_ext_components.py" 101 outputs = [ "$target_out_dir/sdk_build_file_log.txt" ] 102 } 103} 104