Releases: OlivierLDff/QtAndroidCMake
Releases · OlivierLDff/QtAndroidCMake
FetchContent support
A dummy CMakeLists.txt include the AddQtAndroidApk.cmake
file in order to include the macro with new CMake 3.11 feature FetchContent
include(FetchContent)
FetchContent_Declare(QtAndroidCMake
GIT_REPOSITORY "https://github.com/OlivierLDff/QtAndroidCMake"
GIT_TAG "v19.0.2"
)
FetchContent_MakeAvailable(QtAndroidCMake)
# Now add_qt_android_apk is available
add_qt_android_apk(YourTarget YourTargetApk)
Minor Change
- Refactor naming convention from UPPER_CASE to lower_case
- Remove endif(CONDITION) with just endif()
- Save bunch of crap in cache when include for later reuse (for FetchContent support)
Demo can be found in https://github.com/OlivierLDff/QQuickMaterialHelperGallery
Found CMake flags
- Add
QT_ANDROID_CMAKE_FOUND
CMake flag - Add
QT_ANDROID_CMAKE_VERSION
CMake variable to 19.0.1
Android Ndk r19 fix
Major thanks to freekee1 works (LaurentGomila#27)
Fixes
- Number version now match android ndk version.
- Only
c++_shared
is now supported. - Replace the use of LOCATION properties by generator expressions to acquire dependency target locations.
- Add an extra file(GENERATOR) call to evaluate generator expressions at build time.
- Added support for the LLVM/clang toolchain. Since NDK r19, it seems to be the default and androiddeployqt fails when trying to use the gcc tool and toolchain paths.
Example
# armv7 cmake command example
cmake -DCMAKE_PREFIX_PATH=C:/Qt/5.12.1/android_armv7 \
-G "Unix Makefiles" \
-DANDROID_ABI=armeabi-v7a \
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
-DANDROID_NATIVE_API_LEVEL=27 \
-DANDROID_STL=c++_shared \
-DANDROID_TOOLCHAIN=clang \
-DCMAKE_BUILD_TYPE=Release \
..
Tested with
- Windows 1803
- Qt 12.1
- Android ndk r19
ANDROID_MANIFEST_IN_PATH and VERBOSE fix
Fix ANDROID_MANIFEST_IN_PATH and VERBOSE argument that where not taken into account because of wrong variable name (ARGS instead of ARG, bad copy and paste error)
New Features
v1.1.0
- Customizable VERSION_NAME that can be set during the macro call.
- Allow to deploy a mix between having a PACKAGE_SOURCES and using a configurable
AndroidManifest.xml.in
. - Specify a custom
AndroidManifest.xml.in
with ANDROID_MANIFEST_IN_PATH during the macro call. - Warning when a static or none ANDROID_STL is specified.
- Move the minSdkVersion and targetSdkVersion from
AndroidManifest.xml.in
to abuild.gradle.in
to match new Android Policy. - Update the
AndroidManifest.xml.in
to the one inQt5.12.x
.qtandroiddeploy
will add the required permission depending on what is deployed. - The apk is build inside a folder
${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_TARGET}-${ANDROID_ABI}
. - Specify the
--release
or--debug
flag toqtandroiddeploy
.--release
: Release | MinSizeRel | RelWithDebInfo--debug
: Debug
--verbose
can now be specified with the VERBOSE macro argument.
For any question about this fork feel free to contact me.
Tested with qt5.11 qt5.12
on windows 1803
.