diff options
| author | ruki <[email protected]> | 2023-03-22 23:34:16 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-03-22 23:34:16 +0800 |
| commit | fce2659ef7e3be32a19d474ea254c9407880cdbe (patch) | |
| tree | e2002d7ec212dae9b19cf08acf54d65d8643ee35 | |
| parent | b744c2b34f0a7559a75829a94de7a1a679351ca5 (diff) | |
add vs runtime for clang #3546
| -rw-r--r-- | xmake/modules/core/tools/clang.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/xmake/modules/core/tools/clang.lua b/xmake/modules/core/tools/clang.lua index 521f31361..16bc0f245 100644 --- a/xmake/modules/core/tools/clang.lua +++ b/xmake/modules/core/tools/clang.lua @@ -164,3 +164,26 @@ function nf_exception(self, exp) end end +-- make vs runtime flag +-- @see https://github.com/xmake-io/xmake/issues/3546 +function nf_runtime(self, vs_runtime) + if self:is_plat("windows") and vs_runtime then + local maps + local kind = self:kind() + if language.sourcekinds()[kind] then + maps = { + MT = "-fms-runtime-lib=static", + MTd = "-fms-runtime-lib=static_dbg", + MD = "-fms-runtime-lib=dll", + MDd = "-fms-runtime-lib=dll_dbg" + } + elseif kind == "ld" or kind == "sh" then + maps = { + MD = "-lmsvcrt", + MDd = "-lmsvcrtd" + } + end + return maps and maps[vs_runtime] + end +end + |
