Peter
Peter

Reputation: 11920

Building Qt for ARM and x86

For the Android project I am working on, I need to link my native code with Qt Base. I found the docs on building Qt for Android at http://qt-project.org/wiki/Android. However, the docs don't seem to mention how to configure the build for x86 and ARM. Wondering if someone can point me in the right direction. Thinking I might have to create two different source directories so that ./configure can be run separately for each platform.

Upvotes: 2

Views: 2504

Answers (2)

Prismatic
Prismatic

Reputation: 3348

If you type in

./configure --help

You'll get some additional information on options to configure an Android build:

Android options:

    -android-sdk path .............. The Android SDK root path.
                                     (default $ANDROID_SDK_ROOT)

    -android-ndk path .............. The Android NDK root path.
                                     (default $ANDROID_NDK_ROOT)

    -android-ndk-platform .......... Sets the android platform
                                     (default android-9)

    -android-ndk-host .............. Sets the android NDK host (linux-x86, linux-x86_64, etc.)
                                     (default $ANDROID_NDK_HOST)

    -android-arch .................. Sets the android architecture (armeabi, armeabi-v7a, x86, mips)
                                     (default armeabi-v7a)

    -android-toolchain-version ..... Sets the android toolchain version
                                     (default 4.8)

    -no-android-style-assets ....... Do not compile in the code which automatically extracts
                                     style assets from the run-time device. Setting this will
                                     make the Android style behave incorrectly, but will enable
                                     compatibility with the LGPL2.1 license.
 *  -android-style-assets .......... Compile the code which automatically extracts style assets
                                     from the run-time device. This option will make the
                                     Android platform plugin incompatible with the LGPL2.1.

To specify the architecture, use the android-arch flag.

Upvotes: 4

Luca Carlon
Luca Carlon

Reputation: 9996

That document explains how to configure precisely:

$ /path/to/qt/configure -developer-build -xplatform android-g++ -android-ndk /opt/android-ndk -android-sdk /opt/android-sdk -nomake tests -nomake examples -opensource -confirm-license

Why do you say it does not explain how to configure? -xplatform android-g++ sets the platform, then it sets the location of both the SDK and of the NDK. Don't use -developer-build if you want to build with the same source tree. Use -prefix instead. Otherwise use -developer-build and duplicate the source tree.

Building for x86 is almost identical. Refer to this: http://qt-project.org/wiki/Building_Qt_5_from_Git.

But, if you don't specifically need to build, you can simply install the prebuilt binaries for Android. Use the online installer for that http://www.qt.io/download/. It includes the libs, the headers and Qt Creator. You'll need the Android SDK and NDK.

Upvotes: 2

Related Questions