-
Notifications
You must be signed in to change notification settings - Fork 7
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
Android support #33
Labels
Comments
Work in progress 2024-09-21
FROM raymii/qt:5.15-android-source
RUN wget 'https://go.dev/dl/go1.23.1.linux-amd64.tar.gz' && \
tar x -C /usr/local/ -f go1.23.1.linux-amd64.tar.gz && \
rm go1.23.1.linux-amd64.tar.gz
ENV PATH=/usr/local/go/bin:/opt/cmake/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/Qt-5.15.13/bin:/opt/android-sdk/cmdline-tools/tools/bin:/opt/android-sdk/tools:/opt/android-sdk/tools/bin:/opt/android-sdk/platform-tools
ENV CC=/opt/android-sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang
ENV CXX=/opt/android-sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang++
ENV CGO_ENABLED=1
ENV GOOS=android
ENV GOARCH=arm64
ENV GOFLAGS=-buildvcs=false
{
"_description": "Available fields are documented in the template file at /usr/local/Qt-5.15.13/mkspecs/features/android/android_deployment_settings.prf",
"application-binary": "handbindings",
"architectures": {
"arm64-v8a" : "aarch64-linux-android"
},
"android-extra-libs": "/opt/android_openssl/ssl_1.1/arm64-v8a/libssl.so,/opt/android_openssl/ssl_1.1/arm64-v8a/libssl_1_1.so,/opt/android_openssl/ssl_1.1/arm64-v8a/libcrypto.so,/opt/android_openssl/ssl_1.1/arm64-v8a/libcrypto_1_1.so",
"android-min-sdk-version": "23",
"android-target-sdk-version": "30",
"ndk": "/opt/android-sdk/ndk/22.1.7171670",
"ndk-host": "linux-x86_64",
"qml-root-path": "/miqt/cmd/handbindings",
"qt": "/usr/local/Qt-5.15.13/",
"sdk": "/opt/android-sdk",
"sdkBuildToolsRevision": "30.0.2",
"stdcpp-path": "/opt/android-sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/",
"tool-prefix": "llvm",
"toolchain-prefix": "llvm",
"useLLVM": true
}
//+build android
package main
/*
#cgo CXXFLAGS: -DQT_WIDGETS_LIB -I/usr/local/Qt-5.15.13/include/QtWidgets -I/usr/local/Qt-5.15.13/include/ -I/usr/local/Qt-5.15.13/include/QtCore -DQT_GUI_LIB -I/usr/local/Qt-5.15.13/include/QtGui -DQT_CORE_LIB
#cgo LDFLAGS: /usr/local/Qt-5.15.13/lib/libQt5Widgets_arm64-v8a.so /usr/local/Qt-5.15.13/lib/libQt5Gui_arm64-v8a.so /usr/local/Qt-5.15.13/lib/libQt5Core_arm64-v8a.so
// or
#cgo CXXFLAGS: -fPIC -DQT_WIDGETS_LIB -I/usr/local/Qt-5.15.13/include/QtWidgets -I/usr/local/Qt-5.15.13/include/ -I/usr/local/Qt-5.15.13/include/QtCore -DQT_GUI_LIB -I/usr/local/Qt-5.15.13/include/QtGui -DQT_CORE_LIB
#cgo LDFLAGS: /usr/local/Qt-5.15.13/lib/libQt5Widgets_arm64-v8a.so /usr/local/Qt-5.15.13/lib/libQt5Gui_arm64-v8a.so /usr/local/Qt-5.15.13/lib/libQt5Core_arm64-v8a.so /usr/local/Qt-5.15.13/lib/libQt5Svg_arm64-v8a.so
*/
import "C"
docker run --rm -v $(pwd):/miqt -it raymii/qt:5.15-android-source
go build -ldflags "-s -w" -o android-build/libs/arm64-v8a/libhandbindings_arm64-v8a.so
# or
go build -buildmode c-shared -ldflags "-s -w -extldflags -Wl,-soname,libhandbindings_arm64-v8a.so" -o android-build/libs/arm64-v8a/libhandbindings_arm64-v8a.so
androiddeployqt --input ./android-deployment-settings.json --output ./android-build/
# Can add --release However, the resulting app segfaults on my test device (Android 13):
|
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Miqt should support easily compiling Qt Widgets apps for Android.
The text was updated successfully, but these errors were encountered: