diff options
| author | jingkaimori <[email protected]> | 2024-07-23 14:29:28 +0800 |
|---|---|---|
| committer | jingkaimori <[email protected]> | 2024-07-23 14:29:28 +0800 |
| commit | 29b7e944629425f843ea65fa3231ba003f62d13c (patch) | |
| tree | b1bb4a984a82f3d51e84940624f516b8490a73c3 | |
| parent | 9e1643aee954cdadea3eba96f3242b0a55ab6898 (diff) | |
fix error when qt.deploy.flags policy is a table
| -rw-r--r-- | xmake/rules/qt/install/mingw.lua | 22 | ||||
| -rw-r--r-- | xmake/rules/qt/install/windows.lua | 22 |
2 files changed, 42 insertions, 2 deletions
diff --git a/xmake/rules/qt/install/mingw.lua b/xmake/rules/qt/install/mingw.lua index d3fce6990..d3fa02c6b 100644 --- a/xmake/rules/qt/install/mingw.lua +++ b/xmake/rules/qt/install/mingw.lua @@ -31,6 +31,26 @@ 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) @@ -83,7 +103,7 @@ function main(target, opt) -- make sure user flags have priority over default local user_flags = target:values("qt.deploy.flags") - if not user_flags or not (user_flags:find("--debug", 1, true) or user_flags:find("--release", 1, true)) then + if not _check_flags_contain_release_or_debug(user_flags) 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 06e61038b..9b7f012c6 100644 --- a/xmake/rules/qt/install/windows.lua +++ b/xmake/rules/qt/install/windows.lua @@ -31,6 +31,26 @@ 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) @@ -93,7 +113,7 @@ function main(target, opt) -- make sure user flags have priority over default local user_flags = target:values("qt.deploy.flags") - if not user_flags or not (user_flags:find("--debug", 1, true) or user_flags:find("--release", 1, true)) then + if not _check_flags_contain_release_or_debug(user_flags) then if is_mode("debug") then table.insert(argv, "--debug") else |
