/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page android-building.html
    \title Qt for Android - Building from Source
    \ingroup androidplatform
    \brief How to configure and build Qt for Android directly from source.
    \previouspage android-getting-started.html
    \nextpage android-building-user-projects.html

    This page describes the process of configuring and building
    \l{Qt for Android}. To download and install a pre-built Qt for Android,
    follow the instructions on the \l{Getting Started with Qt} page.

    \section1 Prerequisites

    To build Qt for Android from source please ensure all requirements
    from \l{Getting Started with Qt for Android} are met before continuing.

    \section2 Windows

    Building Qt for Android on Windows also requires the following software:

    \list
        \li MinGW 11.2 toolchain
        \li \l{Perl}
    \endlist

    \note Qt for Android does not support building from source with Microsoft Visual C++ (MSVC).

    Install the requirements, and set the \c PATH to include the
    newly installed binaries:

    \badcode
        set MINGW_ROOT=<MINGW_ROOT_PATH>\bin
        set PERL_ROOT=<PERL_ROOT_PATH>\bin
        set PATH=%MINGW_ROOT%;%PERL_ROOT%;%PATH%
    \endcode

    To verify the installation, run:

    \badcode
        where mingw32-make.exe
    \endcode

    The command should list mingw32-make.exe under the path \e {<MINGW_ROOT>} first.

    \section1 Getting the Sources

    You can download the Qt sources from the \l {Qt Downloads} page, or follow
    the wiki guide for \l {Getting the source code}.

    \section1 Configuring

    Qt 6 allows building Qt for Android from source code using \c CMake. Qt 6 keeps
    the same configure script from Qt 5. The main difference is that Qt for Android
    is dependent on a host Qt build, which means to build Qt for Android, you
    need to build Qt for the desktop platform used as a host (for example Linux,
    \macos, or Windows).

    To configure Qt for Android, create a shadow build directory to keep the source
    directory clean:

    \badcode
    mkdir <path_to_build_dir>/build-qt
    cd <path_to_build_dir>/build-qt

    <path_to_qt_source>/configure -platform android-clang -prefix </path/to/install> -android-ndk <path/to/sdk>/ndk/<ndk_version> -android-sdk <path/to/sdk> -qt-host-path <path_to_host_qt_installation> -android-abis arm64-v8a
    \endcode

    And then run the configure script:

    \badcode
    <path_to_qt_source>/configure -platform android-clang -prefix </path/to/install> -android-ndk $ANDROID_NDK_ROOT -android-sdk $ANDROID_SDK_ROOT -qt-host-path <path_to_host_qt_installation>
    \endcode

    \section2 Architectures

    Qt for Android supports the following ABIs:

    \include supported-platforms.qdocinc android

    To choose the ABI to build for, use the \e {-android-abis} feature of the
    configure script.

    \note \QtVer does not yet support being built for multiple ABIs at the same time.

    \section1 Advanced Configure Arguments

    Qt for Android contains Java code which is compiled into *.jar files with
    \e javac. To set the \e javac version for source and target, use \e -android-javac-source
    and \e -android-javac-target respectively:

    \badcode
    -android-javac-source 8 -android-javac-target 8
    \endcode

    To build Qt as a developer build instead of a prefix build, use the following
    instead of \c -prefix argument:

    \badcode
    -developer-build
    \endcode

    \l{Qt Configure Options} contains more information about the configure options.

    \section1 Building

    To build the configured Qt code, run the following command:

    \badcode
    cmake --build . --parallel
    \endcode

    \section1 Installing

    Now, to install Qt, run the following command:

    \badcode
    cmake --install .
    \endcode

    On Unix based OSes you should prefix the install command with the \c sudo command.

    If you haven't provided the \c{--prefix <install-dir>} configure option, the
    installation is placed under \c{/usr/local/Qt-<version>}.
*/
