Skip to content
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

Merged
merged 3 commits into from
Apr 9, 2024

Conversation

shaoxie1986
Copy link
Contributor

修复h2变化,依赖的cpp2没变化的时候,cpp2不重新编译的问题,并且将h2改为before_buildcmd_file #4938

@waruqi waruqi changed the base branch from master to dev April 9, 2024 01:51
@@ -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)
Copy link
Member

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 也是优先执行的。

-- 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)\"")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用 line:match

@@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cppfront 现在没有头文件分析的 flags 支持么?类似 -MD 啥的

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目前help里面没看到有

@waruqi
Copy link
Member

waruqi commented Apr 9, 2024

另外,下次记得提到 dev 分支,不要直接提 master

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Also, remember to mention the dev branch next time instead of master directly.

-- 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)\"")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里少了个 local ,变成全局的了

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))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以搞个 rootdir 放到 loop 外,避免每次去 dir 一遍

@waruqi waruqi merged commit 86075cd into xmake-io:dev Apr 9, 2024
17 of 19 checks passed
@waruqi waruqi added this to the v2.9.1 milestone Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants