summaryrefslogtreecommitdiff
path: root/xmake/modules/private/utils/toolchain.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-08-31 00:41:43 +0800
committerruki <[email protected]>2024-08-31 00:41:43 +0800
commit8317c6570c5abcd0e054741f58770b7eb57ec744 (patch)
tree0d2a15628e5c283e962dad46e54b27bd6894134f /xmake/modules/private/utils/toolchain.lua
parenta50553989fd578547255c34616fff4e18ba84784 (diff)
remove fake_target
Diffstat (limited to 'xmake/modules/private/utils/toolchain.lua')
-rw-r--r--xmake/modules/private/utils/toolchain.lua26
1 files changed, 26 insertions, 0 deletions
diff --git a/xmake/modules/private/utils/toolchain.lua b/xmake/modules/private/utils/toolchain.lua
index 1513a01d6..634169dac 100644
--- a/xmake/modules/private/utils/toolchain.lua
+++ b/xmake/modules/private/utils/toolchain.lua
@@ -18,6 +18,9 @@
-- @file toolchain.lua
--
import("core.base.semver")
+import("core.tool.linker")
+import("core.tool.compiler")
+import("core.language.language")
-- is the compatible with the host?
function is_compatible_with_host(name)
@@ -47,3 +50,26 @@ function get_vs_toolset_ver(vs_toolset)
return toolset_ver
end
+-- map compiler flags
+function map_compflags(package, langkind, name, values)
+ -- @note we need to patch package:sourcekinds(), because it wiil be called nf_runtime for gcc/clang
+ package.sourcekinds = function (self)
+ local sourcekind = language.langkinds()[langkind]
+ return sourcekind
+ end
+ local flags = compiler.map_flags(langkind, name, values, {target = package})
+ package.sourcekinds = nil
+ return flags
+end
+
+-- map linker flags
+function map_linkflags(package, targetkind, sourcekinds, name, values)
+ -- @note we need to patch package:sourcekinds(), because it wiil be called nf_runtime for gcc/clang
+ package.sourcekinds = function (self)
+ return sourcekinds
+ end
+ local flags = linker.map_flags(targetkind, sourcekinds, name, values, {target = package})
+ package.sourcekinds = nil
+ return flags
+end
+