diff options
| author | carols <[email protected]> | 2024-04-08 22:07:28 +0800 |
|---|---|---|
| committer | carols <[email protected]> | 2024-04-08 22:16:33 +0800 |
| commit | eec7b3465a4d80529a907182183e11261c3c12d5 (patch) | |
| tree | 2005a13c04a52693533a1ad0cbe7501e47a6b0df /xmake/rules/cppfront/xmake.lua | |
| parent | 0539773b74bcc7eabab6f16a8d1760c79bf75a14 (diff) | |
After the change of h2, recompile cpp2 containing this h2
Diffstat (limited to 'xmake/rules/cppfront/xmake.lua')
| -rw-r--r-- | xmake/rules/cppfront/xmake.lua | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/xmake/rules/cppfront/xmake.lua b/xmake/rules/cppfront/xmake.lua index b90222aa9..b2d0b093e 100644 --- a/xmake/rules/cppfront/xmake.lua +++ b/xmake/rules/cppfront/xmake.lua @@ -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) -- get cppfront import("lib.detect.find_tool") local cppfront = assert(find_tool("cppfront", {check = "-h"}), "cppfront not found!") @@ -65,7 +64,6 @@ rule("cppfront.build.cpp2") end end) on_buildcmd_file(function (target, batchcmds, sourcefile_cpp2, opt) - -- get cppfront import("lib.detect.find_tool") local cppfront = assert(find_tool("cppfront", {check = "-h"}), "cppfront not found!") @@ -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) + for line in lines do + match_h2 = string.match(line, "^ -#include *\"([%w%p]+.h2)\"") + if match_h2 ~= nil then + batchcmds:add_depfiles(path.join(path.directory(sourcefile_cpp2), match_h2)) + end + end -- add commands local argv = {"-o", path(sourcefile_cpp), path(sourcefile_cpp2)} batchcmds:show_progress(opt.progress, "${color.build.object}compiling.cpp2 %s", sourcefile_cpp2) |
