olivierldff / qtioscmake Goto Github PK
View Code? Open in Web Editor NEW๐ฑ Deploy Qt Application for iOS with a single macro when using CMake.
License: BSD 3-Clause "New" or "Revised" License
๐ฑ Deploy Qt Application for iOS with a single macro when using CMake.
License: BSD 3-Clause "New" or "Revised" License
module "QtQuick.Controls" is not installed
What is wrong ?
Qt 5.15.2
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
Any idea why Xcode thinks that it is not worth to upload https://github.com/davemilter/qt_ios_libs_bug into their shop?
Support boolean ITSAppUsesNonExemptEncryption
. Otherwise user need to manually do it TestFlight (NO/YES)
https://help.apple.com/xcode/mac/current/#/dev0dc15d044
Also support ITSEncryptionExportComplianceCode
(If YES) https://developer.apple.com/documentation/bundleresources/information_property_list/itsencryptionexportcompliancecode
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 ?
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?
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.
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
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
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
Thanks for project, sorry for may be stupid question.
Here is my working team_id:
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,
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?
This tool chain is support qt6 or not ?
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.
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
My current setup:
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..?
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.
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
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 ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.