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

Support for incremental compilation and parse header file deps for keil/armcc #2686

Closed
as564335sa opened this issue Aug 17, 2022 · 6 comments

Comments

@as564335sa
Copy link
Contributor

Xmake 版本

2.6.9

操作系统版本和架构

windows

描述问题

今天突然发现,armcc编译器在修改了一个头文件后,重新编译,包含这个头文件的.C文件不会被重新编译,之前并没有注意过这种情况,不知道与版本有没有关系,gcc似乎没有这种情况?

期待的结果

工程配置

No response

附加信息和错误日志

No response

@as564335sa as564335sa added the bug label Aug 17, 2022
@waruqi
Copy link
Member

waruqi commented Aug 17, 2022

正常,目前就 gcc/clang/msvc 支持头文件依赖解析和增量编译。。冷门编译器暂时没时间搞,你可以提个 pr 过来支持上

@waruqi waruqi removed the bug label Aug 17, 2022
@as564335sa
Copy link
Contributor Author

好吧,看了下,看不懂这部分东西

@waruqi
Copy link
Member

waruqi commented Aug 19, 2022

先得确认下 armcc 有没有类似 gcc 里面的 -MM/-MMD flags 可以生成头文件依赖关系的。。

然后参考下这部分代码。

compflags = table.join(compflags, "-MMD", "-MF", depfile)

@waruqi waruqi changed the title armcc,修改头文件后,编译无效 Support for incremental compilation and parse header file deps for keil/armcc Aug 19, 2022
@as564335sa
Copy link
Contributor Author

先得确认下 armcc 有没有类似 gcc 里面的 -MM/-MMD flags 可以生成头文件依赖关系的。。

然后参考下这部分代码。

compflags = table.join(compflags, "-MMD", "-MF", depfile)

我看了下,armcc对应的选项是--depend,在keil里能找到类似的选项--depend *.d
我参照gcc.lua添加了一下这个选项,能编译通过,也生成了tmpfile,但是还是没有效果,对xmake的流程不了解,不知道怎么高了;

armclang在keil里的选项是-MD,搜了下资料支持下面这些;

-M, -MM         生成适合 make 实用程序使用的 makefile 依赖规则列表。        编译和组装。
-MD, -MMD         编译或汇编源文件并生成适合 make 实用程序使用的 makefile 依赖规则列表。        编译和组装。
-MF         为 -M 和 -MD 选项生成的 makefile 依赖规则指定文件名。        仅编译

@waruqi
Copy link
Member

waruqi commented Aug 19, 2022

armcc.lua/armclang.lua 里面添加 flags 生成 deps 然后 depend.lua 里面去解析它。

function load(dependfile)
if os.isfile(dependfile) then
-- may be the depend file has been incomplete when if the compilation process is abnormally interrupted
local dependinfo = try { function() return io.load(dependfile) end }
if dependinfo then
-- attempt to load depfiles from the compilers
if dependinfo.depfiles_gcc then
_load_depfiles(parse_deps_gcc, dependinfo, dependinfo.depfiles_gcc)
dependinfo.depfiles_gcc = nil
elseif dependinfo.depfiles_cl_json then
_load_depfiles(parse_deps_cl_json, dependinfo, dependinfo.depfiles_cl_json)
dependinfo.depfiles_cl_json = nil
elseif dependinfo.depfiles_cl then
_load_depfiles(parse_deps_cl, dependinfo, dependinfo.depfiles_cl)
dependinfo.depfiles_cl = nil
elseif dependinfo.depfiles_rc then
_load_depfiles(parse_deps_rc, dependinfo, dependinfo.depfiles_rc)
dependinfo.depfiles_rc = nil
end
return dependinfo
end
end
end

@waruqi
Copy link
Member

waruqi commented Aug 20, 2022

armclang 我也支持了

@waruqi waruqi closed this as completed Aug 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants