summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-04-14 20:42:34 +0800
committerGitHub <[email protected]>2025-04-14 20:42:34 +0800
commit36732681ba0a2f2911bf18c7c22729e23521ce05 (patch)
tree78bd1bdad04384400014f8d117cc70a5f7a78cbb
parent13144a729362ddcc4943db3aa5fc4a97e4b57905 (diff)
parent9b93dd31192b7edc7ba5ec492fc1d754254626c9 (diff)
Merge pull request #6320 from xmake-io/headerunit
fix package and headerunit for gcc
-rw-r--r--xmake/rules/c++/modules/modules_support/clang/builder.lua8
-rw-r--r--xmake/rules/c++/modules/modules_support/compiler_support.lua4
-rw-r--r--xmake/rules/c++/modules/modules_support/gcc/builder.lua14
3 files changed, 16 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 ec6692c35..420d1f0ee 100644
--- a/xmake/rules/c++/modules/modules_support/clang/builder.lua
+++ b/xmake/rules/c++/modules/modules_support/clang/builder.lua
@@ -409,7 +409,8 @@ function make_headerunit_buildjobs(target, job_name, batchjobs, headerunit, bmif
local depvalues = {compinst:program(), compflags}
if opt.build then
- progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.headerunit.$(mode) %s", target:fullname(), headerunit.name)
+ progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.headerunit.$(mode) %s",
+ target:fullname(), headerunit.name)
_compile(target, _make_headerunitflags(target, headerunit, bmifile), headerunit.path, bmifile)
end
@@ -457,8 +458,9 @@ function make_headerunit_buildcmds(target, batchcmds, headerunit, bmifile, outpu
add_headerunit_to_target_mapper(target, headerunit, bmifile)
if opt.build then
- local name = headerunit.unique and headerunit.name or headerunit.path
- batchcmds:show_progress(opt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.headerunit.$(mode) %s", target:fullname(), name)
+ local headerfile = headerunit.unique and headerunit.name or headerunit.path
+ batchcmds:show_progress(opt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.headerunit.$(mode) %s"
+ , target:fullname(), headerfile)
_batchcmds_compile(batchcmds, target, _make_headerunitflags(target, headerunit, bmifile), bmifile)
end
batchcmds:add_depfiles(headerunit.path)
diff --git a/xmake/rules/c++/modules/modules_support/compiler_support.lua b/xmake/rules/c++/modules/modules_support/compiler_support.lua
index 554b536cf..fea294ad8 100644
--- a/xmake/rules/c++/modules/modules_support/compiler_support.lua
+++ b/xmake/rules/c++/modules/modules_support/compiler_support.lua
@@ -134,7 +134,7 @@ end
function find_quote_header_file(target, sourcefile, file)
local p = path.join(path.directory(path.absolute(sourcefile, project.directory())), file)
- assert(os.isfile(p))
+ assert(os.isfile(p), "\"%s\" not found", p)
return p
end
@@ -150,7 +150,7 @@ function find_angle_header_file(target, file)
end
table.join2(headerpaths, target:get("includedirs"))
local p = find_file(file, headerpaths)
- assert(p, "find <%s> not found!", file)
+ assert(p, "<%s> not found!", file)
return p
end
diff --git a/xmake/rules/c++/modules/modules_support/gcc/builder.lua b/xmake/rules/c++/modules/modules_support/gcc/builder.lua
index 4033eefd5..1f909623f 100644
--- a/xmake/rules/c++/modules/modules_support/gcc/builder.lua
+++ b/xmake/rules/c++/modules/modules_support/gcc/builder.lua
@@ -387,9 +387,10 @@ function make_headerunit_buildjobs(target, job_name, batchjobs, headerunit, bmif
if option.get("diagnosis") then
print("mapper file:\n%s", io.readfile(headerunit_mapper))
end
+ local headerfile = headerunit.unique and headerunit.name or headerunit.path
_compile(target,
_make_headerunitflags(target, headerunit, headerunit_mapper, opt),
- path.translate(path.filename(headerunit.name)), bmifile)
+ path.translate(headerfile), bmifile)
os.tryrm(headerunit_mapper)
end
@@ -421,13 +422,15 @@ function make_headerunit_jobgraph(target, job_name, jobgraph, headerunit, bmifil
if opt.build then
local headerunit_mapper = _generate_headerunit_modulemapper_file({name = path.normalize(headerunit.path), bmifile = bmifile})
- progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.headerunit.$(mode) %s", target:fullname(), headerunit.name)
+ progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.headerunit.$(mode) %s",
+ target:fullname(), headerunit.name)
if option.get("diagnosis") then
print("mapper file:\n%s", io.readfile(headerunit_mapper))
end
+ local headerfile = headerunit.unique and headerunit.name or headerunit.path
_compile(target,
_make_headerunitflags(target, headerunit, headerunit_mapper, opt),
- path.translate(path.filename(headerunit.name)), bmifile)
+ path.translate(headerfile), bmifile)
os.tryrm(headerunit_mapper)
end
@@ -450,8 +453,9 @@ function make_headerunit_buildcmds(target, batchcmds, headerunit, bmifile, outpu
add_headerunit_to_target_mapper(target, _headerunit, bmifile)
if opt.build then
- local name = headerunit.unique and headerunit.name or headerunit.path
- batchcmds:show_progress(opt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.headerunit.$(mode) %s", target:fullname(), name)
+ local headerfile = headerunit.unique and headerunit.name or headerunit.path
+ batchcmds:show_progress(opt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.headerunit.$(mode) %s",
+ target:fullname(), headerfile)
if option.get("diagnosis") then
batchcmds:print("mapper file:\n%s", io.readfile(headerunit_mapper))
end