diff options
| author | Arthur LAURENT <[email protected]> | 2022-12-01 17:00:40 +0100 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2022-12-01 17:00:40 +0100 |
| commit | daca55898c15cf8e486e29d55ebb11dfb0e6190b (patch) | |
| tree | 6d21c2cfe07409d24a2daa18e63beb15bd8f3f59 /xmake/rules/c++/modules/modules_support/msvc.lua | |
| parent | 6479822a2179db58dab05e0f1b60aa4cf6c48b98 (diff) | |
add includedirs to preprocess stage
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/msvc.lua')
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/msvc.lua | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/xmake/rules/c++/modules/modules_support/msvc.lua b/xmake/rules/c++/modules/modules_support/msvc.lua index 91b7afbc5..d0a052f4b 100644 --- a/xmake/rules/c++/modules/modules_support/msvc.lua +++ b/xmake/rules/c++/modules/modules_support/msvc.lua @@ -199,8 +199,26 @@ function generate_dependencies(target, sourcebatch, opt) for _, define in ipairs(target:get("defines")) do table.insert(defines, "/D" .. define) end + local _includedirs = {} + for _, dep in ipairs(target:orderdeps()) do + local includedir = dep:get("sysincludedirs") or dep:get("includedirs") + if includedir then + table.join2(includedirs, includedir) + end + end + for _, pkg in pairs(target:pkgs()) do + local includedir = pkg:get("sysincludedirs") or pkg:get("includedirs") + if includedir then + table.join2(includedirs, includedir) + end + end + local includedirs = {} + for i, includedir in pairs(_includedirs) do + table.insert(includedirs, "/I") + table.insert(includedirs, includedir) + end local ifile = path.translate(path.join(outputdir, path.filename(file) .. ".i")) - os.vrunv(compinst:program(), table.join(defines, {"/nologo", get_cppversionflag(target), "/P", "-TP", file, "/Fi" .. ifile}), {envs = toolchain:runenvs()}) + os.vrunv(compinst:program(), table.join(includedirs, defines, {"/nologo", get_cppversionflag(target), "/P", "-TP", file, "/Fi" .. ifile}), {envs = toolchain:runenvs()}) local content = io.readfile(ifile) os.rm(ifile) return content |
