CMake: Fix various issues with the Android build

Certain resources and compiled jar files have to be copied into the
non-prefix build dir location. They were previously only installed,
which doesn't do anything in a non-prefix build.

Change pro2cmake to generate code that places the compiled java
jars into QT_BUILD_DIR, so that non-prefix builds work.

Place the module dependencies xml files into lib folder in non-prefix
builds.

Don't special case the output and install location of the Android QPA
plugin.

Task-number: QTBUG-85399
Change-Id: I4ac9d3929ea8ecc95ec99a77e621ad2121b68832
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2020-07-03 15:05:42 +02:00
parent d5e8a5d9cb
commit b1f8ca8032
8 changed files with 14 additions and 19 deletions

View File

@ -115,8 +115,7 @@ function(qt_android_dependencies target)
endif() endif()
endmacro() endmacro()
get_target_property(target_bin_dir ${target} BINARY_DIR) set(dependency_file "${QT_BUILD_DIR}/${INSTALL_LIBDIR}/${target_name}_${CMAKE_ANDROID_ARCH_ABI}-android-dependencies.xml")
set(dependency_file "${target_bin_dir}/${target_name}_${CMAKE_ANDROID_ARCH_ABI}-android-dependencies.xml")
set(file_contents "<rules><dependencies>\n") set(file_contents "<rules><dependencies>\n")
string(APPEND file_contents "<lib name=\"${target_name}_${CMAKE_ANDROID_ARCH_ABI}\"><depends>\n") string(APPEND file_contents "<lib name=\"${target_name}_${CMAKE_ANDROID_ARCH_ABI}\"><depends>\n")

View File

@ -21,6 +21,7 @@ set(java_sources
add_jar(QtAndroid add_jar(QtAndroid
INCLUDE_JARS ${QT_ANDROID_JAR} INCLUDE_JARS ${QT_ANDROID_JAR}
SOURCES ${java_sources} SOURCES ${java_sources}
OUTPUT_DIR "${QT_BUILD_DIR}/jar"
) )
install_jar(QtAndroid install_jar(QtAndroid

View File

@ -22,6 +22,7 @@ set(java_sources
add_jar(QtAndroid add_jar(QtAndroid
INCLUDE_JARS ${QT_ANDROID_JAR} INCLUDE_JARS ${QT_ANDROID_JAR}
SOURCES ${java_sources} SOURCES ${java_sources}
OUTPUT_DIR "${QT_BUILD_DIR}/jar"
) )
install_jar(QtAndroid install_jar(QtAndroid

View File

@ -6,7 +6,8 @@ set(resource_directories
res res
src) src)
qt_install(DIRECTORY ${resource_directories} qt_path_join(destination ${QT_INSTALL_DIR} "src/android/java")
DESTINATION src/android/java qt_copy_or_install(DIRECTORY ${resource_directories}
COMPONENT Devel) DESTINATION "${destination}"
)
# special case end # special case end

View File

@ -9,11 +9,10 @@ set(template_files
set(template_directories set(template_directories
res) res)
qt_install(FILES ${template_files} qt_path_join(destination ${QT_INSTALL_DIR} "src/android/templates")
DESTINATION src/android/templates qt_copy_or_install(FILES ${template_files}
COMPONENT Devel) DESTINATION "${destination}")
qt_install(DIRECTORY ${template_directories} qt_copy_or_install(DIRECTORY ${template_directories}
DESTINATION src/android/templates DESTINATION "${destination}")
COMPONENT Devel)
# special case end # special case end

View File

@ -7,6 +7,7 @@ set(java_sources
add_jar(QtAndroidNetwork add_jar(QtAndroidNetwork
INCLUDE_JARS ${QT_ANDROID_JAR} INCLUDE_JARS ${QT_ANDROID_JAR}
SOURCES ${java_sources} SOURCES ${java_sources}
OUTPUT_DIR "${QT_BUILD_DIR}/jar"
) )
install_jar(QtAndroidNetwork install_jar(QtAndroidNetwork

View File

@ -53,14 +53,6 @@ qt_internal_add_plugin(QAndroidIntegrationPlugin
Qt::GuiPrivate Qt::GuiPrivate
android android
jnigraphics jnigraphics
# special case begin
INSTALL_DIRECTORY
plugins/platforms
OUTPUT_DIRECTORY
plugins/platforms
ARCHIVE_INSTALL_DIRECTORY
plugins/platforms
# special case end
) )
#### Keys ignored in scope 1:.:.:android.pro:<TRUE>: #### Keys ignored in scope 1:.:.:android.pro:<TRUE>:

View File

@ -3301,6 +3301,7 @@ def write_jar(cm_fh: IO[str], scope: Scope, *, indent: int = 0) -> str:
cm_fh.write(f"{spaces(indent)}add_jar({target}\n") cm_fh.write(f"{spaces(indent)}add_jar({target}\n")
cm_fh.write(f"{spaces(indent+1)}INCLUDE_JARS {android_sdk_jar}\n") cm_fh.write(f"{spaces(indent+1)}INCLUDE_JARS {android_sdk_jar}\n")
cm_fh.write(f"{spaces(indent+1)}SOURCES ${{java_sources}}\n") cm_fh.write(f"{spaces(indent+1)}SOURCES ${{java_sources}}\n")
cm_fh.write(f'{spaces(indent+1)}OUTPUT_DIR "${{QT_BUILD_DIR}}/{install_dir}"\n')
cm_fh.write(f"{spaces(indent)})\n\n") cm_fh.write(f"{spaces(indent)})\n\n")
cm_fh.write(f"{spaces(indent)}install_jar({target}\n") cm_fh.write(f"{spaces(indent)}install_jar({target}\n")