diff options
| author | ruki <[email protected]> | 2025-04-12 10:16:48 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-04-12 10:16:48 +0800 |
| commit | 7cfbacd71f14c897e2749c0b931f9ff48a768744 (patch) | |
| tree | 37a65113ad7da1a81e6d95b2d06a73e2a749ad0e /xmake/rules/c++/modules/modules_support | |
| parent | 4d20b980c0d3826641a7b0481145a5e495417f6e (diff) | |
| parent | c8e24bdbe3cc00955c8078412ef2104e625937a8 (diff) | |
Merge pull request #6315 from xmake-io/pch
Improve modules with pch
Diffstat (limited to 'xmake/rules/c++/modules/modules_support')
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/builder.lua | 11 | ||||
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/compiler_support.lua | 5 |
2 files changed, 9 insertions, 7 deletions
diff --git a/xmake/rules/c++/modules/modules_support/builder.lua b/xmake/rules/c++/modules/modules_support/builder.lua index 7ec120cc9..a02e1e7d3 100644 --- a/xmake/rules/c++/modules/modules_support/builder.lua +++ b/xmake/rules/c++/modules/modules_support/builder.lua @@ -48,8 +48,9 @@ function _build_modules(target, sourcebatch, modules, opt) -- we need to use the full path as dep name if requre item is headerunit local dep = name if req.method:startswith("include-") and req.path then - dep = path.normalize(req.path) + dep = req.path end + dep = path.normalize(dep) local depname = target:fullname() .. "/module/" .. dep table.insert(deps, depname) end @@ -279,7 +280,7 @@ function build_modules_for_batchjobs(target, batchjobs, sourcebatch, modules, op -- add module jobs _build_modules(target, sourcebatch, modules, table.join(opt, { build_module = function(deps, module, name, objectfile, cppfile) - local job_name = target:fullname() .. "/module/" .. (name or cppfile) + local job_name = target:fullname() .. "/module/" .. path.normalize(name or cppfile) modulesjobs[job_name] = _builder(target).make_module_buildjobs(target, batchjobs, job_name, deps, {module = module, objectfile = objectfile, cppfile = cppfile}) end @@ -306,7 +307,7 @@ function build_modules_for_jobgraph(target, jobgraph, sourcebatch, modules, opt) -- add module jobs _build_modules(target, sourcebatch, modules, table.join(opt, { build_module = function(deps, module, name, objectfile, cppfile) - local jobname = target:fullname() .. "/module/" .. (name or cppfile) + local jobname = target:fullname() .. "/module/" .. path.normalize(name or cppfile) _builder(target).make_module_jobgraph(target, jobgraph, { module = module, objectfile = objectfile, cppfile = cppfile }) @@ -355,7 +356,7 @@ function build_headerunits_for_batchjobs(target, batchjobs, sourcebatch, modules local modulesjobs = {} _build_headerunits(target, headerunits, table.join(opt, { build_headerunit = function(headerunit, key, bmifile, outputdir, build) - local job_name = target:fullname() .. "/module/" .. key + local job_name = target:fullname() .. "/module/" .. path.normalize(key) local job = _builder(target).make_headerunit_buildjobs(target, job_name, batchjobs, headerunit, bmifile, outputdir, table.join(opt, {build = build})) if job then modulesjobs[job_name] = job @@ -392,7 +393,7 @@ function build_headerunits_for_jobgraph(target, jobgraph, sourcebatch, modules, local modulesjobs = {} _build_headerunits(target, headerunits, table.join(opt, { build_headerunit = function(headerunit, key, bmifile, outputdir, build) - local job_name = target:fullname() .. "/module/" .. key + local job_name = target:fullname() .. "/module/" .. path.normalize(key) _builder(target).make_headerunit_jobgraph(target, job_name, jobgraph, headerunit, bmifile, outputdir, table.join(opt, {build = build})) end diff --git a/xmake/rules/c++/modules/modules_support/compiler_support.lua b/xmake/rules/c++/modules/modules_support/compiler_support.lua index eed30a320..554b536cf 100644 --- a/xmake/rules/c++/modules/modules_support/compiler_support.lua +++ b/xmake/rules/c++/modules/modules_support/compiler_support.lua @@ -82,13 +82,14 @@ function get_bmi_path(bmifile) end -- has module extension? e.g. *.mpp, ... -function has_module_extension(sourcefile) +function has_module_extension(sourcefile, opt) + opt = opt or {} local modulexts = _g.modulexts if modulexts == nil then modulexts = hashset.of(".mpp", ".mxx", ".cppm", ".ixx") _g.modulexts = modulexts end - local extension = path.extension(sourcefile) + local extension = opt.extension or path.extension(sourcefile) return modulexts:has(extension:lower()) end |
