Giter Club home page Giter Club logo

qtioscmake's Introduction

Qt iOS CMake

What it is

This project provide a CMake macro to help you deploy Qt Application for iOS. This macro replace all kind of stuff QMake is doing under the hood and add lots of options to customize Info.plist.

  • Correctly link to all qt libraries. Optimization can be done here.
  • Link with required framework.
  • Redirect entry point to create UIApplication before regular main().
  • Generate Info.plist with inputs based on Info.plist.in. (User customizable)
  • Sign the XCode Generated project (inside a .app).
  • Generate .ipa for direct upload to TestFlight.

The main goal is to build the app without any change inside XCode.

This utility has been developed for my own needs. Don't hesitate to use / share / fork / modify / improve it freely :)

This project is conceptually based on the great QtAndroidCMake of Laurent Gomila.

Showcase

The Application QaterialGallery showcase the use of this library. See QtIosCMake call in platforms/Deploy.cmake and iOs resources in platforms/ios/. See QtStaticCMake call in platforms/Deploy.cmake.

The application also demonstrate full CI pipeline with Github Actions.

  • Install Certificates & Profiles from AppStore Connect.
  • Build .app.
  • Build .ipa.
  • Upload .ipa to AppStore TestFlight.

How to use it

How to integrate it to your CMake configuration

All you have to do is to call the add_qt_ios_app macro. No additionnal target will be generated, only the main target property are going to change. Of course this is not enough and you'll need to add extract arguments.

