summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-08-04 10:41:45 +0800
committerruki <[email protected]>2017-08-04 10:41:45 +0800
commitb9f40db69152c3458b2a0dcd1b99eb094e578a0d (patch)
treee81ce87544c135b838d3c8f23ba79288993cc847
parent9e1b8493ee65cd59d524c95fd2e7f6af8265e60e (diff)
support .inl pch header
-rw-r--r--xmake/actions/build/kinds/object.lua2
-rw-r--r--xmake/core/project/target.lua6
-rw-r--r--xmake/modules/core/tools/cl.lua4
-rw-r--r--xmake/modules/core/tools/gcc.lua4
4 files changed, 8 insertions, 8 deletions
diff --git a/xmake/actions/build/kinds/object.lua b/xmake/actions/build/kinds/object.lua
index 9cee1afba..0263fd982 100644
--- a/xmake/actions/build/kinds/object.lua
+++ b/xmake/actions/build/kinds/object.lua
@@ -262,7 +262,7 @@ function _build_precompiled_header(target, buildinfo)
end
-- init sourcekinds
- local sourcekinds = {[".h"] = "cc", [".hpp"] = "cxx"}
+ local sourcekinds = {[".h"] = "cc", [".hpp"] = "cxx", [".inl"] = "cxx"}
-- init sourcefile, objectfile and incdepfile
local sourcefile = precompiled_header
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index d6d2ee0a8..54bc7b62d 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -726,7 +726,7 @@ function target:configheader(outputdir)
return configheader, outputheader
end
--- get the precompiled source file (.[h|hpp], .[c|cpp])
+-- get the precompiled source file (.[h|hpp|inl], .[c|cpp])
function target:pcsourcefile()
-- get it from the cache first
@@ -739,7 +739,7 @@ function target:pcsourcefile()
local sourcefile = nil
for _, file in ipairs(table.wrap(self:get("precompiled_header"))) do
local extension = path.extension(file)
- if not headerfile and extension:startswith(".h") then
+ if not headerfile and (extension:startswith(".h") or extension == ".inl") then
headerfile = file
else
sourcefile = file
@@ -769,7 +769,7 @@ function target:pcheaderfile()
end
-- init sourcekinds
- local sourcekinds = {[".h"] = "cc", [".hpp"] = "cxx"}
+ local sourcekinds = {[".h"] = "cc", [".hpp"] = "cxx", [".inl"] = "cxx"}
-- get source kind
local sourcekind = sourcekinds[path.extension(precompiled_header)] or "cc"
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index 39d14e350..d02982d12 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -235,7 +235,7 @@ function nf_precompiled_header(self, headerfile, target)
-- make flag
local extension = path.extension(headerfile)
- if extension == ".h" or extension == ".hpp" then
+ if (extension:startswith(".h") or extension == ".inl") then
return "-Yu" .. headerfile .. " -Fp" .. target:pcheaderfile()
end
end
@@ -306,7 +306,7 @@ function _compargv1(self, sourcefile, objectfile, flags)
-- precompiled header?
local extension = path.extension(sourcefile)
- if extension == ".h" or extension == ".hpp" then
+ if (extension:startswith(".h") or extension == ".inl") then
return _compargv1_pch(self, sourcefile, objectfile, flags)
end
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index d07201362..b8f34942f 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -253,7 +253,7 @@ end
-- make the precompiled header flag
function nf_precompiled_header(self, headerfile, target)
local extension = path.extension(headerfile)
- if extension == ".h" or extension == ".hpp" then
+ if (extension:startswith(".h") or extension == ".inl") then
if self:name() == "clang" then
return "-include " .. headerfile .. " -include-pch " .. target:pcheaderfile()
else
@@ -350,7 +350,7 @@ function _compargv1(self, sourcefile, objectfile, flags)
-- precompiled header?
local extension = path.extension(sourcefile)
- if extension == ".h" or extension == ".hpp" then
+ if (extension:startswith(".h") or extension == ".inl") then
return _compargv1_pch(self, sourcefile, objectfile, flags)
end