Skip to content

Commit

Permalink
another try
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik committed Sep 14, 2023
1 parent de2fde3 commit a60228f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 16 deletions.
34 changes: 26 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,39 @@ if (DEFINED ENV{INPUT_SDK_ANDROID_BASE})
set(ANDROID_STL "c++_shared")
set(ANDROID_NDK_VERSION "$ENV{ANDROID_NDK_HOME}")
if(NOT ANDROID_NDK_VERSION)
message(FATAL_ERROR "Set required environment variable ANDROID_NDK_HOME.")
message(FATAL_ERROR "Set required environment variable ANDROID_NDK_HOME.")
endif ()

set(ANDROID_BUILD_TOOLS_VERSION "$ENV{SDK_BUILD_TOOLS}")
if(NOT ANDROID_BUILD_TOOLS_VERSION)
message(FATAL_ERROR "Set required environment variable SDK_BUILD_TOOLS.")
message(FATAL_ERROR "Set required environment variable SDK_BUILD_TOOLS.")
endif ()

# Variables used for Cmake's replacements in configure_file
set(INPUT_ANDROID_NDK_VERSION "${ANDROID_NDK_VERSION}" CACHE STRING "Android NDK version" FORCE)
set(INPUT_ANDROID_BUILD_TOOLS_VERSION "${ANDROID_BUILD_TOOLS_VERSION}" CACHE STRING "Android build-tools version" FORCE)
set(INPUT_ANDROID_TARGET_SDK_VERSION "${ANDROIDTARGETAPI}" CACHE STRING "Target Android platform SDK version" FORCE)
set(INPUT_ANDROID_TARGET_SDK_VERSION_INT ${ANDROIDTARGETAPI} CACHE INT "Target Android platform SDK version" FORCE)
set(INPUT_ANDROID_MIN_SDK_VERSION "${ANDROIDAPI}" CACHE STRING "Minimum Android platform SDK version" FORCE)
set(INPUT_ANDROID_MIN_SDK_VERSION_INT ${ANDROIDAPI} CACHE INT "Minimum Android platform SDK version" FORCE)
set(INPUT_ANDROID_NDK_VERSION
"${ANDROID_NDK_VERSION}"
CACHE STRING "Android NDK version" FORCE
)
set(INPUT_ANDROID_BUILD_TOOLS_VERSION
"${ANDROID_BUILD_TOOLS_VERSION}"
CACHE STRING "Android build-tools version" FORCE
)
set(INPUT_ANDROID_TARGET_SDK_VERSION
"${ANDROIDTARGETAPI}"
CACHE STRING "Target Android platform SDK version" FORCE
)
set(INPUT_ANDROID_TARGET_SDK_VERSION_INT
${ANDROIDTARGETAPI}
CACHE INT "Target Android platform SDK version" FORCE
)
set(INPUT_ANDROID_MIN_SDK_VERSION
"${ANDROIDAPI}"
CACHE STRING "Minimum Android platform SDK version" FORCE
)
set(INPUT_ANDROID_MIN_SDK_VERSION_INT
${ANDROIDAPI}
CACHE INT "Minimum Android platform SDK version" FORCE
)
endif ()

if (IOS)
Expand Down
4 changes: 2 additions & 2 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -297,15 +297,15 @@ if (ANDROID)
${INPUT_CMAKE_TEMPLATES_PATH}/AndroidManifest.xml.in
${CMAKE_CURRENT_SOURCE_DIR}/android/AndroidManifest.xml @ONLY
)

if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/android/build.gradle)
file(REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/android/build.gradle)
endif ()
configure_file(
${INPUT_CMAKE_TEMPLATES_PATH}/build.gradle.in
${CMAKE_CURRENT_SOURCE_DIR}/android/build.gradle @ONLY
)

set_target_properties(
Input
PROPERTIES QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android
Expand Down
13 changes: 7 additions & 6 deletions cmake_templates/build.gradle.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

buildscript {
ext {
buildToolsVersion = "@INPUT_ANDROID_BUILD_TOOLS_VERSION@"
buildToolsVersion = androidBuildToolsVersion
minSdkVersion = @INPUT_ANDROID_MIN_SDK_VERSION_INT@
compileSdkVersion = @INPUT_ANDROID_TARGET_SDK_VERSION_INT@
targetSdkVersion = @INPUT_ANDROID_TARGET_SDK_VERSION_INT@
ndkVersion = '@INPUT_ANDROID_NDK_VERSION@'
compileSdkVersion = androidCompileSdkVersion.toInteger()
targetSdkVersion = androidCompileSdkVersion.toInteger()
ndkVersion = androidNdkVersion
}

repositories {
Expand Down Expand Up @@ -49,8 +49,9 @@ android {
* Changing them manually might break the compilation!
*******************************************************/

ndkVersion = '@INPUT_ANDROID_NDK_VERSION@'
compileSdkVersion = @INPUT_ANDROID_TARGET_SDK_VERSION_INT@
compileSdkVersion androidCompileSdkVersion.toInteger()
buildToolsVersion androidBuildToolsVersion
ndkVersion androidNdkVersion

packagingOptions.jniLibs.useLegacyPackaging true

Expand Down

1 comment on commit a60228f

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS - version 23.09.456011 just submitted!

Please sign in to comment.