Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. iOS / CMake problems including launch screen
QtWS25 Last Chance

iOS / CMake problems including launch screen

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
1 Posts 1 Posters 102 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Ron Menelli
    wrote on last edited by
    #1

    I'm finishing up my first app that uses Qt 6.8 and CMake, after a long time using 5.15 and QMake. I'm having some trouble getting it fully working in iOS. I can get the app running with no launch screen, but I'm now trying to add a simple launch screen, and my attempts either result in no launch screen displayed or CMake errors.

    I've created my asset catalog, which I've successfully done before in 5.15. I found some info online about how to include the asset catalog and my own Info.plist template in the build. However, now when I try to run CMake I get this error:

    error: unable to read property list from file: /Users/ron/Work/build-SmartMultiboxEditor-Qt_6_8_2_for_iOS/CMakeFiles/SmartMultiboxEditor.dir/Info.plist: The operation couldn’t be completed. (XCBUtil.PropertyListConversionError error 2.) (in target 'SmartMultiboxEditor' from project 'SmartMultiboxEditor')

    Looking at SmartMultiboxEditor.dir/Info.plist, it's a binary plist file. I'm guessing that this isn't supposed to happen?

    I'm attaching my Cmakelists.txt and the Info.plist file I'm starting with. Can anyone point out my error(s)?

    CmakeLists.txt

    cmake_minimum_required(VERSION 3.21)
    
    project(SmartMultiboxEditor VERSION 1.1.0 LANGUAGES CXX)
    
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
    
    find_package(Qt6 6.8 REQUIRED COMPONENTS Quick)
    
    qt_standard_project_setup(REQUIRES 6.8)
    
    # Find all QML/JS files for the QML compiler:
    file(GLOB_RECURSE QmlFiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} qml/*.qml qml/*.js)
    
    # Find all non-QML/JS files in the qml and assets folder to add as resources:
    file(GLOB_RECURSE AssetsFiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} assets/* firmware/*)
    list(REMOVE_ITEM AssetsFiles ${QmlFiles})
    
    
    if(APPLE)
      if(IOS)
        set(app_icon "${CMAKE_CURRENT_SOURCE_DIR}/icons/SMBEditorIOSIcon.icns")
        set(MACOSX_BUNDLE_ICON_FILE "SMBEditorIOSIcon.icns")
        set(launch_screen "${CMAKE_CURRENT_SOURCE_DIR}/ios/RJMLaunchScreen.storyboard")
        set_source_files_properties(${launch_screen} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
      else()
        set(app_icon "${CMAKE_CURRENT_SOURCE_DIR}/icons/SMBEditorIcon.icns")
        set(MACOSX_BUNDLE_ICON_FILE "SMBEditorIcon.icns")
        set(launch_screen "")
      endif()
      set_source_files_properties(${app_icon} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
      qt_add_executable(SmartMultiboxEditor MACOSX_BUNDLE
          main.h
          main.cpp
          btea.h
          btea.cpp
          cppinterface.h
          cppinterface.cpp
          defaultscripts.cpp
          firmwareupdate.h
          firmwareupdate.cpp
          globals.h
          rjf_file.h
          settings.h
          settingstransfer.h
          settingstransfer.cpp
          smbsyntaxhighlighter.h
          smbsyntaxhighlighter.cpp
          ${QmlFiles}
          ${AssetsFiles}
          ${app_icon}
          ${launch_screen}
      )
    else()
      set(app_icon "${CMAKE_CURRENT_SOURCE_DIR}/icons/SMBEditorIcon.rc")
      qt_add_executable(SmartMultiboxEditor
          main.h
          main.cpp
          btea.h
          btea.cpp
          cppinterface.h
          cppinterface.cpp
          defaultscripts.cpp
          firmwareupdate.h
          firmwareupdate.cpp
          globals.h
          rjf_file.h
          settings.h
          settingstransfer.h
          settingstransfer.cpp
          smbsyntaxhighlighter.h
          smbsyntaxhighlighter.cpp
          ${QmlFiles}
          ${AssetsFiles}
          ${app_icon}
      )
    endif()
    
    if(IOS)
      # Asset catalog root
      target_sources(SmartMultiboxEditor PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/Media.xcassets")
      set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/Media.xcassets" PROPERTIES
          MACOSX_PACKAGE_LOCATION Resources
      )
      # Asset catalog app icon set
      list(APPEND app_icon_set "${CMAKE_CURRENT_SOURCE_DIR}/Media.xcassets/AppIcon.appiconset")
      list(APPEND app_icon_set "${CMAKE_CURRENT_SOURCE_DIR}/Media.xcassets/Contents.json")
      set_source_files_properties(${app_icon_set} PROPERTIES
          MACOSX_PACKAGE_LOCATION Resources/Media.xcassets
      )
      # Asset catalog icon files
      file(GLOB app_icon_files CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/Media.xcassets/AppIcon.appiconset/*.png")
      list(APPEND app_icon_files "${CMAKE_CURRENT_SOURCE_DIR}/Media.xcassets/AppIcon.appiconset/Contents.json")
      set_source_files_properties(${app_icon_set} PROPERTIES
          MACOSX_PACKAGE_LOCATION Resources/Media.xcassets/AppIcon.appiconset
      )
      # Asset catalog launch screen
      list(APPEND launch_screen_set "${CMAKE_CURRENT_SOURCE_DIR}/Media.xcassets/RJMLaunchScreen.imageset")
      list(APPEND launch_screen_set "${CMAKE_CURRENT_SOURCE_DIR}/Media.xcassets/Contents.json")
      set_source_files_properties(${launch_screen_set} PROPERTIES
          MACOSX_PACKAGE_LOCATION Resources/Media.xcassets
      )
      # Asset catalog launch screen
      file(GLOB launch_screen_files CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/Media.xcassets/RJMLaunchScreen.imageset/*.png")
      list(APPEND launch_screen_files "${CMAKE_CURRENT_SOURCE_DIR}/Media.xcassets/RJMLaunchScreen.imageset/Contents.json")
      set_source_files_properties(${launch_screen_files} PROPERTIES
          MACOSX_PACKAGE_LOCATION Resources/Media.xcassets/RJMLaunchScreen.imageset
    )
    endif()
    
    add_subdirectory(ConnectedDeviceListModel)
    add_subdirectory(MIDI)
    add_subdirectory(rtmidi)
    add_subdirectory(ScriptListModel)
    
    add_subdirectory(../SmartMultibox/SmartMultiboxFW/ SmartMultibox)
    
    qt_add_qml_module(SmartMultiboxEditor
        URI SmartMultiboxEditor
        VERSION 1.0
        QML_FILES ${QmlFiles}
    )
    
    qt_add_resources(SmartMultiboxEditor assetresources
        PREFIX "/"
        FILES ${AssetsFiles}
    )
    
    target_compile_options(SmartMultiboxEditor PRIVATE -DUSE_QT -DNOMIDICI)
    
    if(APPLE)
        target_compile_options(SmartMultiboxEditor PRIVATE -D__MACOSX_CORE__)
    else()
        target_compile_options(SmartMultiboxEditor PRIVATE -D__WINDOWS_MM__ -DRTMIDI_DO_NOT_ENSURE_UNIQUE_PORTNAMES)
    endif()
    
    target_include_directories(SmartMultiboxEditor AFTER PRIVATE ../SmartMultibox/SmartMultiboxFW/Core/Inc)
    
    if(APPLE)
        target_link_libraries(SmartMultiboxEditor PRIVATE Qt6::Quick "-framework CoreAudio" "-framework CoreMIDI")
    else()
        target_link_libraries(SmartMultiboxEditor PRIVATE Qt6::Quick "-lwinmm")
    endif()
    
    
    
    # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
    # If you are developing for iOS or macOS you should consider setting an
    # explicit, fixed bundle identifier manually though.
    set_target_properties(SmartMultiboxEditor PROPERTIES
        MACOSX_BUNDLE_GUI_IDENTIFIER com.RJMMusic.smartMultiboxEditor
        MACOSX_BUNDLE_COPYRIGHT "Copyright (c) 2025 RJM Music Technology, Inc."
        MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
        MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION}
        MACOSX_BUNDLE TRUE
        WIN32_EXECUTABLE TRUE
    )
    
    if(IOS)
      set_target_properties(SmartMultiboxEditor PROPERTIES
        MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/ios/Info.plist")
    endif()
    
    target_link_libraries(SmartMultiboxEditor
        PRIVATE Qt6::Quick
    )
    
    include(GNUInstallDirs)
    install(TARGETS SmartMultiboxEditor
        BUNDLE DESTINATION .
        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    )
    
    

    Info.plist

    <?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>Smart Multibox Editor</string>
    	<key>CFBundleExecutable</key>
    	<string>SmartMultiboxEditor</string>
    	<key>CFBundleIconFile</key>
    	<string>SMBEditorIOSIcon.icns</string>
    	<key>CFBundleIdentifier</key>
    	<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
    	<key>CFBundleName</key>
    	<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
    	<key>CFBundlePackageType</key>
    	<string>APPL</string>
    	<key>CFBundleShortVersionString</key>
    	<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
        <key>CFBundleSignature</key>
    	<string>????</string>
    	<key>CFBundleSupportedPlatforms</key>
    	<array>
    		<string>iPhoneOS</string>
    	</array>
    	<key>CFBundleVersion</key>
    	<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
    	<key>LSRequiresIPhoneOS</key>
    	<true/>
    	<key>MinimumOSVersion</key>
    	<string>16</string>
    	<key>NSHumanReadableCopyright</key>
    	<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
    	<key>UIDeviceFamily</key>
    	<array>
    		<integer>1</integer>
    		<integer>2</integer>
    	</array>
    	<key>UILaunchStoryboardName</key>
    	<string>RJMLaunchScreen</string>
    	<key>UIRequiredDeviceCapabilities</key>
    	<array>
    		<string>arm64</string>
    	</array>
    	<key>UISupportedInterfaceOrientations</key>
    	<array>
    		<string>UIInterfaceOrientationPortrait</string>
    		<string>UIInterfaceOrientationPortraitUpsideDown</string>
    		<string>UIInterfaceOrientationLandscapeLeft</string>
    		<string>UIInterfaceOrientationLandscapeRight</string>
    	</array>
    </dict>
    </plist>
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved