希望添加宏定义判断的api,类似scons的GetLocalDepend #3113
Replies: 3 comments
-
没明白你的需求,scons 我不怎么用,不清楚这个 GetLocalDepend 跟宏定义之间 有什么关系 |
Beta Was this translation helpful? Give feedback.
-
我直接说一下需求吧,比如config.h代码中有 |
Beta Was this translation helpful? Give feedback.
-
这种定制化需求,自己搞个脚本,也就几行代码的事情,没必要什么都内置 function getdefine(filename, macro)
local value
io.gsub(filename, "#define%s+(.-)\n", function (define)
local splitinfo = define:split("%s")
local name = splitinfo[1]
if name == macro then
value = splitinfo[2]
end
end)
return value
end
if getdefine("config.h", "CFG_SUPPORT_BLE") == "1" then
end 你还能自己随意调整 getdefine 接口参数,封装的更加易用些,另外,建议尽量在脚本域干这个事情。 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
你在什么场景下需要该功能?
原厂提供的make工程大量的宏定义文件,使用scons重新构建可以用GetLocalDepend,但是xmake要自己读文件写判断,比较麻烦,希望添加相关api
描述可能的解决方案
希望添加相关api
描述你认为的候选方案
No response
其他信息
No response
Beta Was this translation helpful? Give feedback.
All reactions