From ea9ea2d31ec34c55e1968484efe4f5413116adc4 Mon Sep 17 00:00:00 2001 From: Arthur LAURENT Date: Tue, 6 Dec 2022 18:42:11 +0100 Subject: Ensure module import order on MSVC --- xmake/rules/c++/modules/modules_support/msvc.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'xmake/rules/c++/modules/modules_support/msvc.lua') diff --git a/xmake/rules/c++/modules/modules_support/msvc.lua b/xmake/rules/c++/modules/modules_support/msvc.lua index c360cb2eb..756f19703 100644 --- a/xmake/rules/c++/modules/modules_support/msvc.lua +++ b/xmake/rules/c++/modules/modules_support/msvc.lua @@ -719,12 +719,19 @@ function get_requiresflags(target, requires, opt) local flags = {} local modulemap = _get_modulemap_from_mapper(target) -- add deps required module flags + local already_mapped_modules = {} for name, _ in table.orderpairs(requires) do + -- if already in flags, continue + if already_mapped_modules[name] then + goto continue + end + for _, dep in ipairs(target:orderdeps()) do local modulemap_ = _get_modulemap_from_mapper(dep) if modulemap_[name] then table.join2(flags, modulemap_[name].flag) table.join2(flags, modulemap_[name].deps or {}) + already_mapped_modules[name] = true if os.isfile(modulemap_[name].objectfile) then _add_objectfile_to_link_arguments(target, modulemap_[name].objectfile) end -- cgit v1.3.1