为ARM和x86构建Qt



对于我正在进行的Android项目,我需要将我的本地代码与Qt Base链接起来。我在上找到了构建Android版Qt的文档http://qt-project.org/wiki/Android.然而,这些文档似乎没有提到如何配置x86和ARM的构建。想知道是否有人能为我指明正确的方向。我想我可能必须创建两个不同的源目录,以便./configure可以分别为每个平台运行。

如果您键入

./configure --help

您将获得一些关于配置Android构建选项的附加信息:

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.

要指定架构,请使用android arch标志。

该文档解释了如何精确配置:

$ /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

为什么你说它没有解释如何配置-xplatformandroid-g++设置平台,然后设置SDK和NDK的位置。如果您想使用相同的源代码树进行构建,请不要使用developer构建。请改用-prefix。否则,使用developer构建并复制源树。

x86的构建几乎完全相同。请参阅:http://qt-project.org/wiki/Building_Qt_5_from_Git.

但是,如果你不特别需要构建,你可以简单地为Android安装预构建的二进制文件。请使用联机安装程序http://www.qt.io/download/.它包括库、头和Qt创建者。您将需要Android SDK和NDK。

最新更新