diff options
author | Leander Beernaert <leander.beernaert@qt.io> | 2019-06-24 14:54:40 +0200 |
---|---|---|
committer | Leander Beernaert <leander.beernaert@qt.io> | 2019-06-26 08:34:37 +0000 |
commit | a9d2c5b6d7fa6b7365db8690f57aa78002c8bc4b (patch) | |
tree | 5b63c1cae2efb87c1039fce1094c7fbb5319509e /util | |
parent | ffec6c7180ce65f3aa20ca3f0016b23b702e73b2 (diff) |
Android: Final changes for APK generation
Generate the ${MODULE}-android-dependencies.xml for the androiddeployqt
tool. This will ensure all the right plugins and dependencies are
packaged when generating the apk.
This change also changes the visibility for executable to default/public.
Not having this will cause the application to crash as we can't locate
main() in the executable (shared library).
Additionally pro2cmake conversion script has been updated to perform
the required conversions for the Android settings.
Finally, the 6 projects in QtBase that have Android dependencies have
been updated with the new script and the step that produces the xml
files in run at the end in QtPostProcess.cmake.
Change-Id: I9774ba1b123bc11cae972fa37054ef2c51988498
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'util')
-rwxr-xr-x | util/cmake/pro2cmake.py | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 28724b1fc0..96e2bacae9 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -1536,6 +1536,32 @@ def write_simd_part(cm_fh: typing.IO[str], target: str, scope: Scope, indent: in header = 'add_qt_simd_part({} SIMD {}\n'.format(target, simd), footer = ')\n\n') +def write_android_part(cm_fh: typing.IO[str], target: str, scope:Scope, indent: int = 0): + keys = [ 'ANDROID_BUNDLED_JAR_DEPENDENCIES' + , 'ANDROID_LIB_DEPENDENCIES' + , 'ANDROID_JAR_DEPENDENCIES' + , 'ANDROID_LIB_DEPENDENCY_REPLACEMENTS' + , 'ANDROID_BUNDLED_FILES' + , 'ANDROID_PERMISSIONS' ] + + has_no_values = True + for key in keys: + value = scope.get(key) + if len(value) != 0: + if has_no_values: + if scope.condition: + cm_fh.write('\n{}if(ANDROID AND ({}))\n'.format(spaces(indent), scope.condition)) + else: + cm_fh.write('\n{}if(ANDROID)\n'.format(spaces(indent))) + indent += 1 + has_no_values = False + cm_fh.write('{}set_property(TARGET {} APPEND PROPERTY QT_{}\n'.format(spaces(indent), target, key)) + write_list(cm_fh, value, '', indent + 1) + cm_fh.write('{})\n'.format(spaces(indent))) + indent -= 1 + + if not has_no_values: + cm_fh.write('{}endif()\n'.format(spaces(indent))) def write_main_part(cm_fh: typing.IO[str], name: str, typename: str, cmake_function: str, scope: Scope, *, @@ -1577,6 +1603,8 @@ def write_main_part(cm_fh: typing.IO[str], name: str, typename: str, write_simd_part(cm_fh, name, scope, indent) + write_android_part(cm_fh, name, scopes[0], indent) + ignored_keys_report = write_ignored_keys(scopes[0], spaces(indent)) if ignored_keys_report: cm_fh.write(ignored_keys_report) @@ -1590,12 +1618,12 @@ def write_main_part(cm_fh: typing.IO[str], name: str, typename: str, for c in scopes[1:]: c.reset_visited_keys() + write_android_part(cm_fh, name, c, indent=indent) write_extend_target(cm_fh, name, c, indent=indent) ignored_keys_report = write_ignored_keys(c, spaces(indent)) if ignored_keys_report: cm_fh.write(ignored_keys_report) - def write_module(cm_fh: typing.IO[str], scope: Scope, *, indent: int = 0) -> None: module_name = scope.TARGET |