From 68a3eac3dcd93793f2ec8e73c86b02d031239f31 Mon Sep 17 00:00:00 2001 From: Arthur LAURENT Date: Sat, 25 Jun 2022 20:41:55 +0200 Subject: Support of custom QML2_IMPORT_PATH and auto-add output path to import custom qmlplugins --- xmake/rules/qt/env/xmake.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xmake/rules/qt/env/xmake.lua b/xmake/rules/qt/env/xmake.lua index 4cc39794c..fa62fdf78 100644 --- a/xmake/rules/qt/env/xmake.lua +++ b/xmake/rules/qt/env/xmake.lua @@ -30,13 +30,18 @@ rule("qt.env") qt = assert(find_qt(nil, {verbose = true}), "Qt SDK not found!") target:data_set("qt", qt) end + + local qmlimportpath = target:get("qt.env.qmlimportpath") or {} if target:is_plat("windows") or (target:is_plat("mingw") and is_host("windows")) then target:add("runenvs", "PATH", qt.bindir) - target:set("runenv", "QML2_IMPORT_PATH", qt.qmldir) + table.append(qmlimportpath, qt.qmldir) + -- add targetdir in QML2_IMPORT_PATH in case of the user have qml plugins + table.append(qmlimportpath, target:targetdir()) target:set("runenv", "QML_IMPORT_TRACE", "1") elseif target:is_plat("msys", "cygwin") then raise("please run `xmake f -p mingw --mingw=/mingw64` to support Qt/Mingw64 on Msys!") end + target:set("runenv", "QML2_IMPORT_PATH", qmlimportpath) end) -- cgit v1.3.1 From cc71abf732f2e45f93674f65a1e2daba161315bd Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 27 Jun 2022 09:48:42 +0800 Subject: Update xmake.lua --- xmake/rules/qt/env/xmake.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xmake/rules/qt/env/xmake.lua b/xmake/rules/qt/env/xmake.lua index fa62fdf78..592ef07d9 100644 --- a/xmake/rules/qt/env/xmake.lua +++ b/xmake/rules/qt/env/xmake.lua @@ -31,7 +31,7 @@ rule("qt.env") target:data_set("qt", qt) end - local qmlimportpath = target:get("qt.env.qmlimportpath") or {} + local qmlimportpath = target:values("qt.env.qmlimportpath") or {} if target:is_plat("windows") or (target:is_plat("mingw") and is_host("windows")) then target:add("runenvs", "PATH", qt.bindir) table.append(qmlimportpath, qt.qmldir) -- cgit v1.3.1