elucideye / drishti

Real time eye tracking for embedded and mobile devices.
BSD 3-Clause "New" or "Revised" License
392 stars 82 forks source link

xcode iOS toolchains with CMake and enterprise account #720

Closed ygyin-ivy closed 6 years ago

ygyin-ivy commented 6 years ago

I want to build ios app with cmake 3.11.4 I chose folder drishti and get a log -- config.cmake -- MSVC: APPLE: 1 ANDROID: IOS: is_linux: 0 XCODE: 1 its a log for build macOS.
which folder i should choose, or where to config ios build? Thanks

headupinclouds commented 6 years ago

If you want to build for iOS, you will have to use an iOS toolchain. I recommend using polly for the builds, which is a python front end with built in toolchains that supports condensed one-line build + install command lines. Please take a look at the README for more examples and details and how to select a toolchain

In the same table, you can find iOS SDK version. E.g., if you have installed Xcode 9.4 with default iOS SDK 11.4, and you want to set the deployment SDK to version 9.3, you can use --toolchain ios-11-4-dep-9-3-arm64 to build the ARM64 architecture

You could run something like this:

TOOLCHAIN=ios-11-4-dep-9-4-arm64
CONFIG=Release
polly.py --toolchain ${TOOLCHAIN} --config-all ${CONFIG} --install --verbose --reconfig --fwd DRISHTI_BUILD_EXAMPLES=ON

You can find a list of toolchains in the top level of this project:

https://github.com/ruslo/polly

ygyin-ivy commented 6 years ago

i know those, but i have more interested in Native IOS build of news 8/10

headupinclouds commented 6 years ago

i know those, but i have more interested in Native IOS build of news 8/10

I'm not sure I follow, but if you want to build the native iOS facefilter app from the 8/10 commit, it will be built from the top level CMake/polly build with option DRISHTI_BUILD_EXAMPLES. Since CMake has an Xcode generator, the FaceFilter target is just a normal add_executable call. This is in contrast to Android Studio, where gradle ends up managing the CMake build. You don't have to do anything special to build the iOS app.

ygyin-ivy commented 6 years ago

![Uploading cmake-drishti.png…]()

option DRISHTI_BUILD_EXAMPLES is enable. cmake only generate macOS project

headupinclouds commented 6 years ago

What did you type? What version of Xcode do you have and which version of iOS do you have installed on your phone? It sounds like you aren't using an iOS toolchain.

If you build from polly.py and use a toolchain starting with ios-* it should create an iOS project.

TOOLCHAIN=ios-11-4-dep-9-4-arm64
CONFIG=Release
polly.py --toolchain ${TOOLCHAIN} --config-all ${CONFIG} --install --verbose --reconfig --fwd DRISHTI_BUILD_EXAMPLES=ON
ygyin-ivy commented 6 years ago

xcode 9.4, ios 11.4 not type , not use polly.py only chose top dir using cmake-gui

headupinclouds commented 6 years ago

only chose top dir using cmake-gui

This won't work. You have to cross compile for your iPhoneOS target from your macOS host, which requires a toolchain.

xcode 9.4, ios 11.4

In that case, the polly.py command I typed above should work fine for you.

You can find more details about polly iOS toolchains here.

ygyin-ivy commented 6 years ago

thx yestoday i tried this cross compile , stuck at POLLY_IOS_DEVELOPMENT_TEAM and bundle identifier.

headupinclouds commented 6 years ago

You will have to set the POLLY_IOS_DEVELOPMENT_TEAM and the POLLY_IOS_BUNDLE_IDENTIFIER. Please read this section for details related to the Bundle ID. The setup in the last link is a 1x process which I believe you need to do the first time you install Xcode. You will need to have a valid Apple Developer account to run on your phone. I'll add more details about the iOS setup on the README. Unfortunately the code signing steps make the "quick start" a little less quick for iOS devices 😄

headupinclouds commented 6 years ago

I've updated the README w/ the above notes and clarified the need for a toolchain to run the iOS builds.

ygyin-ivy commented 6 years ago

Is there any way to pass -allowProvisioningUpdates to xcodebuild with polly.py?

Run Build Command:"/usr/bin/xcodebuild" "-project" "CMAKE_TRY_COMPILE.xcodeproj" "build" "-target" "cmTC_b3beb" "-configuration" "Debug"
=== BUILD TARGET cmTC_b3beb OF PROJECT CMAKE_TRY_COMPILE WITH CONFIGURATION Debug ===

Check dependencies
Code Signing Error: No profiles for 'com.ivy.example.TestDrishiti' were found:  Xcode couldn't find any iOS App Development provisioning profiles matching 'com.ivy.example.TestDrishiti'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.
Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 11.4'
headupinclouds commented 6 years ago

Is there any way to pass -allowProvisioningUpdates to xcodebuild with polly.py?

No.

The error you are hitting is the one that is described in this link. This can happen if you are using an enterprise account. The link provides a solution for the problem. I've posted the error + link to the README. Let me know if that helps.

ygyin-ivy commented 6 years ago

i have tried to set POLLY_IOS_BUNDLE_IDENTIFIER that is described in that link , both enterprise account and my personal account. it's not work. maybe i still need to set something when using my personal account. when i fix this signing issue , i will post my solution in this post

headupinclouds commented 6 years ago

when i fix this signing issue , i will post my solution in this post

Okay, that would be helpful. Unfortunately, this issue is hard for me to reproduce and troubleshoot.

Here are two issues that provide background on the above polly links. I think it will be worthwhile reading through those:

https://github.com/ruslo/polly/issues/102 https://github.com/ruslo/polly/issues/170

headupinclouds commented 6 years ago

Can you step through the setup in the follow link and post the results here? This will help verify your development setup.

https://polly.readthedocs.io/en/latest/toolchains/ios/bundle-id.html#bundle-id

ygyin-ivy commented 6 years ago

https://polly.readthedocs.io/en/latest/toolchains/ios/bundle-id.html#bundle-id

it's not work. i will read through those issues

headupinclouds commented 6 years ago

it's not work. i will read through those issues

Okay, that's good, actually. It means you have Apple environment + code signing issues that are unrelated to polly + toolchains. If you can get the last step working with a minimal project, i.e.:

"Run example on real device. By this you will verify that build and signing is working correctly"

The polly build should work.

ygyin-ivy commented 6 years ago

it should be a code signing issue,
ipodidentifier

Although i created a minimal project with my personal account and ran this on iPod touch, the polly build is still not working.

i will try to find why.

ygyin-ivy commented 6 years ago

finally i fix this issue.

iphonedeveloper

at the key-chain , there are two kinds of certification

  one is   iPhone distribution .
  set it to POLLY_IOS_DEVELOPMENT_TEAM , the polly build works.

  one is  iPhone developer.
  set it to POLLY_IOS_DEVELOPMENT_TEAM , the polly build fails with this issue .