Skip to content

Commit

Permalink
CI: Fix iOS Build
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Sep 26, 2024
1 parent 3fd7e80 commit ea432df
Show file tree
Hide file tree
Showing 20 changed files with 211 additions and 89 deletions.
1 change: 1 addition & 0 deletions .github/workflows/android-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ on:
- 'docs/**'
- '.github/workflows/docs_deploy.yml'
- '.github/workflows/linux.yml'
- '.github/workflows/ios.yml'
- '.github/workflows/macos.yml'
- '.github/workflows/windows.yml'

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/android-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- 'deploy/**'
- 'docs/**'
- '.github/workflows/docs_deploy.yml'
- '.github/workflows/ios.yml'
- '.github/workflows/linux.yml'
- '.github/workflows/macos.yml'
- '.github/workflows/windows.yml'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docker-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
- 'docs/**'
- '.github/workflows/docs_deploy.yml'
- '.github/workflows/android.yml'
- '.github/workflows/ios.yml'
- '.github/workflows/macos.yml'
- '.github/workflows/windows.yml'

Expand Down
25 changes: 23 additions & 2 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
name: iOS

on:
workflow_dispatch:
push:
branches:
- master
- 'Stable*'
tags:
- 'v*'
paths-ignore:
- 'android/**'
- 'deploy/**'
- 'docs/**'
pull_request:
paths-ignore:
- 'android/**'
- 'deploy/**'
- 'docs/**'
- '.github/workflows/android-*.yml'
- '.github/workflows/docs_deploy.yml'
- '.github/workflows/*linux.yml'
- '.github/workflows/macos.yml'
- '.github/workflows/windows.yml'

jobs:
build:
Expand Down Expand Up @@ -82,7 +101,6 @@ jobs:
aqtversion: ==3.1.*
host: mac
target: ios
arch: ios
dir: ${{ runner.temp }}
extra: --autodesktop
modules: qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtimageformats qtshadertools qtconnectivity qtquick3d qtsensors
Expand All @@ -94,8 +112,11 @@ jobs:
working-directory: ${{ runner.temp }}/shadow_build_dir
run: ${{ env.QT_ROOT_DIR }}/bin/qt-cmake -S ${{ github.workspace }} -B . -G Ninja
-DCMAKE_BUILD_TYPE=${{ matrix.BuildType }}
-DQT_DEBUG_FIND_PACKAGE=ON
-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
-DQT_HOST_PATH="${{ env.QT_ROOT_DIR }}/../macos"
-DQGC_STABLE_BUILD=${{ github.ref_type == 'tag' || contains(github.ref, 'Stable') && 'ON' || 'OFF' }}
-DCMAKE_FIND_ROOT_PATH="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/"

- name: Build
working-directory: ${{ runner.temp }}/shadow_build_dir
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
- 'docs/**'
- '.github/workflows/docs_deploy.yml'
- '.github/workflows/android.yml'
- '.github/workflows/ios.yml'
- '.github/workflows/macos.yml'
- '.github/workflows/windows.yml'

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
- 'docs/**'
- '.github/workflows/docs_deploy.yml'
- '.github/workflows/android.yml'
- '.github/workflows/ios.yml'
- '.github/workflows/linux.yml'
- '.github/workflows/windows.yml'

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
- 'docs/**'
- '.github/workflows/docs_deploy.yml'
- '.github/workflows/android.yml'
- '.github/workflows/ios.yml'
- '.github/workflows/linux.yml'
- '.github/workflows/macos.yml'

Expand Down
51 changes: 28 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ cmake_minimum_required(VERSION 3.22.1)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

if(IOS)
set(CMAKE_SYSTEM_NAME iOS)
set(CMAKE_OSX_ARCHITECTURES "arm64")
set(CMAKE_OSX_SYSROOT "iphoneos")
set(CMAKE_OSX_DEPLOYMENT_TARGET "14.0")
endif()

