leetal / ios-cmake

A CMake toolchain file for iOS/iPadOS, visionOS, macOS, watchOS & tvOS C/C++/Obj-C++ development
BSD 3-Clause "New" or "Revised" License
1.89k stars 448 forks source link

[bug] Missing watchOS arm64 architecture #213

Open djavan-bertrand opened 1 month ago

djavan-bertrand commented 1 month ago

Describe the bug When building for watchOS (WATCHOS or WATCHOSCOMBINED) and using the lib in Xcode, the Xcode build fails because architecture arm64 is not found.

To Reproduce Steps to reproduce the behavior:

  1. Build using WATCHOS platform flag
  2. Embed the dylib in a xcframework
  3. Use this xcframework in a Apple Watch target in Xcode.

=> Xcode fails with undefined symbols and a warning:

ignoring file 'PATH/MY_LIB.dylib': fat file missing arch 'arm64', file has 'armv7k,arm64_32'

Expected behavior The Xcode build should succeed

Solution found Even though I am not sure it is the correct way to do so, here is how I fixed this bug: I replaced line 450 of the ios.toolchain.cmake script with:

set(ARCHS arm64 armv7k arm64_32)

(instead of set(ARCHS armv7k arm64_32)) If it is the correct way, do not hesitate to tell me, I can submit a PR for you.

Environment