From 2ebc0bd03cf7f2d6be736cc01d6a808e3e03b3f1 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 24 Nov 2021 09:30:36 +0800 Subject: Update msvc.lua --- xmake/rules/c++/modules/build_modules/msvc.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/xmake/rules/c++/modules/build_modules/msvc.lua b/xmake/rules/c++/modules/build_modules/msvc.lua index 4cc8500ab..1dc04618f 100644 --- a/xmake/rules/c++/modules/build_modules/msvc.lua +++ b/xmake/rules/c++/modules/build_modules/msvc.lua @@ -36,6 +36,17 @@ function load_parent(target, opt) -- add module flags target:add("cxxflags", modulesflag) + + -- get output flag + if compinst:has_flags("/ifcOutput", "cxxflags") then + for _, dep in ipairs(target:orderdeps()) do + local sourcebatches = dep:sourcebatches() + if sourcebatches and sourcebatches["c++.build.modules"] then + local cachedir = path.join(dep:autogendir(), "rules", "modules", "cache") + target:add("cxxflags", "/ifcSearchDir " .. os.args(cachedir), {force = true}) + end + end + end end -- build module files @@ -52,9 +63,7 @@ function build_with_batchjobs(target, batchjobs, sourcebatch, opt) -- get output flag local cachedir local outputflag - local hasifc = false if compinst:has_flags("/ifcOutput", "cxxflags") then - hasifc = true outputflag = "/ifcOutput" cachedir = path.join(target:autogendir(), "rules", "modules", "cache") if not os.isdir(cachedir) then -- cgit v1.3.1