diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2019-06-03 15:28:52 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2019-06-03 14:14:01 +0000 |
commit | 46effc7319582fb10c5d3fc4737f6e1b2f9c3e8b (patch) | |
tree | b406cdd3c35a1a92666f070b9da3fb4c4fee3a6f /cmake/README.md | |
parent | 5591e821358b9111c79336a66eac4d04bb5811ba (diff) |
Add some basic instructions for cross-compiling for Android
Change-Id: I0113a7b1e4e3b4d2fc7f93f9809d08fcaf4715d7
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/README.md')
-rw-r--r-- | cmake/README.md | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cmake/README.md b/cmake/README.md index 7b38877831..e7c7ced227 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -121,6 +121,21 @@ In order to make sure that Qt picks up the code generator tools from the host bu The specified path needs to point to a directory that contains an installed host build of Qt. +### Cross Compiling for Android + +In order to cross-compile Qt to Android, the above instructions apply. In addition, it is necessary to install the Android NDK as well as vcpkg. Vcpkg is needed to supply third-party libraries that Qt requires but that are not part of the Android NDK. + +Vcpkg for Android can be set up using the following steps: + + * ```git clone -b qt https://github.com/tronical/vcpkg``` + * Run ```bootstrap-vcpkg.bat``` or ```bootstrap-vcpkg.sh``` + * Set the ``VCPKG_DEFAULT_TRIPLET`` environment variable to ``arm-android`` + * Set the ``ANDROID_NDK_HOME`` environment variable to the path where you have installed the Android NDK. + * Build Qt dependencies: ``vcpkg install zlib pcre2 harfbuzz freetype openssl zstd`` + +When running cmake in qtbase, pass ``-DCMAKE_TOOLCHAIN_FILE=/path/to/your/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake -DVCPKG_TARGET_TRIPLET=$VCPKG_DEFAULT_TRIPLET -DQT_HOST_PATH=/path/to/your/host/build`` + + # Debugging CMake files CMake allows specifying the ``--trace`` and ``--trace-expand`` options, which work like ``qmake -d -d``: As the cmake code is evaluated, the values of parameters and variables is shown. This can be a lot of output, so you may want to redirect it to a file. |