diff options
| author | ruki <[email protected]> | 2022-10-30 21:33:24 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-10-30 21:33:24 +0800 |
| commit | 3cb975509bc43a5a92bc3033c11f407d15c98f5d (patch) | |
| tree | 9e0eab6e7fc27741e393e77720a7b5b91a6a68d2 | |
| parent | b3f903777bfde99b9d69aaa2183175d3babe289b (diff) | |
save dependinfo for gcc/modules
| -rw-r--r-- | tests/projects/c++/modules/user_headerunit/src/hello.mpp | 3 | ||||
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/gcc.lua | 9 |
2 files changed, 9 insertions, 3 deletions
diff --git a/tests/projects/c++/modules/user_headerunit/src/hello.mpp b/tests/projects/c++/modules/user_headerunit/src/hello.mpp index 5b2f434ad..f2e4022f7 100644 --- a/tests/projects/c++/modules/user_headerunit/src/hello.mpp +++ b/tests/projects/c++/modules/user_headerunit/src/hello.mpp @@ -1,10 +1,11 @@ module; #include <cstdio> +import "header.hpp"; export module hello; export namespace hello { void say(const char *arg) { - printf("%s\n", arg); + printf("%s: %s\n", FOO, arg); } } diff --git a/xmake/rules/c++/modules/modules_support/gcc.lua b/xmake/rules/c++/modules/modules_support/gcc.lua index 20a8437aa..23a63dee8 100644 --- a/xmake/rules/c++/modules/modules_support/gcc.lua +++ b/xmake/rules/c++/modules/modules_support/gcc.lua @@ -349,8 +349,13 @@ function build_modules_for_batchjobs(target, batchjobs, objectfiles, modules, op if not os.isdir(objectdir) then os.mkdir(objectdir) end - local args = {"-o", objectfile, "-c", provide.sourcefile} - os.vrunv(compinst:program(), table.join(compinst:compflags({target = target}), common_args, args)) + + -- do compile + local dependinfo = {} + local compflags = table.join(compinst:compflags({target = target}), common_args) + assert(compinst:compile(provide.sourcefile, objectfile, {dependinfo = dependinfo, compflags = compflags})) + return dependinfo + end, {dependfile = target:dependfile(bmifile), files = {provide.sourcefile}}) end) if m.requires then |
