diff options
| author | Arthur LAURENT <[email protected]> | 2022-12-05 14:48:44 +0100 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2022-12-05 15:45:54 +0100 |
| commit | 718cccc5df0b1fe28cb80256dd325b57f3e44063 (patch) | |
| tree | 2564b10d32df38604d5dfb4cb316b105d620571d /xmake/rules/c++/modules/modules_support/common.lua | |
| parent | 54d1c3ba54069b36337e6ba269f33a3bf148b476 (diff) | |
try to detect internal partition automatically on fallback generation
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/common.lua')
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/common.lua | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/xmake/rules/c++/modules/modules_support/common.lua b/xmake/rules/c++/modules/modules_support/common.lua index 4314fd4a5..ac555f778 100644 --- a/xmake/rules/c++/modules/modules_support/common.lua +++ b/xmake/rules/c++/modules/modules_support/common.lua @@ -443,8 +443,7 @@ function fallback_generate_dependencies(target, jsonfile, sourcefile, preprocess local module_deps = {} local module_deps_set = hashset.new() local sourcecode = preprocess_file(sourcefile) or io.readfile(sourcefile) - local fileconfig = target:fileconfig(sourcefile) - local internalpartition = (fileconfig and fileconfig.values) and fileconfig.values["internalpartition"] or false + local internal = false sourcecode = sourcecode:gsub("//.-\n", "\n") sourcecode = sourcecode:gsub("/%*.-%*/", "") for _, line in ipairs(sourcecode:split("\n", {plain = true})) do @@ -453,9 +452,9 @@ function fallback_generate_dependencies(target, jsonfile, sourcefile, preprocess end if not module_name_private then module_name_private = line:match("module%s+(.+)%s*;") or line:match("__preprocessed_module%s+(.+)%s*;") - end - if internalpartition then - module_name_export = module_name_private + if module_name_private then + internal = module_name_private:find(":") + end end local module_depname = line:match("import%s+(.+)%s*;") -- we need parse module interface dep in cxx/impl_unit.cpp, e.g. hello.mpp and hello_impl.cpp @@ -487,13 +486,13 @@ function fallback_generate_dependencies(target, jsonfile, sourcefile, preprocess end end - if module_name_export then - table.insert(rule.outputs, module_name_export .. bmi_extension(target)) + if module_name_export or internal then + table.insert(rule.outputs, (module_name_export or module_name_private) .. bmi_extension(target)) local provide = {} - provide["logical-name"] = module_name_export + provide["logical-name"] = module_name_export or module_name_private provide["source-path"] = path.absolute(sourcefile, project.directory()) - provide["is-interface"] = not internalpartition + provide["is-interface"] = not internal rule.provides = {} table.insert(rule.provides, provide) |
