summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-11-16 23:17:57 +0800
committerruki <[email protected]>2020-11-16 23:17:57 +0800
commit6079e8c0b93593745b8b0bbe13510a3316f5e57c (patch)
tree45570fbdd0f22407d3c068ad1d0848417e1a4691
parent055669930d7d250894cd7aa7881b8e203b9e700c (diff)
improve qt rules
-rw-r--r--xmake/rules/qt/load.lua6
-rw-r--r--xmake/rules/qt/xmake.lua42
2 files changed, 42 insertions, 6 deletions
diff --git a/xmake/rules/qt/load.lua b/xmake/rules/qt/load.lua
index d0168ab38..e8268203b 100644
--- a/xmake/rules/qt/load.lua
+++ b/xmake/rules/qt/load.lua
@@ -199,7 +199,7 @@ function main(target, opt)
-- add includedirs
if is_plat("macosx") then
local frameworkdir = path.join(qt.libdir, framework .. ".framework")
- if os.isdir(frameworkdir) then
+ if os.isdir(frameworkdir) and not framework:endswith("Support") then
target:add("includedirs", path.join(frameworkdir, "Headers"))
useframeworks = true
else
@@ -217,7 +217,9 @@ function main(target, opt)
-- remove private frameworks
local local_frameworks = {}
for _, framework in ipairs(target:get("frameworks")) do
- if not framework:lower():endswith("private") then
+ if target:is_plat("macosx") and framework:endswith("Support") then
+ -- we need handle Qt*Support as plain links, e.g. QtPlatformSupport
+ elseif not framework:lower():endswith("private") then
table.insert(local_frameworks, framework)
end
end
diff --git a/xmake/rules/qt/xmake.lua b/xmake/rules/qt/xmake.lua
index ce65651fe..2428c695b 100644
--- a/xmake/rules/qt/xmake.lua
+++ b/xmake/rules/qt/xmake.lua
@@ -105,14 +105,31 @@ rule("qt.widgetapp_static")
end)
after_load(function (target)
+
+ -- get qt sdk version
+ local qt = target:data("qt")
+ local qt_sdkver = nil
+ if qt.sdkver then
+ import("core.base.semver")
+ qt_sdkver = semver.new(qt.sdkver)
+ end
+
+ -- get QtPlatformSupport/QtPlatformCompositorSupport for >=5.9
+ -- https://github.com/xmake-io/xmake/issues/1047
+ local QtPlatformSupport = "QtPlatformSupport"
+ if qt_sdkver and qt_sdkver:ge("5.9") then
+ QtPlatformSupport = "QtPlatformCompositorSupport"
+ end
+
+ -- laod some basic plugins and frameworks
local plugins = {}
local frameworks = {"QtGui", "QtWidgets", "QtCore"}
if target:is_plat("macosx") then
plugins.QCocoaIntegrationPlugin = {linkdirs = "plugins/platforms", links = {"qcocoa", "cups"}}
- table.join2(frameworks, "QtPrintSupport", "QtPlatformSupport", "QtWidgets")
+ table.join2(frameworks, QtPlatformSupport, "QtWidgets")
elseif target:is_plat("windows") then
plugins.QWindowsIntegrationPlugin = {linkdirs = "plugins/platforms", links = {is_mode("debug") and "qwindowsd" or "qwindows"}}
- table.join2(frameworks, "QtPrintSupport", "QtPlatformSupport", "QtWidgets")
+ table.join2(frameworks, "QtPrintSupport", QtPlatformSupport, "QtWidgets")
elseif target:is_plat("wasm") then
plugins.QWasmIntegrationPlugin = {linkdirs = "plugins/platforms", links = {"qwasm"}}
table.join2(frameworks, "QtEventDispatcherSupport", "QtFontDatabaseSupport", "QtEglSupport")
@@ -157,14 +174,31 @@ rule("qt.quickapp_static")
end)
after_load(function (target)
+
+ -- get qt sdk version
+ local qt = target:data("qt")
+ local qt_sdkver = nil
+ if qt.sdkver then
+ import("core.base.semver")
+ qt_sdkver = semver.new(qt.sdkver)
+ end
+
+ -- get QtPlatformSupport/QtPlatformCompositorSupport for >=5.9
+ -- https://github.com/xmake-io/xmake/issues/1047
+ local QtPlatformSupport = "QtPlatformSupport"
+ if qt_sdkver and qt_sdkver:ge("5.9") then
+ QtPlatformSupport = "QtPlatformCompositorSupport"
+ end
+
+ -- laod some basic plugins and frameworks
local plugins = {}
local frameworks = {"QtGui", "QtQuick", "QtQml", "QtQmlModels", "QtCore", "QtNetwork"}
if target:is_plat("macosx") then
plugins.QCocoaIntegrationPlugin = {linkdirs = "plugins/platforms", links = {"qcocoa", "cups"}}
- table.join2(frameworks, "QtPrintSupport", "QtPlatformSupport", "QtWidgets")
+ table.join2(frameworks, QtPlatformSupport, "QtWidgets")
elseif target:is_plat("windows") then
plugins.QWindowsIntegrationPlugin = {linkdirs = "plugins/platforms", links = {is_mode("debug") and "qwindowsd" or "qwindows"}}
- table.join2(frameworks, "QtPrintSupport", "QtPlatformSupport", "QtWidgets")
+ table.join2(frameworks, "QtPrintSupport", QtPlatformSupport, "QtWidgets")
elseif target:is_plat("wasm") then
plugins.QWasmIntegrationPlugin = {linkdirs = "plugins/platforms", links = {"qwasm"}}
table.join2(frameworks, "QtEventDispatcherSupport", "QtFontDatabaseSupport", "QtEglSupport")