#######################################################
# Custom Build Configuration
#######################################################
Expand Down Expand Up @@ -155,19 +162,16 @@ endif()
find_package(Qt6
REQUIRED
COMPONENTS
Bluetooth
Charts
Concurrent
Core
Core5Compat
Location
Multimedia
Network
OpenGL
Positioning
Quick
QuickControls2
QuickWidgets
OpenGL
Sensors
Sql
Svg
Expand All @@ -176,7 +180,11 @@ find_package(Qt6
Widgets
Xml
OPTIONAL_COMPONENTS
Bluetooth
Concurrent
Charts
LinguistTools
Quick3D
SerialPort
HINTS
${QT_LIBRARY_HINTS}
Expand Down Expand Up @@ -213,8 +221,6 @@ if(QGC_DEBUG_QML)
add_compile_definitions(QT_QML_DEBUG)
endif()

cmake_dependent_option(QGC_NO_SERIAL_LINK "Build QGroundControl without Serial Support Support." OFF "NOT IOS" ON)

if(QGC_DISABLE_APM_MAVLINK)
add_compile_definitions(NO_ARDUPILOT_DIALECT)
endif()
Expand All @@ -228,6 +234,12 @@ endif()

cmake_dependent_option(QGC_BUILD_DEPENDENCIES "Force Building of Dependencies." OFF "NOT CMAKE_CROSSCOMPILING;NOT MACOS_UNIVERSAL_BUILD" ON)

cmake_dependent_option(QGC_NO_SERIAL_LINK "Build QGroundControl without Serial Support Support." OFF "Qt6SerialPort_FOUND" ON)
cmake_dependent_option(QGC_ENABLE_BLUETOOTH "Enable Viewer3D" ON "Qt6Bluetooth_FOUND" OFF)
cmake_dependent_option(QGC_DISABLE_VIEWER3D "Disable Viewer3D" OFF "Qt6Quick3D_FOUND" ON) # This removes QtQuick3D which is GPL licensed
cmake_dependent_option(QGC_DISABLE_MAVLINK_INSPECTOR "Disable Mavlink Inspector" OFF "Qt6Charts_FOUND" ON) # This removes QtCharts which is GPL licensed
cmake_dependent_option(QGC_DISABLE_CONCURRENT "Disable Qt6Concurrent" OFF "Qt6Concurrent_FOUND" ON) # This removes QtCharts which is GPL licensed

#######################################################
# Custom Build Configuration
#######################################################
Expand Down Expand Up @@ -365,26 +377,19 @@ elseif(MACOS)
elseif(IOS)
enable_language(OBJC)

set(CMAKE_OSX_ARCHITECTURES "arm64")
set(CMAKE_OSX_SYSROOT "iphoneos")
set(CMAKE_OSX_DEPLOYMENT_TARGET "14.0")
set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "14.0")
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}
PROPERTIES
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/deploy/ios/iOS-Info.plist"
MACOSX_BUNDLE_BUNDLE_NAME "${CMAKE_PROJECT_NAME}"
MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_VERSION}"
MACOSX_BUNDLE_COPYRIGHT "${QGC_APP_COPYRIGHT}"
MACOSX_BUNDLE_GUI_IDENTIFIER "${QGC_BUNDLE_ID}"
# MACOSX_BUNDLE_ICON_FILE "macx.icns"
MACOSX_BUNDLE_INFO_STRING "${QGC_APP_DESCRIPTION}"
MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
QT_IOS_LAUNCH_SCREEN ${CMAKE_SOURCE_DIR}/deploy/ios/QGCLaunchScreen.xib
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "org.mavlink.qgroundcontrol"
XCODE_ATTRIBUTE_PRODUCT_NAME ${CMAKE_PROJECT_NAME}
XCODE_ATTRIBUTE_CURRENT_PROJECT_VERSION ${CMAKE_PROJECT_VERSION}
XCODE_ATTRIBUTE_MARKETING_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon"
XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "14.0"
XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2" # iPhone,iPad
XCODE_ATTRIBUTE_INFOPLIST_KEY_CFBundleDisplayName ${CMAKE_PROJECT_NAME}
XCODE_ATTRIBUTE_INFOPLIST_KEY_LSApplicationCategoryType "public.app-category.mycategory"
XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS "YES"
)
elseif(ANDROID)
FetchContent_Declare(android_openssl
Expand Down
7 changes: 4 additions & 3 deletions cmake/FindGStreamer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,24 @@ if(WIN32)
cmake_print_variables(PKG_CONFIG_ARGN)
elseif(MACOS)
set(GSTREAMER_PREFIX "/Library/Frameworks/GStreamer.framework")
list(APPEND CMAKE_FRAMEWORK_PATH "/Library/Frameworks")
set(ENV{PKG_CONFIG_PATH} "${GSTREAMER_PREFIX}/Versions/Current/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
elseif(LINUX)
set(GSTREAMER_PREFIX "/usr")
set(ENV{PKG_CONFIG_PATH} "${GSTREAMER_PREFIX}/lib/pkgconfig:${GSTREAMER_PREFIX}/lib/x86_64-linux-gnu/pkgconfig:$ENV{PKG_CONFIG_PATH}")
elseif(IOS)
set(GSTREAMER_PREFIX "~/Library/Developer/GStreamer/iPhone.sdk/GStreamer.framework")
set(GSTREAMER_PREFIX_IOS "~/Library/Developer/GStreamer/iPhone.sdk/GStreamer.framework")
list(APPEND CMAKE_FRAMEWORK_PATH "/Library/Developer/GStreamer/iPhone.sdk")
if(DEFINED ENV{GSTREAMER_PREFIX_IOS} AND EXISTS $ENV{GSTREAMER_PREFIX_IOS})
set(GSTREAMER_PREFIX_IOS $ENV{GSTREAMER_PREFIX_IOS})
else()
FetchContent_Declare(gstreamer
URL "https://gstreamer.freedesktop.org/data/pkg/ios/${QGC_GST_TARGET_VERSION}/gstreamer-1.0-devel-${QGC_GST_TARGET_VERSION}-ios-universal.pkg"
DOWNLOAD_EXTRACT_TIMESTAMP true
)
FetchContent_MakeAvailable(gstreamer)
set(GSTREAMER_PREFIX_IOS ${gstreamer_SOURCE_DIR})
endif()
# TODO: set(GSTREAMER_PREFIX ${GSTREAMER_PREFIX_IOS}/)
set(GSTREAMER_PREFIX ${GSTREAMER_PREFIX_IOS})
elseif(ANDROID)
set(GSTREAMER_PREFIX_ANDROID)
if(DEFINED ENV{GSTREAMER_PREFIX_ANDROID} AND EXISTS $ENV{GSTREAMER_PREFIX_ANDROID})
Expand Down
52 changes: 52 additions & 0 deletions deploy/ios/Info.plist.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundlePackageType</key>
<string>APPL</string>

<key>CFBundleName</key>
<string>@MACOSX_BUNDLE_BUNDLE_NAME@</string>

<key>CFBundleDisplayName</key>
<string>@MACOSX_BUNDLE_BUNDLE_NAME@</string>

<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>

<key>CFBundleIdentifier</key>
<string>@MACOSX_BUNDLE_GUI_IDENTIFIER@</string>

<key>CFBundleVersion</key>
<string>@MACOSX_BUNDLE_BUNDLE_VERSION@</string>

<key>CFBundleShortVersionString</key>
<string>@MACOSX_BUNDLE_SHORT_VERSION_STRING@</string>

<key>CFBundleIconFile</key>
<string>${ASSETCATALOG_COMPILER_APPICON_NAME}</string>

<key>MinimumOSVersion</key>
<string>${IPHONEOS_DEPLOYMENT_TARGET}</string>

<key>ITSAppUsesNonExemptEncryption</key>
<false/>

<key>LSRequiresIPhoneOS</key>
<true/>

<key>NSHighResolutionCapable</key>
<true/>

<key>UILaunchStoryboardName</key>
<string>AppLaunchScreen</string>

<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
46 changes: 34 additions & 12 deletions src/AnalyzeView/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
find_package(Qt6 REQUIRED COMPONENTS Core Charts Gui Qml QmlIntegration)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml QmlIntegration)

qt_add_library(AnalyzeView STATIC
ExifParser.cc
Expand All @@ -11,24 +11,16 @@ qt_add_library(AnalyzeView STATIC
LogDownloadController.h
LogEntry.cc
LogEntry.h
MAVLinkChartController.cc
MAVLinkChartController.h
MAVLinkConsoleController.cc
MAVLinkConsoleController.h
MAVLinkInspectorController.cc
MAVLinkInspectorController.h
MAVLinkMessage.cc
MAVLinkMessage.h
MAVLinkMessageField.cc
MAVLinkMessageField.h
MAVLinkSystem.cc
MAVLinkSystem.h
PX4LogParser.cc
PX4LogParser.h
ULogParser.cc
ULogParser.h
)

#===========================================================================#

include(FetchContent)
FetchContent_Declare(ulogparser
GIT_REPOSITORY https://github.com/PX4/ulog_cpp.git
Expand All @@ -39,7 +31,6 @@ FetchContent_MakeAvailable(ulogparser)

target_link_libraries(AnalyzeView
PRIVATE
Qt6::Charts
Qt6::Gui
Qt6::Qml
ulog_cpp::ulog_cpp
Expand All @@ -55,6 +46,33 @@ target_link_libraries(AnalyzeView
QmlControls
)

#===========================================================================#

if(NOT QGC_DISABLE_MAVLINK_INSPECTOR)
find_package(Qt6 REQUIRED COMPONENTS Charts)
target_sources(AnalyzeView
PRIVATE
MAVLinkChartController.cc
MAVLinkChartController.h
MAVLinkInspectorController.cc
MAVLinkInspectorController.h
MAVLinkMessage.cc
MAVLinkMessage.h
MAVLinkMessageField.cc
MAVLinkMessageField.h
MAVLinkSystem.cc
MAVLinkSystem.h
)
target_link_libraries(AnalyzeView
PRIVATE
Qt6::Charts
)
else()
target_compile_definitions(AnalyzeView PUBLIC QGC_DISABLE_MAVLINK_INSPECTOR)
endif()

#===========================================================================#

set(MINIMUM_EXIV2_VERSION 0.28.3)

if(NOT QGC_BUILD_DEPENDENCIES)
Expand Down Expand Up @@ -113,6 +131,8 @@ if(NOT Exiv2_FOUND)
)
endif()

#===========================================================================#

include(FetchContent)
FetchContent_Declare(easyexif
GIT_REPOSITORY https://github.com/mayanklahiri/easyexif.git
Expand All @@ -133,6 +153,8 @@ target_include_directories(AnalyzeView
${easyexif_SOURCE_DIR}
)

#===========================================================================#

# qt_add_qml_module(AnalyzeView
# URI QGroundControl.AnalyzeView
# VERSION 1.0
Expand Down
1 change: 0 additions & 1 deletion src/Comms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ endif()

############# Bluetooth

option(QGC_ENABLE_BLUETOOTH "Enable Bluetooth Links" ON)
if(QGC_ENABLE_BLUETOOTH)
find_package(Qt6 REQUIRED COMPONENTS Bluetooth)
target_link_libraries(Comms PUBLIC Qt6::Bluetooth)
Expand Down
2 changes: 1 addition & 1 deletion src/GPS/GPSProvider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifdef Q_OS_ANDROID
#include "qserialport.h"
#else
#include <QSerialPort>
#include <QtSerialPort/QSerialPort>
#endif

#define GPS_RECEIVE_TIMEOUT 1200
Expand Down
Loading

0 comments on commit ea432df

Please sign in to comment.