diff options
| author | ruki <[email protected]> | 2019-04-19 22:35:58 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-04-19 09:35:52 +0800 |
| commit | 76fcea2d9a8a715c3ce347174ab7b3bae6d3914a (patch) | |
| tree | c24fa1b56431aca13ddd4daa1157729f13a68f03 | |
| parent | a33f46b744ffd1802aaaa325192819b91da0a391 (diff) | |
fix some bug
| -rw-r--r-- | xmake/core/language/language.lua | 2 | ||||
| -rw-r--r-- | xmake/core/platform/platform.lua | 2 | ||||
| -rw-r--r-- | xmake/rules/qt/load.lua | 5 | ||||
| -rw-r--r-- | xmake/rules/qt/xmake.lua | 28 |
4 files changed, 26 insertions, 11 deletions
diff --git a/xmake/core/language/language.lua b/xmake/core/language/language.lua index 1c76fbe12..682532dcf 100644 --- a/xmake/core/language/language.lua +++ b/xmake/core/language/language.lua @@ -613,7 +613,7 @@ function language.linkerinfos_of(targetkind, sourcekinds) -- find suitable linkers local results = {} - for _, linkerinfo in pairs(linkerinfos[targetkind]) do + for _, linkerinfo in pairs(table.wrap(linkerinfos[targetkind])) do -- match all source kinds? local count = 0 diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua index 578db88b0..36c3ca2b3 100644 --- a/xmake/core/platform/platform.lua +++ b/xmake/core/platform/platform.lua @@ -333,7 +333,7 @@ function platform.tool(toolkind) end -- contain toolname? parse it, .e.g '[email protected]' - if program then + if program and type(program) == "string" then local pos = program:find('@', 1, true) if pos then toolname = program:sub(1, pos - 1) diff --git a/xmake/rules/qt/load.lua b/xmake/rules/qt/load.lua index 47abfabfd..9be3de97c 100644 --- a/xmake/rules/qt/load.lua +++ b/xmake/rules/qt/load.lua @@ -61,11 +61,6 @@ function main(target, opt) major = qt.sdkver:split('%.')[1] end - -- set kind - if opt.kind then - target:set("kind", opt.kind) - end - -- add -fPIC target:add("cxflags", "-fPIC") target:add("mxflags", "-fPIC") diff --git a/xmake/rules/qt/xmake.lua b/xmake/rules/qt/xmake.lua index 8d2e73626..beb87f7f9 100644 --- a/xmake/rules/qt/xmake.lua +++ b/xmake/rules/qt/xmake.lua @@ -24,9 +24,14 @@ rule("qt.static") -- add rules add_deps("qt.qrc", "qt.ui", "qt.moc") + -- we must set kind before target.on_load(), may we will use target in on_load() + before_load(function (target) + target:set("kind", "static") + end) + -- after load after_load(function (target) - import("load")(target, {kind = "static", frameworks = {"QtCore"}}) + import("load")(target, {frameworks = {"QtCore"}}) end) -- define rule: qt shared library @@ -35,9 +40,14 @@ rule("qt.shared") -- add rules add_deps("qt.qrc", "qt.ui", "qt.moc") + -- we must set kind before target.on_load(), may we will use target in on_load() + before_load(function (target) + target:set("kind", "shared") + end) + -- after load after_load(function (target) - import("load")(target, {kind = "shared", frameworks = {"QtCore"}}) + import("load")(target, {frameworks = {"QtCore"}}) end) -- define rule: qt console @@ -46,9 +56,14 @@ rule("qt.console") -- add rules add_deps("qt.qrc", "qt.ui", "qt.moc") + -- we must set kind before target.on_load(), may we will use target in on_load() + before_load(function (target) + target:set("kind", "binary") + end) + -- after load after_load(function (target) - import("load")(target, {kind = "binary", frameworks = {"QtCore"}}) + import("load")(target, {frameworks = {"QtCore"}}) end) -- define rule: qt application @@ -57,11 +72,16 @@ rule("qt.application") -- add rules add_deps("qt.qrc", "qt.ui", "qt.moc") + -- we must set kind before target.on_load(), may we will use target in on_load() + before_load(function (target) + target:set("kind", "binary") + end) + -- after load after_load(function (target) -- load common flags to target - import("load")(target, {kind = "binary", frameworks = {"QtGui", "QtQml", "QtNetwork", "QtCore"}}) + import("load")(target, {frameworks = {"QtGui", "QtQml", "QtNetwork", "QtCore"}}) -- add -subsystem:windows for windows platform if is_plat("windows") then |
