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/gcc.lua | |
| parent | 6479822a2179db58dab05e0f1b60aa4cf6c48b98 (diff) | |
add includedirs to preprocess stage
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/gcc.lua')
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/gcc.lua | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/xmake/rules/c++/modules/modules_support/gcc.lua b/xmake/rules/c++/modules/modules_support/gcc.lua index 2b65acf27..64199c831 100644 --- a/xmake/rules/c++/modules/modules_support/gcc.lua +++ b/xmake/rules/c++/modules/modules_support/gcc.lua @@ -185,8 +185,24 @@ 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 + for i, includedir in pairs(includedirs) do + includedirs[i] = "-I" .. includedir + end local ifile = path.translate(path.join(outputdir, path.filename(file) .. ".i")) - os.vrunv(compinst:program(), table.join(defines, {get_cppversionflag(target), "-E", "-x", "c++", file, "-o", ifile})) + os.vrunv(compinst:program(), table.join(includedirs, defines, {get_cppversionflag(target), "-E", "-x", "c++", file, "-o", ifile})) local content = io.readfile(ifile) os.rm(ifile) return content |
