diff options
| author | Arthur LAURENT <[email protected]> | 2022-08-10 16:51:34 +0200 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2022-08-10 16:52:51 +0200 |
| commit | f4fda8f0fb19a16a19a1f26e7b7e9d52cc36b1ea (patch) | |
| tree | 5ceb362b57a6e905dc1c449734c3b318c0565faa /xmake/rules/c++/modules/modules_support/common.lua | |
| parent | fa4ada819810fe6b2760e36e6ff7b5f7afe5303d (diff) | |
Improve MSVC
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/common.lua')
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/common.lua | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/xmake/rules/c++/modules/modules_support/common.lua b/xmake/rules/c++/modules/modules_support/common.lua index 96468456f..8072800bc 100644 --- a/xmake/rules/c++/modules/modules_support/common.lua +++ b/xmake/rules/c++/modules/modules_support/common.lua @@ -131,7 +131,7 @@ function contains_modules(target) if not target_with_modules then for _, dep in ipairs(target:orderdeps()) do local sourcebatches = dep:sourcebatches() - if sourcebatches and sourcebatches["c++.build.modules"] then + if sourcebatches["c++.build.modules"] then target_with_modules = true break end @@ -196,24 +196,28 @@ function parse_dependency_data(target, moduleinfos) for _, rule in ipairs(moduleinfo.rules) do modules = modules or {} local m = {} - for _, provide in ipairs(rule.provides) do - m.provides = m.provides or {} - assert(provide["logical-name"]) - if provide["compiled-module-path"] then - if not path.is_absolute(provide["compiled-module-path"]) then - m.provides[provide["logical-name"]] = path.absolute(path.translate(provide["compiled-module-path"])) + if rule.provides then + for _, provide in ipairs(rule.provides) do + m.provides = m.provides or {} + assert(provide["logical-name"]) + if provide["compiled-module-path"] then + if not path.is_absolute(provide["compiled-module-path"]) then + m.provides[provide["logical-name"]] = path.absolute(path.translate(provide["compiled-module-path"])) + else + m.provides[provide["logical-name"]] = path.translate(provide["compiled-module-path"]) + end else - m.provides[provide["logical-name"]] = path.translate(provide["compiled-module-path"]) + -- assume path with name + local name = provide["logical-name"] .. bmi_extension(target) + name:replace(":", "-") + m.provides[provide["logical-name"]] = { + bmi = path.join(cachedir, name), + sourcefile = moduleinfo.sourcefile + } end - else - -- assume path with name - local name = provide["logical-name"] .. bmi_extension(target) - name:replace(":", "-") - m.provides[provide["logical-name"]] = { - bmi = path.join(cachedir, name), - sourcefile = moduleinfo.sourcefile - } end + else + m.cppfile = moduleinfo.sourcefile end assert(rule["primary-output"]) modules[path.translate(rule["primary-output"])] = m @@ -527,9 +531,9 @@ function append_headerunits_objectfiles(target) local cache = localcache():get(cachekey) or {} if target:is_binary() then target:add("ldflags", cache, {force = true}) - elseif target:is_static() == "static" then + elseif target:is_static() then target:add("arflags", cache, {force = true}) - elseif target:is_shared() == "shared" then + elseif target:is_shared() then target:add("shflags", cache, {force = true}) end end |
