添加一些BUILD.gn文件, 添加 source_module模板

This commit is contained in:
2025-01-20 11:33:46 +08:00
parent 01283e9f23
commit f5142aaba1
8 changed files with 85 additions and 18 deletions

View File

@@ -44,6 +44,7 @@ template("kernel_module") {
} else {
source_set(target_name) {
public_configs = []
# 把invoker中的变量复制到当前除了 configs
forward_variables_from(invoker, "*", [ "configs" ])
configs += invoker.configs
if (has_public_config) {
@@ -71,6 +72,20 @@ template("kernel_module") {
not_needed([ "auto_config" ])
}
template("source_module"){
source_set(target_name){
# 自动把src_files.txt 中的文件添加进来
forward_variables_from(invoker, "*", [ "configs" ])
# 单独赋值configs是因为这个变量有默认值
configs += invoker.configs
src=exec_script("//build/python_scripts/read_files.py",[rebase_path("."),"src_files.txt","src"],"string")
source_list=string_split(src)
sources+=source_list
inc=exec_script("//build/python_scripts/read_files.py",[rebase_path("."),"src_files.txt","inc"],"string")
inc_list=string_split(inc)
include_dirs+=inc_list
}
}
template("config") {
@@ -118,4 +133,10 @@ set_defaults("kernel_module"){
]
}
set_defaults("source_module"){
configs = [
# 把这个目录的配置设置为公共配置
"//ap:public"
]
}