diff options
| author | ruki <[email protected]> | 2025-04-09 00:57:47 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-04-09 00:57:47 +0800 |
| commit | 40f2da18943f7f5e18f838365aebe633c32efc30 (patch) | |
| tree | 638d67006bdd6d169b4474dc806a6e9303533d34 | |
| parent | 9d8707ae3fe665f5f33991f1088d707f334546e5 (diff) | |
improve vs runtime
| -rw-r--r-- | xmake/core/project/policy.lua | 2 | ||||
| -rw-r--r-- | xmake/rules/c++/xmake.lua | 20 | ||||
| -rw-r--r-- | xmake/rules/utils/compiler_runtime/xmake.lua | 11 |
3 files changed, 12 insertions, 21 deletions
diff --git a/xmake/core/project/policy.lua b/xmake/core/project/policy.lua index 03053cb3e..c3754d540 100644 --- a/xmake/core/project/policy.lua +++ b/xmake/core/project/policy.lua @@ -164,7 +164,7 @@ function policy.policies() -- private: it will disable fetch remote package repositories ["network.mode"] = {description = "Set the network mode", type = "string"}, -- Set the compatibility version, e.g. 2.0, 3.0 - ["compatibility.version"] = {description = "Set the compatibility version", type = "string", values = {"2.0", "3.0"}} + ["compatibility.version"] = {description = "Set the compatibility version", type = "string", default = "3.0", values = {"2.0", "3.0"}} } policy._POLICIES = policies end diff --git a/xmake/rules/c++/xmake.lua b/xmake/rules/c++/xmake.lua index 94bba431e..1b8898226 100644 --- a/xmake/rules/c++/xmake.lua +++ b/xmake/rules/c++/xmake.lua @@ -23,16 +23,6 @@ rule("c.build") add_deps("c.build.pcheader", "c.build.optimization", "c.build.sanitizer") on_build_files("private.action.build.object", {batch = true, distcc = true}) on_config(function (target) - -- enable vs runtime as MD by default - if target:is_plat("windows") and not target:get("runtimes") then - local vs_runtime_default = target:policy("build.c++.msvc.runtime") - if vs_runtime_default and target:has_tool("cc", "cl", "clang_cl") then - if is_mode("debug") then - vs_runtime_default = vs_runtime_default .. "d" - end - target:set("runtimes", vs_runtime_default) - end - end -- https://github.com/xmake-io/xmake/issues/4621 if target:is_plat("windows") and target:is_static() and target:has_tool("cc", "tcc") then target:set("extension", ".a") @@ -49,16 +39,6 @@ rule("c++.build") if target:is_plat("windows") and not target:get("exceptions") then target:set("exceptions", "cxx") end - -- enable vs runtime as MD by default - if target:is_plat("windows") and not target:get("runtimes") then - local vs_runtime_default = target:policy("build.c++.msvc.runtime") - if vs_runtime_default and target:has_tool("cxx", "cl", "clang_cl") then - if is_mode("debug") then - vs_runtime_default = vs_runtime_default .. "d" - end - target:set("runtimes", vs_runtime_default) - end - end -- https://github.com/xmake-io/xmake/issues/4621 if target:is_plat("windows") and target:is_static() and target:has_tool("cxx", "tcc") then target:set("extension", ".a") diff --git a/xmake/rules/utils/compiler_runtime/xmake.lua b/xmake/rules/utils/compiler_runtime/xmake.lua index 1a50fddef..cd8d5297c 100644 --- a/xmake/rules/utils/compiler_runtime/xmake.lua +++ b/xmake/rules/utils/compiler_runtime/xmake.lua @@ -40,5 +40,16 @@ rule("utils.compiler.runtime") end target:set("runtimes", runtimes) end + + -- enable vs runtime as MD by default + if target:is_plat("windows") and not target:get("runtimes") then + local vs_runtime_default = target:policy("build.c++.msvc.runtime") + if vs_runtime_default and target:has_tool("cxx", "cl", "clang_cl") then + if is_mode("debug") then + vs_runtime_default = vs_runtime_default .. "d" + end + target:set("runtimes", vs_runtime_default) + end + end end) |
