diff options
| author | ruki <[email protected]> | 2024-11-29 22:22:19 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-11-29 22:22:19 +0800 |
| commit | a39a80d23aca888ab3c1d537ee4b313604ce2669 (patch) | |
| tree | fd664657684fb0e0945a0bfd84940aa6bf994db4 | |
| parent | f57133a76e4f1824002a812b6bddc7f56f282aa0 (diff) | |
| parent | b2e9641a4e982f0bd19306cc7b4a046ae44d99cd (diff) | |
Merge pull request #5899 from vrecluse/fix_module_parallel_compile_error_2
Fix clang module parallel compile error.
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/clang/builder.lua | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/xmake/rules/c++/modules/modules_support/clang/builder.lua b/xmake/rules/c++/modules/modules_support/clang/builder.lua index 6d60f49a0..972694254 100644 --- a/xmake/rules/c++/modules/modules_support/clang/builder.lua +++ b/xmake/rules/c++/modules/modules_support/clang/builder.lua @@ -31,18 +31,32 @@ import("compiler_support") import(".builder", {inherit = true}) function _compile_one_step(target, bmifile, sourcefile, objectfile, opt) - -- get flags local module_outputflag = compiler_support.get_moduleoutputflag(target) - if module_outputflag then - local flags = table.join({"-x", "c++-module", module_outputflag .. bmifile}, opt.std and {"-Wno-include-angled-in-module-purview", "-Wno-reserved-module-identifier"} or {}) - if opt and opt.batchcmds then - _batchcmds_compile(opt.batchcmds, target, flags, sourcefile, objectfile) + if opt.is_mapped_bmi then + -- get flags + if module_outputflag then + local flags = table.join(opt.std and {"-Wno-include-angled-in-module-purview", "-Wno-reserved-module-identifier"} or {}) + if opt and opt.batchcmds then + _batchcmds_compile(opt.batchcmds, target, flags, bmifile, objectfile) + else + _compile(target, flags, bmifile, objectfile) + end else - _compile(target, flags, sourcefile, objectfile) + _compile_objectfile_step(target, bmifile, sourcefile, objectfile, opt) end else - _compile_bmi_step(target, bmifile, sourcefile, opt) - _compile_objectfile_step(target, bmifile, sourcefile, objectfile, opt) + -- get flags + if module_outputflag then + local flags = table.join({"-x", "c++-module", module_outputflag .. bmifile}, opt.std and {"-Wno-include-angled-in-module-purview", "-Wno-reserved-module-identifier"} or {}) + if opt and opt.batchcmds then + _batchcmds_compile(opt.batchcmds, target, flags, sourcefile, objectfile) + else + _compile(target, flags, sourcefile, objectfile) + end + else + _compile_bmi_step(target, bmifile, sourcefile, opt) + _compile_objectfile_step(target, bmifile, sourcefile, objectfile, opt) + end end end @@ -246,6 +260,7 @@ function make_module_buildjobs(target, batchjobs, job_name, deps, opt) local external = fileconfig and fileconfig.external local from_moduleonly = external and external.moduleonly local bmifile = mapped_bmi or bmifile + local is_mapped_bmi = mapped_bmi ~= nil if external and not from_moduleonly then if not mapped_bmi then progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.bmi.$(mode) %s", target:name(), name or opt.cppfile) @@ -253,7 +268,7 @@ function make_module_buildjobs(target, batchjobs, job_name, deps, opt) end else progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.module.$(mode) %s", target:name(), name or opt.cppfile) - _compile_one_step(target, bmifile, opt.cppfile, opt.objectfile, {std = (name == "std" or name == "std.compat")}) + _compile_one_step(target, bmifile, opt.cppfile, opt.objectfile, {std = (name == "std" or name == "std.compat"), is_mapped_bmi = is_mapped_bmi}) end else os.tryrm(opt.objectfile) -- force rebuild for .cpp files @@ -287,6 +302,7 @@ function make_module_buildcmds(target, batchcmds, opt) local public = fileconfig and fileconfig.public local external = fileconfig and fileconfig.external local bmifile = mapped_bmi or bmifile + local is_mapped_bmi = mapped_bmi ~= nil if external and not from_moduleonly then if not mapped_bmi then batchcmds:show_progress(opt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.bmi.$(mode) %s", target:name(), name or opt.cppfile) @@ -294,7 +310,7 @@ function make_module_buildcmds(target, batchcmds, opt) end else batchcmds:show_progress(opt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.module.$(mode) %s", target:name(), name or opt.cppfile) - _compile_one_step(target, bmifile, opt.cppfile, opt.objectfile, {std = (name == "std" or name == "std.compat"), batchcmds = batchcmds}) + _compile_one_step(target, bmifile, opt.cppfile, opt.objectfile, {std = (name == "std" or name == "std.compat"), batchcmds = batchcmds, is_mapped_bmi = is_mapped_bmi}) end else batchcmds:rm(opt.objectfile) -- force rebuild for .cpp files |
