添加一些BUILD.gn文件, 添加 source_module模板
This commit is contained in:
@@ -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"
|
||||
]
|
||||
}
|
||||
|
||||
|
@@ -11,9 +11,16 @@
|
||||
|
||||
import("//build/buildcfg.gni")
|
||||
|
||||
module_name = "kl_sdk"
|
||||
module_name = get_path_info(rebase_path("."), "name")
|
||||
|
||||
kernel_module(module_name) {
|
||||
module_group(module_name) {
|
||||
modules = ["pkt","io_lib","utils",":kl_sdk"]
|
||||
}
|
||||
|
||||
module_name1 = "kl_sdk"
|
||||
|
||||
source_module(module_name1) {
|
||||
sources = []
|
||||
include_dirs = []
|
||||
}
|
||||
|
||||
|
8
common/io_lib/BUILD.gn
Normal file
8
common/io_lib/BUILD.gn
Normal file
@@ -0,0 +1,8 @@
|
||||
import("//build/buildcfg.gni")
|
||||
|
||||
module_name = "kl_sdk"
|
||||
|
||||
kernel_module(module_name) {
|
||||
sources=[]
|
||||
include_dirs=[]
|
||||
}
|
8
common/pkt/BUILD.gn
Normal file
8
common/pkt/BUILD.gn
Normal file
@@ -0,0 +1,8 @@
|
||||
import("//build/buildcfg.gni")
|
||||
|
||||
module_name = "kl_sdk"
|
||||
|
||||
kernel_module(module_name) {
|
||||
sources=[]
|
||||
include_dirs=[]
|
||||
}
|
8
common/utils/BUILD.gn
Normal file
8
common/utils/BUILD.gn
Normal file
@@ -0,0 +1,8 @@
|
||||
import("//build/buildcfg.gni")
|
||||
|
||||
module_name = "kl_sdk"
|
||||
|
||||
kernel_module(module_name) {
|
||||
sources=[]
|
||||
include_dirs=[]
|
||||
}
|
@@ -368,18 +368,18 @@ def lex(text:bytes,file_name:str=""):
|
||||
else:
|
||||
buff.append(c_old&0xff)
|
||||
c_old=c
|
||||
if not (lex_obj.deal_macro(buff)): # 处理宏
|
||||
is_space=True
|
||||
while True:
|
||||
c=lex_obj.get_next_char()
|
||||
if(is_space and c==TOKEN('#')):
|
||||
break
|
||||
if(c==-1):
|
||||
break
|
||||
if not isspace(c):
|
||||
is_space=False
|
||||
elif(c==TOKEN('\n')):
|
||||
is_space=True
|
||||
# if not (lex_obj.deal_macro(buff)): # 处理宏
|
||||
# is_space=True
|
||||
# while True:
|
||||
# c=lex_obj.get_next_char()
|
||||
# if(is_space and c==TOKEN('#')):
|
||||
# break
|
||||
# if(c==-1):
|
||||
# break
|
||||
# if not isspace(c):
|
||||
# is_space=False
|
||||
# elif(c==TOKEN('\n')):
|
||||
# is_space=True
|
||||
elif isinstr(c,"/"):
|
||||
c=lex_obj.get_next_char()
|
||||
if(c==TOKEN("/")):
|
||||
@@ -420,8 +420,8 @@ def lex(text:bytes,file_name:str=""):
|
||||
else:
|
||||
lex_obj.save_one_char_token(TOKEN("."))
|
||||
else:
|
||||
raise Exception(f"未知的字符 {bytes([c])}, {lex_obj.file_name}:{lex_obj.line},{lex_obj.pos}")
|
||||
# c=lex_obj.get_next_char()
|
||||
# raise Exception(f"未知的字符 {bytes([c])}, {lex_obj.file_name}:{lex_obj.line},{lex_obj.pos}")
|
||||
c=lex_obj.get_next_char()
|
||||
# if(line_old==lex_obj.line and pos_old==lex_obj.pos):
|
||||
# print(f"pointer not move.")
|
||||
# print(line_old,pos_old)
|
||||
|
@@ -11,9 +11,16 @@
|
||||
|
||||
import("//build/buildcfg.gni")
|
||||
|
||||
module_name = "kl_sdk"
|
||||
module_name = get_path_info(rebase_path("."), "name")
|
||||
|
||||
kernel_module(module_name) {
|
||||
module_group(module_name) {
|
||||
modules = ["riscv3",":kl_sdk"]
|
||||
}
|
||||
|
||||
module_name1 = "kl_sdk"
|
||||
|
||||
source_module(module_name1) {
|
||||
sources = []
|
||||
include_dirs = []
|
||||
}
|
||||
|
||||
|
8
startup/riscv3/BUILD.gn
Normal file
8
startup/riscv3/BUILD.gn
Normal file
@@ -0,0 +1,8 @@
|
||||
import("//build/buildcfg.gni")
|
||||
|
||||
module_name = "kl_sdk"
|
||||
|
||||
kernel_module(module_name) {
|
||||
sources = []
|
||||
include_dirs = []
|
||||
}
|
Reference in New Issue
Block a user