summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/modules_support/common.lua
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2022-12-04 17:23:08 +0100
committerArthur LAURENT <[email protected]>2022-12-04 21:39:49 +0100
commit63205720fb137871070629ef6e562877de134638 (patch)
tree37f22186d7162bad53943b726bfdae128bf8aba7 /xmake/rules/c++/modules/modules_support/common.lua
parent624490c743ac474ddca3c3cdb93a9fbff8e26dc5 (diff)
add support of msvc specific /internalPartition
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/common.lua')
-rw-r--r--xmake/rules/c++/modules/modules_support/common.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/xmake/rules/c++/modules/modules_support/common.lua b/xmake/rules/c++/modules/modules_support/common.lua
index 6401f1f5b..ad8f94549 100644
--- a/xmake/rules/c++/modules/modules_support/common.lua
+++ b/xmake/rules/c++/modules/modules_support/common.lua
@@ -443,6 +443,8 @@ 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["msvc.internalpartition"] or false
sourcecode = sourcecode:gsub("//.-\n", "\n")
sourcecode = sourcecode:gsub("/%*.-%*/", "")
for _, line in ipairs(sourcecode:split("\n", {plain = true})) do
@@ -452,6 +454,9 @@ function fallback_generate_dependencies(target, jsonfile, sourcefile, preprocess
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
+ 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
-- @see https://github.com/xmake-io/xmake/pull/2664#issuecomment-1213167314
@@ -488,7 +493,7 @@ function fallback_generate_dependencies(target, jsonfile, sourcefile, preprocess
local provide = {}
provide["logical-name"] = module_name_export
provide["source-path"] = path.absolute(sourcefile, project.directory())
- provide["is-interface"] = true
+ provide["is-interface"] = not internalpartition
rule.provides = {}
table.insert(rule.provides, provide)