summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-05-09 23:17:58 +0800
committerruki <[email protected]>2019-05-09 13:47:51 +0800
commit916c855f1703b84e323b2531a61c7d60fefbb61d (patch)
tree645a4c55caecbffceb823e6ba5032fc020bdf1c4
parent1911e7fbb69ce21d803d30d61030e2c4d765fb64 (diff)
improve mode rules
-rw-r--r--xmake/rules/mode/xmake.lua20
-rw-r--r--xmake/rules/qt/load.lua14
2 files changed, 24 insertions, 10 deletions
diff --git a/xmake/rules/mode/xmake.lua b/xmake/rules/mode/xmake.lua
index 787cb667c..99813ade8 100644
--- a/xmake/rules/mode/xmake.lua
+++ b/xmake/rules/mode/xmake.lua
@@ -20,28 +20,32 @@
-- define rule: debug mode
rule("mode.debug")
- on_load(function (target)
+ after_load(function (target)
-- is debug mode now? xmake f -m debug
if is_mode("debug") then
-- enable the debug symbols
- target:set("symbols", "debug")
+ if not target:get("symbols") then
+ target:set("symbols", "debug")
+ end
-- disable optimization
- target:set("optimize", "none")
+ if not target:get("optimize") then
+ target:set("optimize", "none")
+ end
end
end)
-- define rule: release mode
rule("mode.release")
- on_load(function (target)
+ after_load(function (target)
-- is release mode now? xmake f -m release
if is_mode("release") then
-- set the symbols visibility: hidden
- if not target:get("symbols") then
+ if not target:get("symbols") and target:targetkind() ~= "shared" then
target:set("symbols", "hidden")
end
@@ -59,7 +63,7 @@ rule("mode.release")
-- define rule: profile mode
rule("mode.profile")
- on_load(function (target)
+ after_load(function (target)
-- is profile mode now? xmake f -m profile
if is_mode("profile") then
@@ -83,7 +87,7 @@ rule("mode.profile")
-- define rule: check mode
rule("mode.check")
- on_load(function (target)
+ after_load(function (target)
-- is check mode now? xmake f -m check
if is_mode("check") then
@@ -109,7 +113,7 @@ rule("mode.check")
-- define rule: coverage mode
rule("mode.coverage")
- on_load(function (target)
+ after_load(function (target)
-- is coverage mode now? xmake f -m coverage
if is_mode("coverage") then
diff --git a/xmake/rules/qt/load.lua b/xmake/rules/qt/load.lua
index 9be3de97c..61dc3104f 100644
--- a/xmake/rules/qt/load.lua
+++ b/xmake/rules/qt/load.lua
@@ -25,7 +25,12 @@ import("core.project.target")
-- make link for framework
function _link(framework, major)
if major and framework:startswith("Qt") then
- local debug_suffix = is_plat("windows") and "d" or "_debug"
+ local debug_suffix = "_debug"
+ if is_plat("windows") then
+ debug_suffix = "d"
+ elseif is_plat("android") then
+ debug_suffix = ""
+ end
framework = "Qt" .. major .. framework:sub(3) .. (is_mode("debug") and debug_suffix or "")
end
return framework
@@ -34,7 +39,12 @@ end
-- find the static links from the given qt link directories, e.g. libqt*.a
function _find_static_links(linkdirs, libpattern)
local links = {}
- local debug_suffix = is_plat("windows") and "d" or "_debug"
+ local debug_suffix = "_debug"
+ if is_plat("windows") then
+ debug_suffix = "d"
+ elseif is_plat("android") then
+ debug_suffix = ""
+ end
for _, linkdir in ipairs(linkdirs) do
for _, libpath in ipairs(os.files(path.join(linkdir, libpattern))) do
local basename = path.basename(libpath)