mirror of
https://github.com/QuasarApp/qt-android-cmake.git
synced 2025-04-28 06:34:35 +00:00
Added the VERSION_CODE argument to the macro, using a valid default number if not provided (no longer tied to the target's VERSION property)
Increased the minimum SDK version to 18 (required by Qt) Updated the documentation
This commit is contained in:
parent
19ed20d8dc
commit
365a2946da
@ -65,6 +65,7 @@ include(CMakeParseArguments)
|
||||
# example:
|
||||
# add_qt_android_apk(my_app_apk my_app
|
||||
# NAME "My App"
|
||||
# VERSION_CODE 12
|
||||
# PACKAGE_NAME "org.mycompany.myapp"
|
||||
# PACKAGE_SOURCES ${CMAKE_CURRENT_LIST_DIR}/my-android-sources
|
||||
# KEYSTORE ${CMAKE_CURRENT_LIST_DIR}/mykey.keystore myalias
|
||||
@ -76,7 +77,7 @@ include(CMakeParseArguments)
|
||||
macro(add_qt_android_apk TARGET SOURCE_TARGET)
|
||||
|
||||
# parse the macro arguments
|
||||
cmake_parse_arguments(ARG "INSTALL" "NAME;PACKAGE_NAME;PACKAGE_SOURCES;KEYSTORE_PASSWORD" "DEPENDS;KEYSTORE" ${ARGN})
|
||||
cmake_parse_arguments(ARG "INSTALL" "NAME;VERSION_CODE;PACKAGE_NAME;PACKAGE_SOURCES;KEYSTORE_PASSWORD" "DEPENDS;KEYSTORE" ${ARGN})
|
||||
|
||||
# check the configuration
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
@ -110,11 +111,17 @@ macro(add_qt_android_apk TARGET SOURCE_TARGET)
|
||||
if(ARG_PACKAGE_SOURCES)
|
||||
set(QT_ANDROID_APP_PACKAGE_SOURCE_ROOT ${ARG_PACKAGE_SOURCES})
|
||||
else()
|
||||
# get app version
|
||||
get_property(QT_ANDROID_APP_VERSION TARGET ${SOURCE_TARGET} PROPERTY VERSION)
|
||||
# get version code from arguments, or generate a fixed one if not provided
|
||||
set(QT_ANDROID_APP_VERSION_CODE ${ARG_VERSION_CODE})
|
||||
if(NOT QT_ANDROID_APP_VERSION_CODE)
|
||||
set(QT_ANDROID_APP_VERSION_CODE 1)
|
||||
endif()
|
||||
|
||||
# use the major version number for code version (must be a single number)
|
||||
string(REGEX MATCH "[0-9]+" QT_ANDROID_APP_VERSION_CODE "${QT_ANDROID_APP_VERSION}")
|
||||
# try to extract the app version from the target properties, or use the version code if not provided
|
||||
get_property(QT_ANDROID_APP_VERSION TARGET ${SOURCE_TARGET} PROPERTY VERSION)
|
||||
if(NOT QT_ANDROID_APP_VERSION)
|
||||
set(QT_ANDROID_APP_VERSION ${QT_ANDROID_APP_VERSION_CODE})
|
||||
endif()
|
||||
|
||||
# create a subdirectory for the extra package sources
|
||||
set(QT_ANDROID_APP_PACKAGE_SOURCE_ROOT "${CMAKE_CURRENT_BINARY_DIR}/package")
|
||||
|
@ -28,6 +28,6 @@
|
||||
</activity>
|
||||
</application>
|
||||
<supports-screens android:anyDensity="true" android:normalScreens="true" android:smallScreens="true" android:largeScreens="true"/>
|
||||
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="19"/>
|
||||
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="19"/>
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
</manifest>
|
||||
|
14
readme.md
14
readme.md
@ -102,6 +102,20 @@ add_qt_android_apk(my_app_apk my_app
|
||||
)
|
||||
```
|
||||
|
||||
### VERSION_CODE
|
||||
|
||||
The internal version of the application. It must be a single number, incremented everytime your app is updated on the play store (otherwise it has no importance). If not given, the number 1 is used.
|
||||
|
||||
Note that the public version of the application, which is a different thing, is taken from the VERSION property of the CMake target. If none is provided, the VERSION_CODE number is used.
|
||||
|
||||
Example:
|
||||
|
||||
```cmake
|
||||
add_qt_android_apk(my_app_apk my_app
|
||||
VERSION_CODE 6
|
||||
)
|
||||
```
|
||||
|
||||
### PACKAGE_NAME
|
||||
|
||||
The name of the application package. If not given, "org.qtproject.${source_target}" , where source_target is the name of the source target, is taken.
|
||||
|
Loading…
x
Reference in New Issue
Block a user