Skip to content

Commit

Permalink
Work on CI builds
Browse files Browse the repository at this point in the history
  • Loading branch information
emericg committed Oct 12, 2023
1 parent 28f9a4a commit b991efe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/builds_mobile_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
export JAVA_HOME=$JAVA_HOME_17_X64
qt-cmake -B build/ \
-DCMAKE_SYSTEM_NAME=Android \
-DCMAKE_SYSTEM_VERSION=23 \
-DCMAKE_FIND_ROOT_PATH:PATH=${{env.QT_TARGET_PATH}} \
-DCMAKE_PREFIX_PATH=${{env.QT_TARGET_PATH}} \
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake \
Expand Down Expand Up @@ -129,6 +130,7 @@ jobs:
- name: Build application
run: |
export QT_HOST_PATH=${{env.QT_HOST_PATH}}
export IPHONEOS_DEPLOYMENT_TARGET=12.0
qt-cmake -B build/ -G Xcode \
-DQT_HOST_PATH=${{env.QT_HOST_PATH}} \
-DCMAKE_SYSTEM_NAME=iOS \
Expand Down
33 changes: 12 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)

project(QmlAppTemplate VERSION 0.6 LANGUAGES CXX)

set(APP_NAME ${CMAKE_PROJECT_NAME})
set(APP_VERSION ${CMAKE_PROJECT_VERSION})

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
Expand Down Expand Up @@ -33,28 +36,20 @@ qt_add_executable(QmlAppTemplate
assets/assets.qrc
)

target_include_directories(QmlAppTemplate PRIVATE src)
target_include_directories(QmlAppTemplate PUBLIC src/thirdparty)
target_include_directories(QmlAppTemplate PRIVATE src/)
target_include_directories(QmlAppTemplate PUBLIC src/thirdparty/)

################################################################################

## Android
if(ANDROID)
set(QT_ANDROID_ABIS "armeabi-v7a;arm64-v8a;x86;x86_64")
set(QT_ANDROID_BUILD_ALL_ABIS "ON")

set_target_properties(QmlAppTemplate PROPERTIES
QT_ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/assets/android"
)
set(QT_ANDROID_BUILD_ALL_ABIS ON)
set(QT_ANDROID_MIN_SDK_VERSION 23)
set(QT_ANDROID_TARGET_SDK_VERSION 34)

set_target_properties(QmlAppTemplate PROPERTIES QT_ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/assets/android/")
target_link_libraries(QmlAppTemplate PRIVATE Qt::CorePrivate)

#-DQT_ANDROID_MIN_SDK_VERSION=23
#add_qt_android_apk(my_app_apk my_app
# PACKAGE_NAME "io.emeric.qmlapptemplate"
#)
#qt_android_generate_deployment_settings(qmlapptemplate)
#qt_android_add_apk_target(qmlapptemplate)
endif()

## macOS
Expand All @@ -66,11 +61,9 @@ endif()
## iOS
if(IOS)
set(IPHONEOS_DEPLOYMENT_TARGET "12.0")
set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET 12.0)

target_link_libraries(QmlAppTemplate PRIVATE
Qt::GuiPrivate
"-framework UIKit"
)
target_link_libraries(QmlAppTemplate PRIVATE Qt::GuiPrivate "-framework UIKit")
endif()

## Windows
Expand All @@ -81,8 +74,6 @@ endif()
################################################################################

# AppUtils
set(APP_NAME ${CMAKE_PROJECT_NAME})
set(APP_VERSION ${CMAKE_PROJECT_VERSION})
add_subdirectory(src/thirdparty/AppUtils)
target_link_libraries(QmlAppTemplate PRIVATE AppUtils)

Expand Down
4 changes: 2 additions & 2 deletions assets/android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --" />
<meta-data android:name="android.app.arguments" android:value="-- %%INSERT_APP_ARGUMENTS%% --" />
<meta-data android:name="android.app.extract_android_style" android:value="none" />
<!-- <meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/splash" /> -->
<!-- <meta-data android:name="android.app.splash_screen_sticky" android:value="true" /> -->
<meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/splash" />
<meta-data android:name="android.app.splash_screen_sticky" android:value="true" />
</activity>

</application>
Expand Down

0 comments on commit b991efe

Please sign in to comment.