summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2025-05-09 15:49:10 +0200
committerArthur LAURENT <[email protected]>2025-05-09 15:56:33 +0200
commit465e4dd065f1b6887189b07e29a0307213f7aca9 (patch)
tree20e8775b008f681fa84f8431966188edb3c046f1
parent3906864766872ec9210f33ef17e6a6d5193d101e (diff)
(C++ modules support) fix non named module with module extension not built
-rw-r--r--xmake/rules/c++/modules/clang/builder.lua8
-rw-r--r--xmake/rules/c++/modules/gcc/builder.lua4
-rw-r--r--xmake/rules/c++/modules/msvc/builder.lua4
3 files changed, 9 insertions, 7 deletions
diff --git a/xmake/rules/c++/modules/clang/builder.lua b/xmake/rules/c++/modules/clang/builder.lua
index c5b78a964..d3145c6de 100644
--- a/xmake/rules/c++/modules/clang/builder.lua
+++ b/xmake/rules/c++/modules/clang/builder.lua
@@ -32,7 +32,7 @@ import(".mapper")
import(".builder", {inherit = true})
function _make_modulebuildflags(target, module, opt)
- local flags = {}
+ local flags
if opt and opt.bmi then
local module_outputflag = support.get_moduleoutputflag(target)
@@ -45,6 +45,8 @@ function _make_modulebuildflags(target, module, opt)
table.join2(flags, {"-Wno-include-angled-in-module-purview", "-Wno-reserved-module-identifier", "-Wno-deprecated-declarations"})
end
table.insert(flags, module_outputflag .. module.bmifile)
+ else
+ flags = {"-x", "c++"}
end
return flags
end
@@ -227,7 +229,7 @@ function make_module_job(target, module, opt)
progress.show(opt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.module.bmi.$(mode) %s", target:fullname(), module.name)
_compile_bmi_step(target, module)
else
- if module.interface or module.implementation then
+ if support.has_module_extension(module.sourcefile) or module.interface or module.implementation then
progress.show(opt.progress, "compiling.$(mode) %s", module.sourcefile)
_compile_objectfile_step(target, module)
else
@@ -261,7 +263,7 @@ function make_module_buildcmds(target, batchcmds, module, opt)
batchcmds:show_progress(opt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.module.bmi.$(mode) %s", target:fullname(), module.name)
_compile_bmi_step(target, module, {batchcmds = batchcmds})
else
- if module.interface or module.implementation then
+ if support.has_module_extension(module.sourcefile) or module.interface or module.implementation then
batchcmds:show_progress(opt.progress, "compiling.$(mode) %s", module.sourcefile)
_compile_objectfile_step(target, module, {batchcmds = batchcmds})
else
diff --git a/xmake/rules/c++/modules/gcc/builder.lua b/xmake/rules/c++/modules/gcc/builder.lua
index 2d202d699..15cd3a85b 100644
--- a/xmake/rules/c++/modules/gcc/builder.lua
+++ b/xmake/rules/c++/modules/gcc/builder.lua
@@ -186,7 +186,7 @@ function make_module_job(target, module, opt)
end
local flags = {"-x", "c++"}
- if module.interface or module.implementation then
+ if support.has_module_extension(module.sourcefile) or module.interface or module.implementation then
if bmi and objectfile then
progress.show(opt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.module.$(mode) %s", target:fullname(), module.name)
table.insert(flags, module_flag)
@@ -237,7 +237,7 @@ function make_module_buildcmds(target, batchcmds, module, opt)
batchcmds:show("mapper file for %s --------\n%s--------", module.sourcefile, io.readfile(module_mapper))
end
end
- if support.has_module_extension(module.sourcefile) then
+ if support.has_module_extension(module.sourcefile) or module.interface or module.implementation then
batchcmds:mkdir(path.directory(module.objectfile))
local flags = {"-x", "c++"}
table.insert(flags, module_flag)
diff --git a/xmake/rules/c++/modules/msvc/builder.lua b/xmake/rules/c++/modules/msvc/builder.lua
index eca44fb2d..082bdd71e 100644
--- a/xmake/rules/c++/modules/msvc/builder.lua
+++ b/xmake/rules/c++/modules/msvc/builder.lua
@@ -239,7 +239,7 @@ function make_module_job(target, module, opt)
progress.show(opt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.module.bmi.$(mode) %s", target:fullname(), module.name)
_compile_bmi_step(target, module)
else
- if module.interface or module.implementation then
+ if support.has_module_extension(module.sourcefile) or module.interface or module.implementation then
progress.show(opt.progress, "compiling.$(mode) %s", module.sourcefile)
_compile_objectfile_step(target, module)
else
@@ -271,7 +271,7 @@ function make_module_buildcmds(target, batchcmds, module, opt)
batchcmds:show_progress(opt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.module.bmi.$(mode) %s", target:fullname(), module.name)
_compile_bmi_step(target, module, {batchcmds = batchcmds})
else
- if module.interface or module.implementation then
+ if support.has_module_extension(module.sourcefile) or module.interface or module.implementation then
batchcmds:show_progress(opt.progress, "compiling.$(mode) %s", module.sourcefile)
_compile_objectfile_step(target, module, {batchcmds = batchcmds})
else