summaryrefslogtreecommitdiffstats
path: root/doc/src/platforms/android/android-building.qdoc
blob: 687c92cf2d1962a4b523481b61df1d9c24579430 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
    \page android-building.html
    \title Qt for Android - Building from Source
    \brief How to configure and build Qt for Android directly from source.
    \previouspage android-how-it-works.html
    \nextpage android-building-projects-from-commandline.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-w64 13.1 toolchain
    \endlist

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

    Install the prerequisites and append their binary paths to the system \c PATH:

    \badcode
        set MINGW_ROOT=<MINGW_ROOT_PATH>\bin
        set PATH=%MINGW_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

    With Qt 6, you can build Qt for Android from source code using \c CMake. Qt 6
    for Android requires a host Qt build, which means to build Qt for Android, you
    need to build Qt for the desktop platform used as a host (that is, Linux, \macos,
    or Windows). See \l{Cross-compiling Qt} for details.

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

    \badcode
    mkdir -p ~/dev/build-qt-android
    cd ~/dev/build-qt-android
    \endcode

    Qt for Android supports the following device architectures (ABIs): \AndroidAbis

    And then run the configure script:

    \badcode \NdkFullVer
    ./configure -prefix <install_path> -qt-host-path <qt_host_path> \
        -android-abis <abi> -android-sdk ~/Android/Sdk -android-ndk ~/Android/Sdk/ndk/\1
    \endcode

    \include src/platforms/android/android.qdoc Android SDK Paths

    \include use-ninja-note.qdocinc ninja-note

    \section1 Advanced Configure Arguments

    Qt for Android contains Java code which is compiled into \e {*.jar} files
    with the \e javac compiler. 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 the \c -prefix argument:

    \badcode
    -developer-build
    \endcode

    \note When using this configure argument, it's not required to install your
    Qt build, Qt for Android can be used directly from within the build directory.

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

    \section1 Building

    To build Qt, run the following command:

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

    \section1 Installing

    For prefix builds, to install Qt, run the following command:

    \badcode
    cmake --install .
    \endcode

    On Unix, if you haven't provided the \c{-prefix <install_path>} configure option,
    the installation is placed under \c{/usr/local/Qt-<version>}, in that case, you
    would need to use \c sudo with the install command.
*/