-
-
Notifications
You must be signed in to change notification settings - Fork 814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After the change of h2, recompile cpp2 containing this h2 #4950
Conversation
xmake/rules/cppfront/xmake.lua
Outdated
@@ -21,8 +21,7 @@ | |||
rule("cppfront.build.h2") | |||
set_extensions(".h2") | |||
|
|||
on_buildcmd_file(function (target, batchcmds, sourcefile_h2, opt) | |||
|
|||
before_buildcmd_file(function (target, batchcmds, sourcefile_h2, opt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为啥这里改成 before? 只要 rule 加了 add_deps order=true,按理,on_buildcmd_file 也是优先执行的。
xmake/rules/cppfront/xmake.lua
Outdated
-- add_depfiles for #include "xxxx/xxxx/xxx.h2" ,exclude // #include "xxxx.h2" | ||
local lines = io.lines(sourcefile_cpp2) | ||
for line in lines do | ||
match_h2 = string.match(line, "^ -#include *\"([%w%p]+.h2)\"") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用 line:match
xmake/rules/cppfront/xmake.lua
Outdated
@@ -78,6 +76,14 @@ rule("cppfront.build.cpp2") | |||
local objectfile = target:objectfile(sourcefile_cpp) | |||
table.insert(target:objectfiles(), objectfile) | |||
|
|||
-- add_depfiles for #include "xxxx/xxxx/xxx.h2" ,exclude // #include "xxxx.h2" | |||
local lines = io.lines(sourcefile_cpp2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cppfront 现在没有头文件分析的 flags 支持么?类似 -MD 啥的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
目前help里面没看到有
另外,下次记得提到 dev 分支,不要直接提 master |
Also, remember to mention the dev branch next time instead of master directly. |
xmake/rules/cppfront/xmake.lua
Outdated
-- add_depfiles for #include "xxxx/xxxx/xxx.h2" ,exclude // #include "xxxx.h2" | ||
local lines = io.lines(sourcefile_cpp2) | ||
for line in lines do | ||
match_h2 = line:match("^ -#include *\"([%w%p]+.h2)\"") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里少了个 local ,变成全局的了
xmake/rules/cppfront/xmake.lua
Outdated
for line in lines do | ||
match_h2 = line:match("^ -#include *\"([%w%p]+.h2)\"") | ||
if match_h2 ~= nil then | ||
batchcmds:add_depfiles(path.join(path.directory(sourcefile_cpp2), match_h2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以搞个 rootdir 放到 loop 外,避免每次去 dir 一遍
修复h2变化,依赖的cpp2没变化的时候,cpp2不重新编译的问题,并且将h2改为before_buildcmd_file #4938