-
-
Notifications
You must be signed in to change notification settings - Fork 817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add qt_host
Option to Enable Cross-Platform Qt Builds Using Host SDK Tools
#6097
Conversation
The Help message for qmake-qt5
|
It's important to note that qmake -query -qtconf ../sdk/6.9.0/llvm-mingw_64/bin/qt.conf The output shows:
Notice that $ xmake f -c -vD --qt=../sdk/6.9.0/llvm-mingw_64 --qt_host=../sdk/6.8.1/gcc_64 -p mingw The output shows:
The Qt SDK version should be 6.9.0 |
It is fixed now. |
Why is an additional qt_host needed? I remember that cross-compilation was also supported now. It can do cross-compilation for ios/android. xmake/xmake/modules/detect/sdks/find_qt.lua Lines 244 to 262 in 1ea11f3
and did you test qt5base/qt6base packages? it also supports cross-compilation without extra qt_host sdk. |
The current setup doesn't support building Qt applications for Linux on Windows, or vice versa. Regarding the
|
qt_host
Option to Enable Cross-Platform Qt Builds Using Host SDK Tools
This comment was marked as outdated.
This comment was marked as outdated.
Additional Notes:The Qt SDK consists of two main components: libraries and tools (e.g., Since Qt SDKs are not typically configured for cross-platform use, cross-compilation requires two separate SDKs:
|
xmake/rules/qt/moc/xmake.lua
Outdated
moc = path.join(qt.libexecdir_host, is_host("windows") and "moc.exe" or "moc") | ||
local moc | ||
local moc_name = is_host("windows") and "moc.exe" or "moc" | ||
for _, dir in ipairs({qt.bindir_host, qt.libexecdir_host, qt.bindir, qt.libexecdir}) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can use lib.detect.find_file
for _, dir in ipairs({qt.bindir_host, qt.libexecdir_host, qt.bindir, qt.libexecdir}) do | ||
if dir then | ||
qmltyperegistrar = path.join(dir, qmltyperegistrar_name) | ||
if os.isexec(qmltyperegistrar) then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
xmake/rules/qt/ts/xmake.lua
Outdated
for _, dir in ipairs({qt.bindir_host, qt.libexecdir_host, qt.bindir, qt.libexecdir}) do | ||
if dir then | ||
lupdate = path.join(dir, lupdate_name) | ||
if os.isexec(lupdate) then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
Did you test for qt5base/qt6base packages? |
qt5base/qt6base does not support cross-compilation well. Cross-compiling for desktop platforms is not supported, and Android targets are not enabled. |
2857d30
to
edb2d7f
Compare
xmake/rules/qt/ui/xmake.lua
Outdated
if not os.isexec(uic) and qt.libexecdir_host then | ||
uic = path.join(qt.libexecdir_host, is_host("windows") and "uic.exe" or "uic") | ||
end | ||
local uic = find_file(is_host("windows") and "uic.exe" or "uic", {qt.bindir_host, qt.libexecdir_host, qt.bindir, qt.libexecdir}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if dir is nil, e.g. {dir1, nil, dir2, dir3}
, find_file/ipairs will be broken.
local dirs = {}
if dir then
table.insert(dirs, dir)
end
return sdkver | ||
end | ||
-- Extract the actual SDK version from qconfig.pri | ||
local actual_sdkver = io.readfile(qconfig_path):match("QT_VERSION%s*=%s*(%S+)") -- Expected format: QT_VERSION = x.y.z |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
readfile maybe return nil
ba531a3
to
cd5a5d1
Compare
xmake/rules/qt/deploy/android.lua
Outdated
androiddeployqt = path.join(qt.bindir_host, "androiddeployqt" .. (is_host("windows") and ".exe" or "")) | ||
end | ||
local search_dirs = {} | ||
if qt.bindir_host then table.insert(search_dirs, qt.bindir_host ) end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove spaces, we don't need alignment
Thanks, can you help to update docs here https://xmake.io/#/guide/project_examples?id=supported-qt-sdks |
OK, I'd be happy to help |
This update introduces an option,
qt_host
, to facilitate cross-building of Qt desktop applications.Example Usage
Build a Qt Widgets app for MinGW on Linux
Using an SDK downloaded by
aqt
:Build a Qt Widgets app for Linux on Windows
Using an SDK downloaded by
aqt
and the Zig toolchain:Caution
qt.deploy
andqt.install
might cause cross-platform issues, aswindeployqt
andmacdeployqt
need to run on their native platforms.Tested Configurations
Cross-Builds:
Native Builds (Regression Tests):
aqt
)