-
-
Notifications
You must be signed in to change notification settings - Fork 785
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
Add cppfront's header(*.h2) support #4943
Conversation
xmake/rules/cppfront/xmake.lua
Outdated
@@ -35,31 +35,58 @@ rule("cppfront.build") | |||
end | |||
end | |||
end) | |||
on_buildcmd_file(function (target, batchcmds, sourcefile_cpp2, opt) | |||
on_buildcmd_files(function (target, batchcmds, sourcebatch, 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.
不要一起处理,on_buildcmd_file 拆成单文件粒度,是可以并行编译,这么搞,只能串行编译了,会很慢。
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.
主要是如果cpp2先处理,如果依赖的h2后处理,生成的cpp编译的时候可能提示缺少头文件。
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.
补充提交了,使用add_deps方式的
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.
那应该拆成两个 rule ,一个处理 cpp2 一个处理 h2 ,然后通过 add_deps("", {order = true}) 配置依赖关系,确保执行顺序
xmake/rules/cppfront/xmake.lua
Outdated
cpp2_files = {} | ||
all_files = {} | ||
for _, sourcefile in ipairs(sourcebatch.sourcefiles) do | ||
if string.endswith(sourcefile, ".h2") then |
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.
用 path.extension
This reverts commit 99e57fc.
xmake/rules/cppfront/xmake.lua
Outdated
batchcmds:set_depmtime(os.mtime(sourcefile_h)) | ||
batchcmds:set_depcache(target:dependfile(sourcefile_h)) | ||
end) | ||
|
||
-- define rule: cppfront.build | ||
rule("cppfront.build") |
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.build.cpp2 ,跟 .h2 保持命名风格一致
另外,测下增量编译是否 work |
Also, test whether incremental compilation works. |
添加cppfront对于.h2的支持 #4938