if(${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
    include(QtIosCMake/AddQtIosApp.cmake)
    add_qt_ios_app(MyApp)
endif()

How to run CMake

Prerequisite:

If you installed official Qt binary, Qt Sdk binary is located in:

export QT_USER_ID=$(id -un)
export QT_IOS_VERSION=5.15.2
export QT_IOS_DIR=/Users/$QT_USER_ID/Qt/$QT_IOS_VERSION/ios

Then simply run CMake with this toolchain. Read the toolchain README for more information.

cmake -DCMAKE_PREFIX_PATH=$QT_IOS_DIR \
-DDEPLOYMENT_TARGET=12.0 \
-DCMAKE_TOOLCHAIN_FILE=/path/to/ios.toolchain.cmake \
-DPLATFORM=OS64COMBINED \
-DENABLE_BITCODE=FALSE \
-G "Xcode" \
path/to/Projet/

To sign your app you need at least a team id and a signing identity. I recommand you to override those variable when doing the cmake command, and not writting them inside your cmake scripts. This will give you more control when configuring the project.

  • QT_IOS_TEAM_ID: Same as TEAM_ID option, can be useful to specify at configure time, not in source code.
  • QT_IOS_CODE_SIGN_IDENTITY: Same as CODE_SIGN_IDENTITY option, can be useful to specify at configure time, not in source code.
  • QT_IOS_PROVISIONING_PROFILE_SPECIFIER: Same as PROVISIONING_PROFILE_SPECIFIER option, can be useful to specify at configure time, not in source code.
  • QT_IOS_ARCHIVE_XCODEBUILD_FLAGS: Allows to specify additional flags that are passed to xcodebuild archive when creating the archive file.
  • QT_IOS_EXPORT_ARCHIVE_XCODEBUILD_FLAGS: Allows to specify additional flags that are passed to xcodebuild when creating the IPA file.

Then you can simply build your app:

cmake --build . --config Release

Notes

  • OS64COMBINED is only available if you are using CMake 3.14+.
  • Generator XCode is required to sign app and create a bundle app.
  • Qt 5.12:
    • If you use prebuild qt ios library, then bitcode is disabled.
    • Library is build with minimum Os support 11.0. You need to do the same.
  • Qt 5.15:
    • If you use prebuild qt ios library, then bitcode is disabled.
    • Library is build with minimum Os support 12.0. You need to do the same.
  • Qt < 5.15: You may need to add ios library by yourself. With newer version of Qt, the required flags are added in Qt's CMake scripts.
target_link_libraries(MyApp PUBLIC "-framework Foundation -framework AVFoundation -framework SystemConfiguration -framework AssetsLibrary -framework OpenGLES \
    -framework CoreText -framework QuartzCore -framework CoreGraphics -framework ImageIO -framework Security -framework UIKit -framework WebKit \
    -framework CoreBluetooth -framework MobileCoreServices -framework QuickLook -framework AudioToolbox -framework CoreLocation \
    -framework Accelerate -framework CoreMedia -framework CoreVideo -framework MediaToolbox -framework MediaPlayer -framework GameController
    -framework CoreMotion -framework StoreKit -weak_framework Metal -lz")

Options of the add_qt_ios_app macro

The first argument is the executable target that will become an app.

The macro also accepts optional named arguments. Any combination of these arguments is valid. Example:

add_qt_ios_app(MyApp
    NAME "My App"
    BUNDLE_IDENTIFIER "com.company.app"
    VERSION "1.2.3"
    SHORT_VERSION "1.2.3"
    LONG_VERSION "1.2.3.456"
    CUSTOM_PLIST "path/to/MacOSXBundleInfo.plist.in"
    CODE_SIGN_IDENTITY "iPhone Developer"
    TEAM_ID "AAAAAAAA"
    PROVISIONING_PROFILE_SPECIFIER "my-profile"
    COPYRIGHT "My Cool Copyright"
    QML_DIR "${QT_IOS_QT_ROOT}/qml"
    ASSET_DIR "path/to/Assets.xcassets"
    MAIN_STORYBOARD "/path/to/Main.storyboard"
    LAUNCHSCREEN_STORYBOARD "path/to/LaunchScreen.storyboard"
    CATALOG_APPICON "AppIcon"
    CATALOG_LAUNCHIMAGE "LaunchImage"
    ORIENTATION_PORTRAIT
    ORIENTATION_PORTRAIT_UPDOWN
    ORIENTATION_LANDSCAPE_LEFT
    ORIENTATION_LANDSCAPE_RIGHT
    PHOTO_LIBRARY_USAGE_DESCRIPTION "My App needs to access your photo library."
    SUPPORT_IPHONE
    SUPPORT_IPAD
    REQUIRES_FULL_SCREEN
    HIDDEN_STATUS_BAR
    IPA
    UPLOAD_SYMBOL
    VERBOSE
 )

Here is the full list of possible arguments:

NAME

The bundle display name is the name displayed underneath the application icon. This value should be localized for all supported languages. If not given, the name of the source target is taken. The default is ${TARGET}. This is the name displayed on the os. This is the equivalent of the Display Name field under General XCode.

Example:

add_qt_ios_app(MyApp
    NAME "My App"
)

ScDisplayName

BUNDLE_IDENTIFIER

The application bundle identifier. A bundle identifier lets iOS and macOS recognize any updates to your app. Your bundle ID must be registered with Apple and be unique to your app. Bundle IDs are app-type specific (either iOS or macOS). The same bundle ID cannot be used for both iOS and macOS apps.

Bundle identifiers are usually (not always) written out in reverse DNS notation (com.myCompany.myApp).

If not specified, the default value is ${CMAKE_PROJECT_NAME}.${TARGET}.

Example:

add_qt_ios_app(MyApp
    BUNDLE_IDENTIFIER "com.myCompany.myApp"
)

ScBundleIdentifier

VERSION

The string that specifies the build version number of the bundle. This value is a monotonically increased string, comprised of one or more period-separated integers. This value can correspond to either released or unreleased versions of the application. This value cannot be localized. The default is ${CMAKE_PROJECT_VERSION} is set, otherwise 1.0.0.

Example:

add_qt_ios_app(MyApp
    VERSION "1.2.3"
)

ScVersion

SHORT_VERSION

The release version of the application. The value of this key is a string comprised of three period-separated integers. This is default to VERSION.

Example:

add_qt_ios_app(MyApp
    SHORT_VERSION "1.2.3"
)

LONG_VERSION

The release version of the application that usualy include the build number. This is default to VERSION.

Example:

add_qt_ios_app(MyApp
    LONG_VERSION "1.2.3"
)

CUSTOM_PLIST

It is possible to specify a custom pList file. The default is MacOSXBundleInfo.plist.in. CMake include a basic template here. Qt also add some recommendation, read more about it here. The file in this repository is a variant of the CMake ones that have more configurable field from CMake. If you use your own plist.in some feature of this macro won't work anymore. Don't forget to copy in your file:

Orientation

<!-- Ui Orientation -->
<key>UISupportedInterfaceOrientations</key>
<array>
    <string>${MACOSX_BUNDLE_PORTRAIT}</string>
    <string>${MACOSX_BUNDLE_PORTRAITUPDOWN}</string>
    <string>${MACOSX_BUNDLE_LANDSCAPELEFT}</string>
    <string>${MACOSX_BUNDLE_LANDSCAPERIGHT}</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
    <string>${MACOSX_BUNDLE_PORTRAIT}</string>
    <string>${MACOSX_BUNDLE_PORTRAITUPDOWN}</string>
    <string>${MACOSX_BUNDLE_LANDSCAPELEFT}</string>
    <string>${MACOSX_BUNDLE_LANDSCAPERIGHT}</string>
</array>

RequireFullScreen

<!-- Full screen, allow multi task or not  -->
<key>UIRequiresFullScreen</key>
<string>${MACOSX_BUNDLE_REQUIRES_FULL_SCREEN}</string>

StatusBarHidden

<!-- Hide the status bar -->
<key>UIStatusBarHidden</key>
<${MACOSX_BUNDLE_HIDDEN_STATUS_BAR}/>

LaunchStoryboard

<!-- If supporting multitask LaunchScreen.storyboard must be provided -->
<key>UILaunchStoryboardName</key>
<string>${MACOSX_BUNDLE_LAUNCHSCREEN_STORYBOARD}</string>

MainStoryboard

<!-- Optionnal StoryBoard filename -->
<key>UIMainStoryboardFile</key>
<string>${MACOSX_BUNDLE_MAIN_STORYBOARD}</string>

Example:

add_qt_ios_app(MyApp
    CUSTOM_PLIST "path/to/Info.plist.in"
)

The pList file can also be a file that isn't gonna be configured it's gonna work the same way.

CODE_SIGN_IDENTITY

Code signing is required in order to deploy to real ios device (ie non simulator). More info here. By default "iPhone Developer". Possible values are:

"iPhone Developer"
"iPhone Distribution"

Example:

add_qt_ios_app(MyApp
    CODE_SIGN_IDENTITY "iPhone Developer"
)

TEAM_ID

The team id used to sign the application. By default "AAAAAAAA."

You can see possible values by executing:

/usr/bin/env xcrun security find-identity -v -p codesigning

Example:

add_qt_ios_app(MyApp
    TEAM_ID "AAAAAAAA"
)

ScSign

PROVISIONING_PROFILE_SPECIFIER

A provisioning profile can be generated there. If not specified, signing profile will be generated by cmake. Suitable for development but not for distribution. The BUNDLE_IDENTIFIER should match the on the the provisioning profile.

A profile hold a Certificate for an App ID for a Team Id.

COPYRIGHT

Set the copyright in the info.plist. Optional

Example:

add_qt_ios_app(MyApp
    COPYRIGHT "Cool Copyright 2019"
)

QML_DIR

Used to link with qml libs. By default it is set to qt sdk qml dir but you can specify your own.

Example:

add_qt_ios_app(MyApp
    QML_DIR "path/to/qml"
)

ASSET_DIR

You can specify with this variable one or multiples asset dir to be package with the app.

CATALOG_APPICON

Specify the AppIcon folder inside your Assets folder. By Default "AppIcon".

ScAppIconSource

CATALOG_LAUNCHIMAGE

Specify the AppIcon folder inside your Assets folder. By Default "LaunchImage".

ScLaunchImagesSource

LAUNCHSCREEN_STORYBOARD

Specify the file to use as LaunchScreen Storyboard. This file will be bundle into the App. This is mandatory to support Split Screen if REQUIRES_FULL_SCREEN isn't set.

ScLaunchScreenFile

MAIN_STORYBOARD

This file seems to be optionnal is you use only Qt/Qml.

Set the Main Storyboard of your app. The file will also be bundled.

ScMainInterface

ORIENTATION

The default allowed orientation can be set with flags:

  • ORIENTATION_PORTRAIT: Set UIInterfaceOrientationPortrait flag.
  • ORIENTATION_PORTRAIT_UPDOWN: Set UIInterfaceOrientationPortraitUpSideDown flag.
  • ORIENTATION_LANDSCAPE_LEFT: Set UIInterfaceOrientationLandscapeLeft flag.
  • ORIENTATION_LANDSCAPE_RIGHT: Set UIInterfaceOrientationLandscapeRight flag.

ScOrientation

PHOTO LIBRARY USAGE DESCRIPTION

A message that tells the user why the app is requesting access to the user’s photo library.

Example:

add_qt_ios_app(MyApp
    PHOTO_LIBRARY_USAGE_DESCRIPTION "My App needs to access your photo library."
)

SUPPORTED DEVICES

You can specify supported device either iPhone or iPad or both by settings:

  • SUPPORT_IPHONE: Support iPhone.

ScDeviceiPhone

  • SUPPORT_IPAD: Support iPad.

ScDeviceiPad

When the two flags are specified deployment will result in Universal. This is also the default behavior.

ScDevices

REQUIRES_FULL_SCREEN

This flag disable the multitask feature. By doing so LaunchScreen.storyboard become optionnal.

ScRequiresFullScreen

HIDDEN_STATUS_BAR

Set UIStatusBarHiddento true.

ScHideStatusBar

IPA

If specified, two additional target are going to be generated.

  • <MyApp>Archive that generate MyApp.xcarchive.
  • <MyApp>Ipa that generate MyAppIpa/MyApp.ipa.

Ipa file is the format required by App Store Connect. It can be uploaded straight to TestFlight.

When specifying IPA, additionnal parameters are available:

  • UPLOAD_SYMBOL : Pack symbols inside the ipa. Useful when having a crash report.
  • DISTRIBUTION_METHOD : Only app-store is supported for know.

DISTRIBUTION_METHOD can be overwritten at configure time by specifying a -DQT_IOS_DISTRIBUTION_METHOD="ad-hoc" for example.

ITS_ENCRYPTION_EXPORT_COMPLIANCE_CODE

The export compliance code provided by App Store Connect for apps that require it. This will add a key ITSEncryptionExportComplianceCode in Info.plist.

If not provided (means you don't need it), it will create a key ITSAppUsesNonExemptEncryption to false.

This is required by Apple Connect. If this key doesn't exist in your Info.plist, you will need to fix this in Apple TestFlight website when uploading the IPA.

VERBOSE

Print all debug information. Usefull to check if configuration is ok.

Notes

  • On iPhone X+ the app doesn't show in full screen, you need to add flags: Qt.MaximizeUsingFullscreenGeometryHint to your main Qml window.

  • On iOs Qt is statically linked which mean you need to import by hand required plugins. Or you can use the macro in QtStaticCMake.

    • Generate Qt Plugin import source file.
    • Generate Qt Qml Plugin import source file.
    • Add Correct linker to load platform library qios.
  • Tested with XCode 10.2.1, Qt5.12.0, iOs 12.2.

  • Tested with XCode 12, Qt5.15.1, iOs 14.0.

Improvement Idea

  • Option to specify additional framework.
  • Add iOs capabilities. Wifi, Background Mode, Hotspot Configuration, Multipath, NFC, Notification, ...
  • Never tried to add ObjC.
  • Access to Native Image Picker.

Related Link

Contact

qtioscmake's People

Contributors

3nids avatar btaczala avatar dushistov avatar fransrosencrantz avatar mhoeher avatar olivierldff avatar talkless avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qtioscmake's Issues

I should use QT_LIBRARIES instead of target_link_libraires?

Thanks for project, @OlivierLDff !

I try to use it via:

cmake_minimum_required(VERSION 3.5)

project(foo LANGUAGES CXX)

find_package(Qt5 COMPONENTS Core Quick REQUIRED)

set(CMAKE_AUTORCC ON)

add_executable(foo main.cpp qml.qrc)


target_compile_definitions(foo
  PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)

# conflict with AddQtIosApp.cmake
target_link_libraries(foo PRIVATE Qt5::Core Qt5::Quick)

IF(${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
#  set(QT_LIBRARIES Qt5::Core Qt5::Quick)  
  include(QtIosCMake/AddQtIosApp.cmake)
  
  add_qt_ios_app(foo)
ENDIF()

It fails on

cmake -DCMAKE_PREFIX_PATH=/Users/user/Qt/5.12.7/ios -DDEPLOYMENT_TARGET=11.0 -DCMAKE_TOOLCHAIN_FILE=../IosCMakeToolchain/ios.toolchain.cmake -DPLATFORM=OS64 -DENABLE_BITCODE=FALSE -G "Xcode" ..

...

CMake Error at QtIosCMake/AddQtIosApp.cmake:351 (target_link_libraries):
  The keyword signature for target_link_libraries has already been used with
  the target "foo".  All uses of target_link_libraries with a target must be
  either all-keyword or all-plain.

  The uses of the keyword signature are here:

   * CMakeLists.txt:16 (target_link_libraries)

So I have to remove target_link_libraries and set QT_LIBRARIES.
Is it expected behaviour? I can not find any mention of QT_LIBRARIES in REAMDE.

Here full source if you can not reproduce problem:
https://github.com/davemilter/qt_ios_libs_bug

cmake version 3.17.1, Macos 10.14.6

ITSAppUsesNonExemptEncryption set to true when ITS_ENCRYPTION_EXPORT_COMPLIANCE_CODE is absent

Hello again,

Doing a bit more work on my project and I hit another little problem. I've not set the ITS_ENCRYPTION_EXPORT_COMPLIANCE_CODE parameter, but the AddQtIosApp macro treats this as meaning "true" and outputs it to the Info.plist as:

<key>ITSAppUsesNonExemptEncryption</key><true/>
<key>ITSEncryptionExportComplianceCode</key>
<string>ARGIOS_ITS_ENCRYPTION_EXPORT_COMPLIANCE_CODE</string>

I think the issue was the simple mistake of not putting ${} for the variable name, one that we've all made a million times! I've attached a patch. I've tested that this fixes my issue, where I need the key to be false, but I've not tested the case of it being true, but I think it's a safe change.

Thanks,
Chris

compliance_patch.txt

Missing underscores in orientation settings in README

Hi, thanks a lot for this project, it's very helpful.

I believe there's a problem in the docs in that they state ORIENTATION_LANDSCAPELEFT and ORIENTATION_LANDSCAPERIGHT when I think it should be ORIENTATION_LANDSCAPE_LEFT and ORIENTATION_LANDSCAPE_RIGHT.

I've attached a little patch that should correct this.

docs_patch.txt

How to run Qt Application?

I read #1 and tried this code:

https://github.com/davemilter/qt_ios_libs_bug/blob/run-app/CMakeLists.txt

It compiled just fine, foo_plugin_import.cpp and foo_qml_plugin_import.cpp generated.

But then application right after start closed on my iPad.

2020-04-22 00:40:14.902733+0300 foo[974:204514] [DYMTLInitPlatform] platform initialization successful
QML debugging is enabled. Only use this in a safe environment.
2020-04-22 00:40:15.134109+0300 foo[974:204247] QQmlApplicationEngine failed to load component
2020-04-22 00:40:15.134774+0300 foo[974:204247] qrc:/main.qml:4 module "QtQml.Models" is not installed
qrc:/main.qml:6 module "QtQuick.Layouts" is not installed
qrc:/main.qml:1 module "QtQuick" is not installed
qrc:/main.qml:3 module "QtQuick.Controls" is not installed
qrc:/main.qml:5 module "QtQuick.Dialogs" is not installed
qrc:/main.qml:7 module "QtQuick.Window" is not installed
qrc:/main.qml:2 module "QtQuick.Controls" is not installed
qrc:/main.qml:4 module "QtQml.Models" is not installed
qrc:/main.qml:6 module "QtQuick.Layouts" is not installed
qrc:/main.qml:1 module "QtQuick" is not installed
qrc:/main.qml:3 module "QtQuick.Controls" is not installed
qrc:/main.qml:5 module "QtQuick.Dialogs" is not installed
qrc:/main.qml:7 module "QtQuick.Window" is not installed

the whole code is here: https://github.com/davemilter/qt_ios_libs_bug/

Branch run-app .

Is I missed something?

Qt installed via online Installer. I can run qmake based project just fine via Qt Creator.

cmake -DCMAKE_PREFIX_PATH=/Users/user/Qt/5.12.7/ios -DDEPLOYMENT_TARGET=11.0 -DCMAKE_TOOLCHAIN_FILE=../IosCMakeToolchain/ios.toolchain.cmake -DPLATFORM=OS64 -DENABLE_BITCODE=FALSE -G "Xcode" ..

Or this issue should be here: https://github.com/OlivierLDff/QtStaticCMake ?

Libs from /qml/* directory not linked

Library form the ${qt_sdk}/ios/qml/ ... are not added to the linker. Causing a qt creator's cmake project, to not successfully work.

For example ${qt_ios_sdk}/qml/QtQuick.2/libqtquick2plugin.a , ${qt_ios_sdk}/qml/QtQuick/Window.2/libwindowplugin.a seems to be needed are are present when building the makefile with qmake. but arn't there using QtIosCmake.

Add Unit Test

Right now, script need to be tested on real project to see if it still work at each PR.
That would be nice to have some automated testing on a sample project. (For example https://github.com/OlivierLDff/QQuickStaticHelloWorld)
This would also give an example of how to setup github action to build & deploy an app.

Info.plist localization

We are using your macro and really like it. πŸ‘
One question: Is there a way to add localization for Info.plist. That means providing InfoPlist.strings files in their respective subdirectories in a similar way as it works with the Info.plist.in?
Is this something I have overseen, or is it simply not implemented?

removing bluetooth support?

If build this project https://github.com/OlivierLDff/QQuickStaticHelloWorld without any bluetooth dependencies but the resulted binary depend on CoreBluetooth.framework:

$ grep CoreBluetooth.framework build_ios/Debug-iphoneos/QQuickStaticHelloWorld.app/QQuickStaticHelloWorld
Binary file build_ios/Debug-iphoneos/QQuickStaticHelloWorld.app/QQuickStaticHelloWorld matches

The problem is that if upload such application to Apple Store, then Apple ask to explain why you need bluetooth.
I see only one user of CoreBluetooth.framework in Qt installation:

$ grep CoreBluetooth.framework ~/Qt/5.15.0/ios/lib/*.a
Binary file ~/Qt/5.15.0/ios/lib/libQt5Bluetooth_debug.a matches

and clearly QQuickStaticHelloWorld don't depend on Qt5Bluetooth but for some reason
it pulls it's dependencies.

I build project in such way:

cmake -DCMAKE_PREFIX_PATH=~/Qt/5.15.0/ios -DDEPLOYMENT_TARGET=12.0 \
-DCMAKE_TOOLCHAIN_FILE=./IosCMakeToolchain/ios.toolchain.cmake -DPLATFORM=OS64 \
-G "Xcode" -DENABLE_BITCODE=FALSE -DENABLE_VISIBILITY=TRUE \
-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/ ..
xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO

What is proper TEAM_ID?

Thanks for project, sorry for may be stupid question.

Here is my working team_id:

myteamid

it is register with just apple id, no payment for apple.

I try it pass "as is":

    TEAM_ID "Evgeniy Dushistov (Personal Team)"

but xcode says that this unknown team id,
unknown-teamid
and suggest to replace with exactly the same string. I don't know what is different between:

Evgeniy Dushistov (Personal Team)
and
Evgeniy Dushistov (Personal Team)

and one xcode know, and another one passed via cmake is unknown.
I tried also:
2) Evgeniy Dushistov
3) Personal Team

I run (as suggested in README):

/usr/bin/env xcrun security find-identity -v -p codesigning
  1) long-hash "Apple Development: my-email@my-server (short-hash)"
     1 valid identities found

I try to use:
4) my-email@my-server
5) long-hash
that also doesn't work.

So what should I pass as TEAM_ID, so I don't have to edit xcode project after each cmake rerun?
Any ideas?

Add support for Free Apple development certificates

Apple now allows Free Developer accounts to flash their apps to real iphones (app certificate will be valid for only 7 days) .
If I try to build I get ;

error: No account for team "123456789A". Add a new account in the Accounts preference pane or verify that your accounts have valid credentials. (in target 'MyApp' from project 'MyApp')
error: No profiles for 'MyApp.MyApp' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'MyApp.MyApp'. (in target 'MyApp' from project 'MyApp')

But after that if I launch the MyApp.xocdeproj with XCode and go to Signing & Capabilities and check "Automatically signing" and select Team as Personal Team it works.

It will be avesome if this will automated too

not full screen?

It basically works. I update my demo project https://github.com/davemilter/qt_ios_libs_bug.

But strange thing that the project looks different if compile with cmake and qmake.
The qmake project have no mention of full screen or something, it is just few lines: https://github.com/davemilter/qt_ios_libs_bug/blob/master/foo.pro

IMG_0188 PNG
IMG_0187 PNG

The same thing with https://github.com/OlivierLDff/QQuickStaticHelloWorld .

Is this because of basic plist is different? May be use the same by default that uses qmake ?

Xcode: No publish dialog?

The problem can be reproducible with https://github.com/davemilter/qt_ios_libs_bug (found this hello world in the closed issues).

I added:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6526704..399959b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,5 +28,9 @@ IF(${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
     target_link_libraries(foo PRIVATE Qt5::QmlWorkerScript)
   endif()
 
-  add_qt_ios_app(foo)
+  add_qt_ios_app(foo
+    BUNDLE_IDENTIFIER "..."
+    TEAM_ID "..."
+    VERSION "1.2.3"
+    )
 ENDIF()

And run

cmake -DCMAKE_PREFIX_PATH=/Users/evgeniy/Qt/5.15.0/ios -DDEPLOYMENT_TARGET=11.0 -DCMAKE_TOOLCHAIN_FILE=../IosCMakeToolchain/ios.toolchain.cmake -DPLATFORM=OS64 -DENABLE_BITCODE=FALSE -G "Xcode" ..

I used paid Apple account, and all works fine (building and running on real devices).

But then I want to publish application and can not see "publish dialog",
after I choose Product->Archive, Xcode rebuilds my project in release mode,
signing it and that's all.

I created swift "hello world" with the same team and bundle id,
and Xcode shows this after: Product->Archive

Screenshot 2020-06-09 at 16 44 09

Any idea why Xcode thinks that it is not worth to upload https://github.com/davemilter/qt_ios_libs_bug into their shop?

"no such file or directory: '/Applications/Xcode10.app...libz.tbd'" with CMake (not QMake)

My current setup:

  • Qt 5.13.2 (from Online Installer)
  • CMake 3.19.2 (homebrew)
  • macOS X 10.15.5
  • Xcode 11.5

If I generate Xcode project from QtCreator & qmake, everything builds fine in Xcode.

I started migrating to CMake, and this is how I try to utilize QtIosCMake:

#!/usr/bin/env bash

# see https://github.com/OlivierLDff/QtIosCMake
export QT_USER_ID=$(id -un)
export QT_IOS_VERSION=5.13.2
export QT_IOS_DIR=/Users/$QT_USER_ID/Qt/$QT_IOS_VERSION/ios

mkdir _build_ios

(
pushd _build_ios
cmake -DCMAKE_PREFIX_PATH=$QT_IOS_DIR \
-DDEPLOYMENT_TARGET=11.0 \
-DCMAKE_TOOLCHAIN_FILE=../../../../../cmake/IosCMakeToolchain-3.0.2/ios.toolchain.cmake \
-DPLATFORM=OS64COMBINED \
-DENABLE_BITCODE=FALSE \
-G "Xcode" \
..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
)

Within my CMakeLists.txt:

if (IOS)
    include(QtIosCMake/AddQtIosApp)
    add_qt_ios_app(${PROJECT_NAME}
            NAME "My App"
            BUNDLE_IDENTIFIER com.my.app
            VERSION ${PROJECT_VERSION}
            LONG_VERSION ${PROJECT_VERSION}.0
            CUSTOM_PLIST ${PROJECT_SOURCE_DIR}/ios/Info.plist.in.cmake
            TEAM_ID XYZ
            ASSET_DIR ${PROJECT_SOURCE_DIR}/ios/Images.xcassets
            LAUNCHSCREEN_STORYBOARD ${PROJECT_SOURCE_DIR}/ios/Launch.storyboard
        )
endif()

cmake run output:

-- Merging integrated CMake 3.14+ iOS,tvOS,watchOS,macOS toolchain(s) with this toolchain!
-- Building with Xcode version: 11.5
-- Configuring iphoneos build for platform: OS64COMBINED, architecture(s): arm64;x86_64
-- Using SDK: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk for platform: OS64COMBINED
-- Enabling ARC support by default. ENABLE_ARC not provided!
-- Hiding symbols visibility by default. ENABLE_VISIBILITY not provided!
-- Using C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Using CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-- Using libtool: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-- Will combine built (static) artifacts into FAT lib...
-- Using a data_ptr size of 8
-- Building for minimum iphoneos version: 11.0 (SDK version: 13.5)
-- Version flags set to: -mios-simulator-version-min=11.0
-- Disabling bitcode support.
-- Enabling ARC support.
-- Hiding symbols (-fvisibility=hidden).
-- Not setting any manual command-line buildflags, since Xcode is selected as generator.
-- Merging integrated CMake 3.14+ iOS,tvOS,watchOS,macOS toolchain(s) with this toolchain!
-- Building with Xcode version: 11.5
-- Configuring iphoneos build for platform: OS64COMBINED, architecture(s): arm64;x86_64
-- Using SDK: iphoneos for platform: OS64COMBINED when checking compatibility
-- Using libtool: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-- Will combine built (static) artifacts into FAT lib...
-- Using a data_ptr size of 8
-- Building for minimum iphoneos version: 11.0 (SDK version: 13.5)
-- Version flags set to: -mios-simulator-version-min=11.0
-- Disabling bitcode support.
-- Enabling ARC support.
-- Hiding symbols (-fvisibility=hidden).
-- Not setting any manual command-line buildflags, since Xcode is selected as generator.
-- The C compiler identification is AppleClang 11.0.3.11030032
-- The CXX compiler identification is AppleClang 11.0.3.11030032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The OBJCXX compiler identification is AppleClang 11.0.3.11030032
-- Detecting OBJCXX compiler ABI info
-- Detecting OBJCXX compiler ABI info - done
-- Check for working OBJCXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
-- Found Qt Sdk for Ios: /Users/user/Qt/5.13.2/ios
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/user/code/cpp/branches/cmake/projects/MyProject/apps/MyApp/_build_ios

And the errors produced in Xcode:

clang: error: no such file or directory: '/Applications/Xcode10.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/usr/lib/libz.tbd'
clang: error: no such file or directory: '/Applications/Xcode10.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/usr/lib/libz.tbd'
clang: error: no such file or directory: '/Applications/Xcode10.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/usr/lib/libz.tbd'
clang: error: no such file or directory: '/Applications/Xcode10.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/usr/lib/libz.tbd'
clang: error: no such file or directory: '/Applications/Xcode10.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/usr/lib/libz.tbd'
clang: error: no such file or directory: '/Applications/Xcode10.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/usr/lib/libz.tbd'
clang: error: no such file or directory: '/Applications/Xcode10.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/usr/lib/libz.tbd'
clang: error: no such file or directory: '/Applications/Xcode10.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/usr/lib/libz.tbd'
clang: error: no such file or directory: '/Applications/Xcode10.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/usr/lib/libz.tbd'
clang: error: no such file or directory: '/Applications/Xcode10.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/usr/lib/libz.tbd'

The valid (existing on my machine) path should be:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/lib/libz.tbd

Not sure where these comes from, and why it works OK with QMake..?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.