iOS: Add initial cmake apptempt

This commit is contained in:
Simon Stürz 2025-11-26 14:16:36 +01:00
parent 3b7a97a5f5
commit 8ab31af549
3 changed files with 139 additions and 1 deletions

View File

@ -14,6 +14,10 @@ endif()
project(nymea-app VERSION ${NYMEA_APP_VERSION} LANGUAGES CXX)
if(IOS)
enable_language(OBJCXX)
endif()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

View File

@ -52,6 +52,20 @@ if(ANDROID)
)
endif()
if(IOS)
list(APPEND NYMEA_APP_SOURCES
platformintegration/ios/platformhelperios.cpp
platformintegration/ios/platformpermissionsios.cpp
platformintegration/ios/platformhelperios.mm
platformintegration/ios/pushnotifications.mm
platformintegration/ios/platformpermissionsios.mm
)
list(APPEND NYMEA_APP_HEADERS
platformintegration/ios/platformhelperios.h
platformintegration/ios/platformpermissionsios.h
)
endif()
set(NYMEA_APP_RESOURCES
${CMAKE_CURRENT_SOURCE_DIR}/resources.qrc
${CMAKE_CURRENT_SOURCE_DIR}/ruletemplates.qrc
@ -149,5 +163,59 @@ if(ANDROID)
endif()
endif()
qt_finalize_executable(nymea-app)
if(IOS)
target_link_libraries(nymea-app PRIVATE
"-framework CoreLocation"
"-framework CoreBluetooth"
"-framework CoreNFC"
)
set(_nymea_ios_plist "${CMAKE_CURRENT_BINARY_DIR}/ios/Info.plist")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ios")
configure_file(
${CMAKE_SOURCE_DIR}/packaging/ios/Info.plist.cmake.in
${_nymea_ios_plist}
@ONLY
)
set_target_properties(nymea-app PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${_nymea_ios_plist}"
MACOSX_BUNDLE_GUI_IDENTIFIER "io.guh.nymeaApp"
MACOSX_BUNDLE_BUNDLE_VERSION "${APP_REVISION}"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${APP_VERSION}"
XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${CMAKE_SOURCE_DIR}/packaging/ios/app.entitlements"
)
target_link_options(nymea-app PRIVATE "-ObjC")
set_property(TARGET nymea-app APPEND PROPERTY
QT_IOS_ASSET_CATALOGS "${CMAKE_SOURCE_DIR}/packaging/ios/Assets.xcassets")
set(_nymea_ios_resources
${CMAKE_SOURCE_DIR}/packaging/ios/NymeaLaunchScreen.storyboard
${CMAKE_SOURCE_DIR}/packaging/ios/GoogleService-Info.plist
)
set_source_files_properties(${_nymea_ios_resources} PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
target_sources(nymea-app PRIVATE ${_nymea_ios_resources})
if(NYMEA_ENABLE_FIREBASE)
target_compile_definitions(nymea-app PRIVATE WITH_FIREBASE FIREBASE_ANALYTICS_SUPPRESS_WARNING)
target_include_directories(nymea-app PRIVATE ${CMAKE_SOURCE_DIR}/3rdParty/ios)
target_link_directories(nymea-app PRIVATE
${CMAKE_SOURCE_DIR}/3rdParty/ios/Firebase/FirebaseAnalytics
${CMAKE_SOURCE_DIR}/3rdParty/ios/Firebase/FirebaseMessaging
)
target_link_libraries(nymea-app PRIVATE
"-framework FirebaseMessaging"
"-framework GoogleUtilities"
"-framework Protobuf"
"-framework FirebaseCore"
"-framework FirebaseInstanceID"
"-framework FirebaseInstallations"
"-framework PromisesObjC"
)
endif()
endif()
qt_finalize_executable(nymea-app)

View File

@ -0,0 +1,66 @@
<?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>CFBundleDisplayName</key>
<string>nymea:app</string>
<key>CFBundleExecutable</key>
<string>nymea-app</string>
<key>CFBundleGetInfoString</key>
<string>Created by Qt/CMake</string>
<key>CFBundleIdentifier</key>
<string>io.guh.nymeaApp</string>
<key>CFBundleName</key>
<string>nymea-app</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>@APP_VERSION@</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>@APP_REVISION@</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NOTE</key>
<string>This file was generated by Qt/CMake.</string>
<key>UILaunchStoryboardName</key>
<string>NymeaLaunchScreen</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>nymea boxes can be connected to WiFi using a Bluetooth setup. Also, this app can connect to nymea boxes using Bluetooth only, without requiring WiFi at all.</string>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>nymea boxes can be connected to WiFi using a Bluetooth setup. Also, this app can connect to nymea boxes using Bluetooth only, without requiring WiFi at all.</string>
<key>NSLocalNetworkUsageDescription</key>
<string>nymea:app will connect to nymea systems in the local network and allow controlling smart home equipment.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>nymea:app is not using the device location at this point.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>nymea:app is not using the device location at this point.</string>
<key>NSBonjourServices</key>
<array>
<string>_jsonrpc._tcp</string>
<string>_ws._tcp</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>XSAppIconAssets</key>
<string>AppIcons.xcassets/AppIcon.appiconset</string>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon29x29.png</string>
<string>AppIcon29x29@2x.png</string>
<string>AppIcon40x40@2x.png</string>
<string>AppIcon60x60@2x.png</string>
<string>AppIcon83.5x83.5@2x.png</string>
</array>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
</dict>
</plist>