diff options
| -rw-r--r-- | xmake/modules/core/tools/cl.lua | 7 | ||||
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua index 148957029..4966d81da 100644 --- a/xmake/modules/core/tools/cl.lua +++ b/xmake/modules/core/tools/cl.lua @@ -423,7 +423,7 @@ function _preprocess(program, argv, opt) -- get compiler flags if flag == "-showIncludes" or flag == "/showIncludes" or - flag:startswith("-I") or flag:startswith("/I") or + (flag:startswith("-I") and #flag > 2) or (flag:startswith("/I") and #flag > 2) or flag:startswith("-Yu") or flag:startswith("/Yu") or flag:startswith("-FI") or flag:startswith("/FI") or flag:startswith("-Fp") or flag:startswith("/Fp") or @@ -441,6 +441,11 @@ function _preprocess(program, argv, opt) local sourcefile = argv[#argv] assert(objectfile and sourcefile, "%s: iorunv(%s): invalid arguments!", self, program) + -- is precompiled header? + if objectfile:endswith(".pch") then + return false + end + -- do preprocess local cppfile = path.join(path.directory(objectfile), path.basename(objectfile) .. path.extension(sourcefile)) local cppfiledir = path.directory(cppfile) diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 6a6f5fadd..5c1a3f132 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -401,7 +401,7 @@ function _preprocess(program, argv, opt) table.insert(cppflags, flag) -- get compiler flags - if flag == "-MMD" or flag:startswith("-I") or flag:startswith("--sysroot=") then + if flag == "-MMD" or (flag:startswith("-I") and #flag > 2) or flag:startswith("--sysroot=") then skipped = 1 elseif flag == "-MF" or flag == "-I" or flag == "-isystem" or flag == "-include" or flag == "-include-pch" or @@ -420,6 +420,11 @@ function _preprocess(program, argv, opt) local sourcefile = argv[#argv] assert(objectfile and sourcefile, "%s: iorunv(%s): invalid arguments!", self, program) + -- is precompiled header? + if objectfile:endswith(".gch") or objectfile:endswith(".pch") then + return false + end + -- do preprocess local cppfile = path.join(path.directory(objectfile), path.basename(objectfile) .. path.extension(sourcefile)) local cppfiledir = path.directory(cppfile) |
