diff options
| author | ruki <[email protected]> | 2024-04-09 22:15:46 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-04-09 22:15:46 +0800 |
| commit | 86075cdc1f9e82e65a94d35dd2725acbf590cd97 (patch) | |
| tree | 7e616a615874641820b3790ae35cf480cbd84dd5 /xmake/rules/cppfront | |
| parent | 88c978a188ebefb92164a9ef9584f0e6affbe8e1 (diff) | |
| parent | bb97da112be686014a4807ed951f7a520a9f0248 (diff) | |
Merge pull request #4950 from shaoxie1986/dev
After the change of h2, recompile cpp2 containing this h2
Diffstat (limited to 'xmake/rules/cppfront')
| -rw-r--r-- | xmake/rules/cppfront/xmake.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/xmake/rules/cppfront/xmake.lua b/xmake/rules/cppfront/xmake.lua index 86067a373..22663f184 100644 --- a/xmake/rules/cppfront/xmake.lua +++ b/xmake/rules/cppfront/xmake.lua @@ -22,7 +22,6 @@ rule("cppfront.build.h2") set_extensions(".h2") on_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 root_dir = path.directory(sourcefile_cpp2) + for line in io.lines(sourcefile_cpp2) do + local match_h2 = line:match("^ -#include *\"([%w%p]+.h2)\"") + if match_h2 ~= nil then + batchcmds:add_depfiles(path.join(root_dir, 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) |
