CMake:Android: add Android templates, bindings and gradle files to tree

Add Android templates, bindings and gradle wrapper files to custom
targets so they can be easily tracked by the project tree when using
Qt Creator for example.

Change-Id: I4144b9ee461139a9f768c57b14139e0fc21d4c28
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Assam Boudjelthia 2022-11-25 16:44:19 +02:00
parent 487c823a2d
commit 80fbabad8a
3 changed files with 78 additions and 9 deletions

View File

@ -1,22 +1,44 @@
set(gradle_programs
"${CMAKE_CURRENT_SOURCE_DIR}/gradlew"
)
set(gradle_files
"${CMAKE_CURRENT_SOURCE_DIR}/gradlew.bat"
"${CMAKE_CURRENT_SOURCE_DIR}/gradle.properties"
)
set(gradle_wrapper
"${CMAKE_CURRENT_SOURCE_DIR}/gradle"
)
set(gradle_wrapper_files
"${CMAKE_CURRENT_SOURCE_DIR}/gradle/wrapper/gradle-wrapper.properties"
"${CMAKE_CURRENT_SOURCE_DIR}/gradle/wrapper/gradle-wrapper.jar"
)
add_custom_target(Qt${QtBase_VERSION_MAJOR}GradleScripts
SOURCES
${gradle_programs}
${gradle_files}
${gradle_wrapper_files}
)
qt_path_join(destination ${QT_INSTALL_DIR} "src/3rdparty/gradle")
qt_copy_or_install(
PROGRAMS
gradlew
${gradle_programs}
DESTINATION
"${destination}"
)
qt_copy_or_install(
FILES
gradlew.bat
gradle.properties
${gradle_files}
DESTINATION
"${destination}"
)
qt_copy_or_install(
DIRECTORY
gradle
${gradle_wrapper}
DESTINATION
"${destination}"
)

View File

@ -6,10 +6,50 @@
# special case skip regeneration
# special case begin
set(resource_directories
res
src)
"${CMAKE_CURRENT_SOURCE_DIR}/res"
"${CMAKE_CURRENT_SOURCE_DIR}/src"
)
set(java_bindings
"${CMAKE_CURRENT_SOURCE_DIR}/src/org/qtproject/qt/android/bindings/QtActivity.java"
"${CMAKE_CURRENT_SOURCE_DIR}/src/org/qtproject/qt/android/bindings/QtActivityLoader.java"
"${CMAKE_CURRENT_SOURCE_DIR}/src/org/qtproject/qt/android/bindings/QtService.java"
"${CMAKE_CURRENT_SOURCE_DIR}/src/org/qtproject/qt/android/bindings/QtServiceLoader.java"
"${CMAKE_CURRENT_SOURCE_DIR}/src/org/qtproject/qt/android/bindings/QtApplication.java"
"${CMAKE_CURRENT_SOURCE_DIR}/src/org/qtproject/qt/android/bindings/QtLoader.java"
)
set(strings_resouces
"${CMAKE_CURRENT_SOURCE_DIR}/res/values/strings.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/res/values-de/strings.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/res/values-el/strings.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/res/values-es/strings.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/res/values-et/strings.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/res/values-fa/strings.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/res/values-fr/strings.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/res/values-in/strings.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/res/values-it/strings.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/res/values-ja/strings.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/res/values-ms/strings.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/res/values-nb/strings.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/res/values-nl/strings.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/res/values-pl/strings.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/res/values-pt-rBR/strings.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/res/values-ro/strings.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/res/values-ru/strings.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/res/values-se/strings.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/res/values-zh-rCN/strings.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/res/values-zh-rTW/strings.xml"
)
add_custom_target(Qt${QtBase_VERSION_MAJOR}AndroidBindings
SOURCES
${java_bindings}
${strings_resouces}
)
qt_path_join(destination ${QT_INSTALL_DIR} "src/android/java")
qt_copy_or_install(DIRECTORY ${resource_directories}
DESTINATION "${destination}"
)

View File

@ -6,13 +6,20 @@
# special case skip regeneration
# special case begin
set(template_files
AndroidManifest.xml
build.gradle)
"${CMAKE_CURRENT_SOURCE_DIR}/AndroidManifest.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/build.gradle")
set(template_directories
res)
"${CMAKE_CURRENT_SOURCE_DIR}/res")
add_custom_target(Qt${QtBase_VERSION_MAJOR}AndroidTemplates
SOURCES
${template_files}
"${CMAKE_CURRENT_SOURCE_DIR}/res/values/libs.xml"
)
qt_path_join(destination ${QT_INSTALL_DIR} "src/android/templates")
qt_copy_or_install(FILES ${template_files}
DESTINATION "${destination}")