summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjingkaimori <[email protected]>2024-07-23 15:10:04 +0800
committerjingkaimori <[email protected]>2024-07-23 15:10:04 +0800
commit7d3d408bbcc69a62eef4e889990322c083c96cdd (patch)
treea5260a8ed9fcecfbf5c6592f81fa0a0a9b157794
parent29b7e944629425f843ea65fa3231ba003f62d13c (diff)
simplify settings
assume that strings contains one option only.
-rw-r--r--xmake/rules/qt/install/mingw.lua24
-rw-r--r--xmake/rules/qt/install/windows.lua24
2 files changed, 4 insertions, 44 deletions
diff --git a/xmake/rules/qt/install/mingw.lua b/xmake/rules/qt/install/mingw.lua
index d3fa02c6b..79a09065a 100644
--- a/xmake/rules/qt/install/mingw.lua
+++ b/xmake/rules/qt/install/mingw.lua
@@ -31,26 +31,6 @@ function _get_installdir(target)
return installdir
end
-function _check_flag_is_release_or_debug(flags)
- return flags:find("--debug", 1, true) or flags:find("--release", 1, true)
-end
-
-function _check_flags_contain_release_or_debug(flags)
- local type_of_flags = type(flags)
- if type_of_flags == string then
- return _check_flag_is_release_or_debug(flags)
- elseif type_of_flags == table then
- for _, flag in ipairs(flags) do
- if _check_flag_is_release_or_debug(flags) then
- return true
- end
- end
- return false
- else
- return false
- end
-end
-
-- install application package for windows
function main(target, opt)
@@ -102,8 +82,8 @@ function main(target, opt)
end
-- make sure user flags have priority over default
- local user_flags = target:values("qt.deploy.flags")
- if not _check_flags_contain_release_or_debug(user_flags) then
+ local user_flags = table.wrap(target:values("qt.deploy.flags"))
+ if table.contains(user_flags, "--debug", "--release") then
if is_mode("debug") then
table.insert(argv, "--debug")
else
diff --git a/xmake/rules/qt/install/windows.lua b/xmake/rules/qt/install/windows.lua
index 9b7f012c6..7b8436e1b 100644
--- a/xmake/rules/qt/install/windows.lua
+++ b/xmake/rules/qt/install/windows.lua
@@ -31,26 +31,6 @@ function _get_installdir(target)
return installdir
end
-function _check_flag_is_release_or_debug(flags)
- return flags:find("--debug", 1, true) or flags:find("--release", 1, true)
-end
-
-function _check_flags_contain_release_or_debug(flags)
- local type_of_flags = type(flags)
- if type_of_flags == string then
- return _check_flag_is_release_or_debug(flags)
- elseif type_of_flags == table then
- for _, flag in ipairs(flags) do
- if _check_flag_is_release_or_debug(flags) then
- return true
- end
- end
- return false
- else
- return false
- end
-end
-
-- install application package for windows
function main(target, opt)
@@ -112,8 +92,8 @@ function main(target, opt)
end
-- make sure user flags have priority over default
- local user_flags = target:values("qt.deploy.flags")
- if not _check_flags_contain_release_or_debug(user_flags) then
+ local user_flags = table.wrap(target:values("qt.deploy.flags"))
+ if table.contains(user_flags, "--debug", "--release") then
if is_mode("debug") then
table.insert(argv, "--debug")
else