diff options
| author | ruki <[email protected]> | 2023-08-21 23:52:19 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-08-21 23:52:19 +0800 |
| commit | 6f7c5d97b77096be7d883aa98c398d6fdfa1a57e (patch) | |
| tree | e9ce802d35cc63aa12a14ca9070a5ce6fd017be4 | |
| parent | e426190309d4bca1642254902156d48b0e36f211 (diff) | |
rename to forceincludes
| -rw-r--r-- | xmake/languages/c++/load.lua | 3 | ||||
| -rw-r--r-- | xmake/languages/c++/xmake.lua | 3 | ||||
| -rw-r--r-- | xmake/modules/core/tools/cl.lua | 14 | ||||
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 14 |
4 files changed, 10 insertions, 24 deletions
diff --git a/xmake/languages/c++/load.lua b/xmake/languages/c++/load.lua index 40d4b4bd8..ff251e778 100644 --- a/xmake/languages/c++/load.lua +++ b/xmake/languages/c++/load.lua @@ -35,8 +35,7 @@ function _get_apis() , "target.add_undefines" , "target.add_frameworks" , "target.add_rpathdirs" -- @note do not translate path, it's usually an absolute path or contains $ORIGIN/@loader_path - , "target.add_cincludes" - , "target.add_cxxincludes" + , "target.add_forceincludes" -- option.add_xxx , "option.add_cincludes" , "option.add_cxxincludes" diff --git a/xmake/languages/c++/xmake.lua b/xmake/languages/c++/xmake.lua index 99b60fb07..e07b9e294 100644 --- a/xmake/languages/c++/xmake.lua +++ b/xmake/languages/c++/xmake.lua @@ -51,8 +51,7 @@ language("c++") , "target.encodings" , "target.pcheader" , "target.pcxxheader" - , "target.cincludes" - , "target.cxxincludes" + , "target.forceincludes" , "toolchain.includedirs" , "toolchain.defines" , "toolchain.undefines" diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua index 44e696f4b..7b0e81be0 100644 --- a/xmake/modules/core/tools/cl.lua +++ b/xmake/modules/core/tools/cl.lua @@ -281,16 +281,10 @@ function nf_includedir(self, dir) return {"-I" .. path.translate(dir)} end --- make the force c include flag -function nf_cinclude(self, headerfile) - if self:kind() == "cc" then - return {"-FI", headerfile} - end -end - --- make the force c++ include flag -function nf_cxxinclude(self, headerfile) - if self:kind() == "cxx" then +-- make the force include flag +function nf_forceinclude(self, headerfile, target) + local sourcekinds = target:extraconf("forceincludes", headerfile, "sourcekinds") + if not sourcekinds or table.contains(table.wrap(sourcekinds), self:kind()) then return {"-FI", headerfile} end end diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 37f1f345a..bf52b8d29 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -278,16 +278,10 @@ function nf_sysincludedir(self, dir) return {"-isystem", path.translate(dir)} end --- make the force c include flag -function nf_cinclude(self, headerfile) - if self:kind() == "cc" then - return {"-include", headerfile} - end -end - --- make the force c++ include flag -function nf_cxxinclude(self, headerfile) - if self:kind() == "cxx" then +-- make the force include flag +function nf_forceinclude(self, headerfile, target) + local sourcekinds = target:extraconf("forceincludes", headerfile, "sourcekinds") + if not sourcekinds or table.contains(table.wrap(sourcekinds), self:kind()) then return {"-include", headerfile} end end |
