Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Set some Qt6.8 properties #12300

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# set(CMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG ON)

set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug;Release")
if(NOT CMAKE_BUILD_TYPE)
Expand Down Expand Up @@ -137,13 +138,15 @@ endif()
if(ANDROID)
cmake_print_variables(QT_ANDROID_APPLICATION_ARGUMENTS QT_HOST_PATH)

# QT_USE_TARGET_ANDROID_BUILD_DIR
# set(QT_USE_TARGET_ANDROID_BUILD_DIR ON CACHE BOOL "Use Target Android Build Dir" FORCE)

list(APPEND QT_ANDROID_MULTI_ABI_FORWARD_VARS QGC_STABLE_BUILD)
list(APPEND QT_ANDROID_MULTI_ABI_FORWARD_VARS QT_HOST_PATH)
cmake_print_variables(QT_ANDROID_MULTI_ABI_FORWARD_VARS)
# QT_ANDROID_DEPLOY_RELEASE
# set(QT_ANDROID_DEPLOYMENT_TYPE ON CACHE BOOL "Deployment Type")
cmake_dependent_option(QT_ANDROID_SIGN_APK "Enable Signing APK" ON "CMAKE_BUILD_TYPE STREQUAL Release" OFF)
# QT_ANDROID_SIGN_AAB
if(QT_ANDROID_SIGN_APK)
message(STATUS "Signing APK")
message(STATUS "QT_ANDROID_KEYSTORE_PATH $ENV{QT_ANDROID_KEYSTORE_PATH}")
Expand Down Expand Up @@ -207,6 +210,8 @@ qt_policy(
SET QTP0005 NEW
)

# QT_TARGETS_FOLDER

#######################################################
# QGroundControl Options
#######################################################
Expand Down Expand Up @@ -384,7 +389,7 @@ elseif(IOS)
set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2") # iPhone,iPad
set(CMAKE_XCODE_ATTRIBUTE_INFOPLIST_FILE "${CMAKE_CURRENT_SOURCE_DIR}/deploy/ios/iOS-Info.plist")

set_target_properties(${PROJECT_NAME}
set_target_properties(${CMAKE_PROJECT_NAME}
PROPERTIES
QT_IOS_LAUNCH_SCREEN ${CMAKE_SOURCE_DIR}/deploy/ios/QGCLaunchScreen.xib
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "org.mavlink.qgroundcontrol"
Expand All @@ -398,6 +403,9 @@ elseif(IOS)
XCODE_ATTRIBUTE_INFOPLIST_KEY_LSApplicationCategoryType "public.app-category.mycategory"
XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS "YES"
)

# set(QT_NO_FFMPEG_XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY ON)
# qt_add_ios_ffmpeg_libraries(CMAKE_PROJECT_NAME)
elseif(ANDROID)
FetchContent_Declare(android_openssl
DOWNLOAD_EXTRACT_TIMESTAMP true
Expand Down Expand Up @@ -445,17 +453,23 @@ elseif(ANDROID)
endif()
endif()

set_target_properties(${PROJECT_NAME}
set_target_properties(${CMAKE_PROJECT_NAME}
PROPERTIES
# QT_ANDROID_ABIS ${ANDROID_ABI}
QT_ANDROID_MIN_SDK_VERSION ${QGC_QT_ANDROID_MIN_SDK_VERSION}
QT_ANDROID_TARGET_SDK_VERSION ${QGC_QT_ANDROID_TARGET_SDK_VERSION}
QT_ANDROID_PACKAGE_NAME "${QGC_ANDROID_PACKAGE_NAME}"
QT_ANDROID_PACKAGE_SOURCE_DIR "${QGC_ANDROID_PACKAGE_SOURCE_DIR}"
QT_ANDROID_VERSION_NAME ${CMAKE_PROJECT_VERSION}
QT_ANDROID_VERSION_CODE ${ANDROID_VERSION_CODE}
# QT_QML_ROOT_PATH ${CMAKE_SOURCE_DIR}
# QT_ANDROID_SDK_BUILD_TOOLS_REVISION
# QT_ANDROID_SYSTEM_LIBS_PREFIX
)
# get_target_property(QGC_ANDROID_DEPLOY_FILE ${PROJECT_NAME} QT_ANDROID_DEPLOYMENT_SETTINGS_FILE)
# QT_ANDROID_DEPLOYMENT_DEPENDENCIES

cmake_print_variables(QGC_ANDROID_PACKAGE_NAME)
elseif(LINUX)

endif()
Expand Down
1 change: 0 additions & 1 deletion android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.mavlink.qgroundcontrol"
android:installLocation="auto"
android:versionCode="-- %%INSERT_VERSION_CODE%% --"
android:versionName="-- %%INSERT_VERSION_NAME%% --">
Expand Down
20 changes: 12 additions & 8 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:8.7.2'
classpath 'com.android.tools.build:gradle:8.7.3'
}
}

repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url = 'https://jitpack.io' }
}

