From e2c6eb2208f05cba0fe499656e2d8de1b70c9410 Mon Sep 17 00:00:00 2001 From: Arthur LAURENT Date: Thu, 1 Dec 2022 15:16:06 +0100 Subject: remove .i after reading it --- xmake/rules/c++/modules/modules_support/clang.lua | 4 +++- xmake/rules/c++/modules/modules_support/gcc.lua | 4 +++- xmake/rules/c++/modules/modules_support/msvc.lua | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/xmake/rules/c++/modules/modules_support/clang.lua b/xmake/rules/c++/modules/modules_support/clang.lua index 6ba2508d3..6f8b87303 100644 --- a/xmake/rules/c++/modules/modules_support/clang.lua +++ b/xmake/rules/c++/modules/modules_support/clang.lua @@ -224,7 +224,9 @@ function generate_dependencies(target, sourcebatch, opt) end local ifile = path.translate(path.join(outputdir, path.filename(file) .. ".i")) os.vrunv(compinst:program(), table.join(defines, {"-E", "-x", "c++", file, "-o", ifile})) - return io.readfile(ifile) + local content = io.readfile(ifile) + os.rm(ifile) + return content end) changed = true diff --git a/xmake/rules/c++/modules/modules_support/gcc.lua b/xmake/rules/c++/modules/modules_support/gcc.lua index e58f875f3..2b65acf27 100644 --- a/xmake/rules/c++/modules/modules_support/gcc.lua +++ b/xmake/rules/c++/modules/modules_support/gcc.lua @@ -187,7 +187,9 @@ function generate_dependencies(target, sourcebatch, opt) end local ifile = path.translate(path.join(outputdir, path.filename(file) .. ".i")) os.vrunv(compinst:program(), table.join(defines, {get_cppversionflag(target), "-E", "-x", "c++", file, "-o", ifile})) - return io.readfile(ifile) + local content = io.readfile(ifile) + os.rm(ifile) + return content end) end changed = true diff --git a/xmake/rules/c++/modules/modules_support/msvc.lua b/xmake/rules/c++/modules/modules_support/msvc.lua index 73aea8122..d153bc2d2 100644 --- a/xmake/rules/c++/modules/modules_support/msvc.lua +++ b/xmake/rules/c++/modules/modules_support/msvc.lua @@ -171,7 +171,6 @@ end -- generate dependency files function generate_dependencies(target, sourcebatch, opt) - local compinst = target:compiler("cxx") local toolchain = target:toolchain("msvc") local vcvars = toolchain:config("vcvars") local scandependenciesflag = get_scandependenciesflag(target) @@ -202,7 +201,9 @@ function generate_dependencies(target, sourcebatch, opt) end local ifile = path.translate(path.join(outputdir, path.filename(file) .. ".i")) os.vrunv(compinst:program(), table.join(defines, {"/nologo", get_cppversionflag(target), "/P", file, "/Fi" .. ifile}), {envs = vcvars}) - return io.readfile(ifile) + local content = io.readfile(ifile) + os.rm(ifile) + return content end) end changed = true -- cgit v1.3.1