From 8ab31af5494be691be85794b43ce864d53ca9581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Wed, 26 Nov 2025 14:16:36 +0100 Subject: [PATCH] iOS: Add initial cmake apptempt --- CMakeLists.txt | 4 ++ nymea-app/CMakeLists.txt | 70 ++++++++++++++++++++++++++++++- packaging/ios/Info.plist.cmake.in | 66 +++++++++++++++++++++++++++++ 3 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 packaging/ios/Info.plist.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index b65ad56b..0d88e833 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/nymea-app/CMakeLists.txt b/nymea-app/CMakeLists.txt index f844da89..62489779 100644 --- a/nymea-app/CMakeLists.txt +++ b/nymea-app/CMakeLists.txt @@ -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) diff --git a/packaging/ios/Info.plist.cmake.in b/packaging/ios/Info.plist.cmake.in new file mode 100644 index 00000000..54c03110 --- /dev/null +++ b/packaging/ios/Info.plist.cmake.in @@ -0,0 +1,66 @@ + + + + + CFBundleDisplayName + nymea:app + CFBundleExecutable + nymea-app + CFBundleGetInfoString + Created by Qt/CMake + CFBundleIdentifier + io.guh.nymeaApp + CFBundleName + nymea-app + CFBundlePackageType + APPL + CFBundleShortVersionString + @APP_VERSION@ + CFBundleSignature + ???? + CFBundleVersion + @APP_REVISION@ + LSRequiresIPhoneOS + + NOTE + This file was generated by Qt/CMake. + UILaunchStoryboardName + NymeaLaunchScreen + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + NSBluetoothPeripheralUsageDescription + 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. + NSBluetoothAlwaysUsageDescription + 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. + NSLocalNetworkUsageDescription + nymea:app will connect to nymea systems in the local network and allow controlling smart home equipment. + NSLocationWhenInUseUsageDescription + nymea:app is not using the device location at this point. + NSLocationAlwaysAndWhenInUseUsageDescription + nymea:app is not using the device location at this point. + NSBonjourServices + + _jsonrpc._tcp + _ws._tcp + + UIViewControllerBasedStatusBarAppearance + + XSAppIconAssets + AppIcons.xcassets/AppIcon.appiconset + CFBundleIconFiles + + AppIcon29x29.png + AppIcon29x29@2x.png + AppIcon40x40@2x.png + AppIcon60x60@2x.png + AppIcon83.5x83.5@2x.png + + ITSAppUsesNonExemptEncryption + + +