-
-
Notifications
You must be signed in to change notification settings - Fork 784
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
Support Qt/Android build and deploy #404
Comments
Qt/android doesn't support it yet, I haven't tested it yet. I will support it in the next version. If you are interested, you can help support it and submit a pr. |
I have fixed this problem in dev branch. I have tested it and build passed for qt/android on macOS. But on windows, I have not tested it yet. |
We need not set
|
Ok, I removed it.
I was able to build the project, but still need to attach to AndroidDeployQt.
|
After you updated the dev branch version, has it been built successfully? |
I use the dev version and compiled normally generating a linux binary. But it would be nice if it were a library to attach to androiddeployqt |
You can write a custom script(on_install) in xmake.lua to deploy target. target("test")
...
on_install(function (target)
io.writefile("$(buildir)/android_deployment_settings.json", "xxxxxx")
os.exec("androiddeployqt.exe --input $(buildir)/android_deployment_settings.json --output $(buildir)/android-build --android-platform $(ndk) --jdk \"C:/Program Files/Java/jdk1.8.0_211\" --gradle --gdbserver")
end) Then you can run |
Output:[install]
|
Please add xmake install -v -D |
Diagnostic:
|
When I use the command prompt itself the same execution code returns this:
|
os.exec("C:\\msys64\\clang64\\bin\\androiddeployqt.exe --input build\\android_deployment_settings.json --output build\\android-build --android-platform 24 --jdk \"C:\\Program Files\\Java\\jdk1.8.0_211\" --gradle --gdbserver") |
Or os.exec("C:\\msys64\\clang64\\bin\\androiddeployqt.exe", {"--input", "build\\android_deployment_settings.json", "--output", "build\\android-build", "--android-platform", "24", "--jdk", "C:\\Program Files\\Java\\jdk1.8.0_211", "--gradle", "--gdbserver"}) |
I just provide an example code to tell you that you can customize the install script to implement a custom deployment. How to implement it requires you to do it yourself. Don't copy the example code I provided directly. |
Same error:
|
io.writefile("$(buildir)/android_deployment_settings.json", [[{
"application-binary": "%s/ProjectName",
"description": "This file is generated by androiddeployqt and should not be modified by hand.",
"ndk": "%s",
"ndk-host": "windows-x86_64",
"qml-root-path": "",
"qt": "%s",
"sdk": "C:/Users/kassane/AppData/Local/Android/Sdk",
"sdkBuildToolsRevision": "28.0.3",
"stdcpp-path": "%s/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so",
"target-architecture": "armeabi-v7a",
"tool-prefix": "llvm",
"toolchain-prefix": "llvm",
"useLLVM": true
}]], get_config("buildir"), get_config("ndk"), get_config("qt"), get_config("ndk")) |
Or you can use target("xxx")
add_configfiles("android_deployment_settings.json.in")
set_configvar("ndk", get_config("ndk"))
set_configvar("qt", get_config("qt"))
set_configvar("buildir", get_config("buildir"))
android_deployment_settings.json.in
|
Project test: https://github.com/kassane/qt-android-example-xmake |
For the 3rdparty part always occurs an error at least in windows. |
I improved the xmake.lua and android_deployment_settings.json.in files, but you still need to handle some vars and pathes with Please update xmake dev version first, I fixed some problems. If you want to know verbose install errors, you can run |
Output:
|
I modified it on the dev branch, you can try again. |
xmake dev updated.
|
You can first study how to use androiddeployqt, and I will support the built-in deployment qt program to android in the next version. |
I have supported androiddeployqt for Please update dev branch of xmake to try it again. For example: $ xmake create -t quickapp_qt -l c++ appdemo
$ cd appdemo
$ xmake f -p android --ndk=~/Downloads/android-ndk-r19c/ --android_sdk=~/Library/Android/sdk/ -c
$ xmake
[ 0%]: compiling.qt.qrc src/qml.qrc
[ 50%]: ccache compiling.release src/main.cpp
[100%]: linking.release libappdemo.so
[100%]: generating.qt.app appdemo.apk It will compile and generate an apk file, then we can install this apk: $ xmake install
installing appdemo ...
installing build/android/armv7-a/release/appdemo.apk ..
Success
install ok!👌 The xmake.lua file add_rules("mode.debug", "mode.release")
target("appdemo")
add_rules("qt.application")
add_headerfiles("src/*.h")
add_files("src/*.cpp")
add_files("src/qml.qrc")
add_frameworks("QtQuick") Note: I have only tested it on macos at present, and have not tested it on windows. And we need high version ndk, e.g. android-ndk-r19c I have improved your example project and tested it on macOS. |
I tested on Linux is works!
Windows 10:
I have installed the platforms in |
I don't have a windows environment right now, you can try to improve the following code. xmake/xmake/rules/qt/xmake.lua Line 96 in 75a5962
|
I am trying to compile for android the quickapp_qt project to test, but this occurs:
Commands:
Output:
The text was updated successfully, but these errors were encountered: