Support of custom QML2_IMPORT_PATH and auto-add output path to import custom qmlplugins
@@ -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)
