summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-01-23 22:55:55 +0800
committerruki <[email protected]>2024-01-25 12:09:58 +0800
commit229bccd5eeca9fb6da8b93c76d0d13f9c2b85314 (patch)
tree0f0020912c9a12b958e986c8832cae099bf45f54
parent2fb724f49f1ededb23998688c90ba01ec0d12467 (diff)
remove more vs_runtime
-rw-r--r--tests/projects/package/components/xmake.lua2
-rw-r--r--xmake/core/package/package.lua18
-rw-r--r--xmake/modules/package/tools/cmake.lua20
-rw-r--r--xmake/modules/package/tools/meson.lua8
-rw-r--r--xmake/modules/package/tools/xmake.lua8
5 files changed, 28 insertions, 28 deletions
diff --git a/tests/projects/package/components/xmake.lua b/tests/projects/package/components/xmake.lua
index 6185f5178..14dbe472d 100644
--- a/tests/projects/package/components/xmake.lua
+++ b/tests/projects/package/components/xmake.lua
@@ -175,7 +175,7 @@ package("sfml")
table.insert(configs, "-DBUILD_SHARED_LIBS=ON")
else
table.insert(configs, "-DBUILD_SHARED_LIBS=OFF")
- if package:is_plat("windows") and package:config("vs_runtime"):startswith("MT") then
+ if package:is_plat("windows") and package:runtimes():startswith("MT") then
table.insert(configs, "-DSFML_USE_STATIC_STD_LIBS=ON")
end
end
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 992650005..69d2b234d 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -2260,21 +2260,21 @@ function _instance:_generate_build_configs(configs, opt)
configs = table.join(self:fetch_librarydeps(), configs)
if self:is_plat("windows") then
local ld = self:build_getenv("ld")
- local vs_runtime = self:config("vs_runtime")
- -- since we are ignoring the vs_runtime of the headeronly library,
- -- we can only get the vs_runtime from the dependency library to detect the link.
- if self:is_headeronly() and not vs_runtime and self:librarydeps() then
+ local runtimes = self:runtimes()
+ -- since we are ignoring the runtimes of the headeronly library,
+ -- we can only get the runtimes from the dependency library to detect the link.
+ if self:is_headeronly() and not runtimes and self:librarydeps() then
for _, dep in ipairs(self:librarydeps()) do
- if dep:is_plat("windows") and dep:config("vs_runtime") then
- vs_runtime = dep:config("vs_runtime")
+ if dep:is_plat("windows") and dep:runtimes() then
+ runtimes = dep:runtimes()
break
end
end
end
- if vs_runtime and ld and path.basename(ld:lower()) == "link" then -- for msvc?
+ if runtimes and ld and path.basename(ld:lower()) == "link" then -- for msvc?
configs.cxflags = table.wrap(configs.cxflags)
- table.insert(configs.cxflags, "/" .. vs_runtime)
- if vs_runtime:startswith("MT") then
+ table.insert(configs.cxflags, "/" .. runtimes)
+ if runtimes:startswith("MT") then
configs.ldflags = table.wrap(configs.ldflags)
table.insert(configs.ldflags, "-nodefaultlib:msvcrt.lib")
end
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 859af33dc..cd176e58c 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -352,24 +352,24 @@ function _get_configs_for_windows(package, configs, opt)
-- we maybe need patch `cmake_policy(SET CMP0091 NEW)` to enable this argument for some packages
-- @see https://cmake.org/cmake/help/latest/policy/CMP0091.html#policy:CMP0091
-- https://github.com/xmake-io/xmake-repo/pull/303
- local vs_runtime = package:config("vs_runtime")
- if vs_runtime == "MT" then
+ if package:has_runtime("MT") then
table.insert(configs, "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded")
- elseif vs_runtime == "MTd" then
+ elseif package:has_runtime("MTd") then
table.insert(configs, "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug")
- elseif vs_runtime == "MD" then
+ elseif package:has_runtime("MD") then
table.insert(configs, "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL")
- elseif vs_runtime == "MDd" then
+ elseif package:has_runtime("MDd") then
table.insert(configs, "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL")
end
- if vs_runtime then
+ local runtimes = package:runtimes()
+ if runtimes then
-- CMake default MSVC flags as of 3.21.2
local default_debug_flags = "/Zi /Ob0 /Od /RTC1"
local default_release_flags = "/O2 /Ob2 /DNDEBUG"
- table.insert(configs, '-DCMAKE_CXX_FLAGS_DEBUG=/' .. vs_runtime .. ' ' .. default_debug_flags)
- table.insert(configs, '-DCMAKE_CXX_FLAGS_RELEASE=/' .. vs_runtime .. ' ' .. default_release_flags)
- table.insert(configs, '-DCMAKE_C_FLAGS_DEBUG=/' .. vs_runtime .. ' ' .. default_debug_flags)
- table.insert(configs, '-DCMAKE_C_FLAGS_RELEASE=/' .. vs_runtime .. ' ' .. default_release_flags)
+ table.insert(configs, '-DCMAKE_CXX_FLAGS_DEBUG=/' .. runtimes .. ' ' .. default_debug_flags)
+ table.insert(configs, '-DCMAKE_CXX_FLAGS_RELEASE=/' .. runtimes .. ' ' .. default_release_flags)
+ table.insert(configs, '-DCMAKE_C_FLAGS_DEBUG=/' .. runtimes .. ' ' .. default_debug_flags)
+ table.insert(configs, '-DCMAKE_C_FLAGS_RELEASE=/' .. runtimes .. ' ' .. default_release_flags)
end
if not opt._configs_str:find("CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY") then
table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=pdb")
diff --git a/xmake/modules/package/tools/meson.lua b/xmake/modules/package/tools/meson.lua
index 56fc35bc4..e4d740d16 100644
--- a/xmake/modules/package/tools/meson.lua
+++ b/xmake/modules/package/tools/meson.lua
@@ -316,10 +316,10 @@ function _get_configs(package, configs, opt)
table.insert(configs, "-Db_sanitize=address")
end
- -- add vs_runtime flags
- local vs_runtime = package:config("vs_runtime")
- if package:is_plat("windows") and vs_runtime then
- table.insert(configs, "-Db_vscrt=" .. vs_runtime:lower())
+ -- add runtimes flags
+ local runtimes = package:runtimes()
+ if package:is_plat("windows") and runtimes then
+ table.insert(configs, "-Db_vscrt=" .. runtimes:lower())
end
-- add cross file
diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua
index 379a46d19..27c0bd872 100644
--- a/xmake/modules/package/tools/xmake.lua
+++ b/xmake/modules/package/tools/xmake.lua
@@ -77,10 +77,10 @@ function _get_configs_for_windows(package, configs, opt)
table.insert(configs, "--" .. name .. "=" .. tostring(value))
end
end
- -- pass vs_runtime from package configs
- local vs_runtime = package:config("vs_runtime")
- if vs_runtime then
- table.insert(configs, "--vs_runtime=" .. vs_runtime)
+ -- pass runtimes from package configs
+ local runtimes = package:config("runtimes")
+ if runtimes then
+ table.insert(configs, "--runtimes=" .. runtimes)
end
_get_configs_for_qt(package, configs, opt)
_get_configs_for_vcpkg(package, configs, opt)