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), "subsystem_components in required.") 27 28 lite_subsystem_components = invoker.subsystem_components 29 30 group(target_name) { 31 deps = [] 32 if(defined(invoker.deps)) { 33 deps += invoker.deps 34 } 35 # add subsystem packages 36 foreach(pkg_label, lite_subsystem_components) { 37 deps += [ pkg_label ] 38 } 39 } 40} 41 42template("lite_subsystem_test") { 43 assert(defined(invoker.subsystem_components), "subsystem_components in required.") 44 45 lite_subsystem_components = invoker.subsystem_components 46 47 group(target_name) { 48 deps = [] 49 if(defined(invoker.deps)) { 50 deps += invoker.deps 51 } 52 # add subsystem packages 53 foreach(pkg_label, lite_subsystem_components) { 54 deps += [ pkg_label ] 55 } 56 } 57} 58 59template("lite_subsystem_sdk") { 60 assert(defined(invoker.interface_header), "interface_header in required.") 61 assert(defined(invoker.sdk_libs_path), "sdk_libs_path in required.") 62 assert(defined(invoker.subsystem_name), "subsystem_name in required.") 63 64 interface_header = invoker.interface_header 65 sdk_libs_path = invoker.sdk_libs_path 66 subsystem_name = invoker.subsystem_name 67 deps = [ ":${subsystem_name}" ] 68 69 outdir = rebase_path("$root_out_dir/${subsystem_name}") 70 prebuilts = "mkdir -p $outdir/interface $outdir/sdk_libs" 71 command = "cp -r $interface_header $outdir/interface && cp -r $sdk_libs_path $outdir/sdk_libs" 72 exec_path = rebase_path(".", root_build_dir) 73 action(target_name){ 74 args = [ 75 "--path=$exec_path", 76 "--prebuilts=$prebuilts", 77 "--command=$command", 78 "--enable=$LOSCFG_SDK_BUILD" 79 ] 80 script = "//build/lite/build_ext_components.py" 81 outputs = [ "$target_out_dir/sdk_build_file_log.txt" ] 82 } 83} 84 85template("lite_vendor_sdk") { 86 prebuilts = invoker.prebuilts 87 command = invoker.command 88 exec_path = rebase_path(".", root_build_dir) 89 action(target_name){ 90 args = [ 91 "--path=$exec_path", 92 "--prebuilts=$prebuilts", 93 "--command=$command", 94 "--enable=$LOSCFG_SDK_BUILD" 95 ] 96 script = "//build/lite/build_ext_components.py" 97 outputs = [ "$target_out_dir/sdk_build_file_log.txt" ] 98 } 99} 100