apply plugin: 'com.android.application'
apply plugin: qtGradlePluginType

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'androidx.core:core:1.12.0'
//noinspection GradleDependency
implementation 'androidx.core:core:1.13.1'
implementation 'com.github.mik3y:usb-serial-for-android:3.8.1'
}

Expand All @@ -40,12 +41,14 @@ android {
* Changing them manually might break the compilation!
*******************************************************/

// namespace = androidPackageName
namespace = "org.mavlink.qgroundcontrol"
compileSdkVersion androidCompileSdkVersion
buildToolsVersion androidBuildToolsVersion
ndkVersion androidNdkVersion
ndkVersion = androidNdkVersion

// Extract native libraries from the APK
packagingOptions.jniLibs.useLegacyPackaging true
packagingOptions.jniLibs.useLegacyPackaging = true

sourceSets {
main {
Expand Down Expand Up @@ -74,7 +77,7 @@ android {
}

lintOptions {
abortOnError false
abortOnError = false
}

// Do not compress Qt binary resources file
Expand All @@ -88,7 +91,7 @@ android {
targetSdkVersion qtTargetSdkVersion
ndk.abiFilters = qtTargetAbiList.split(",")

namespace "org.mavlink.qgroundcontrol"
// namespace "org.mavlink.qgroundcontrol"
// versionName "5.0"
// versionCode timestampInt

Expand All @@ -101,6 +104,7 @@ android {
}

println "timestamp: " + getTimestampStr()
println "androidPackageName: ${namespace}"
println "androidCompileSdkVersion: ${compileSdkVersion}"
println "androidBuildToolsVersion: ${buildToolsVersion}"
println "androidNdkVersion: ${ndkVersion}"
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
4 changes: 3 additions & 1 deletion cmake/CustomOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ option(QGC_ENABLE_QT_VIDEOSTREAMING "Enable QtMultimedia Video Backend" OFF) # Q
set(QGC_MAVLINK_GIT_REPO "https://github.com/mavlink/c_library_v2.git" CACHE STRING "URL to MAVLink Git Repo")
set(QGC_MAVLINK_GIT_TAG "b71f061a53941637cbcfc5bcf860f96bc82e0892" CACHE STRING "Tag of MAVLink Git Repo")

set(QGC_QT_ANDROID_MIN_SDK_VERSION "26" CACHE STRING "Android Min SDK Version")
# Android
set(QGC_QT_ANDROID_MIN_SDK_VERSION "28" CACHE STRING "Android Min SDK Version")
set(QGC_QT_ANDROID_TARGET_SDK_VERSION "35" CACHE STRING "Android Target SDK Version")
set(QGC_ANDROID_PACKAGE_NAME "org.mavlink.qgroundcontrol" CACHE STRING "Android Package Name")

# MacOS
set(QGC_BUNDLE_ID "org.qgroundcontrol.QGroundControl" CACHE STRING "MacOS Bundle ID") # MACOS
Expand Down
5 changes: 5 additions & 0 deletions cmake/printSummary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ message( STATUS "MacOS Bundle ID: ${QGC_BUNDLE_ID}" )
message( STATUS "MacOS Icon Path: ${QGC_MACOS_ICON_PATH}" )
endif()

if(ANDROID)
message( STATUS "Android NDK Host System ${ANDROID_NDK_HOST_SYSTEM_NAME}" )
message( STATUS "Android SDK Root ${ANDROID_SDK_ROOT}" )
endif()

OptionOutput( "Stable Build: " QGC_STABLE_BUILD )
OptionOutput( "Building Tests: " QGC_BUILD_TESTING AND BUILD_TESTING )
OptionOutput( "Debug QML: " QGC_DEBUG_QML )
Expand Down
Loading