4

If you try to use a 3rd party library (compiled using make or cmake) in your iOS 13 project and turn on the "UIKit For Mac" option, Xcode will be unhappy about the library. It will complain that the provided library is compiled for the wrong architecture (if you point it to the iphoneos version). Or, it will complain that it is compiled for the wrong platform (if you point it to the simulator or Mac version). What settings do I need to specify in the Makefile to make Xcode to accept the library under the "UIKit For Mac" option?

Anton
  • 1,655
  • 15
  • 16

1 Answers1

5

Well, after digging around for a while, I found out that if you supply clang with the following target (set the CFLAGS variable before calling configure), it compiles the right version of the library (note the -macabi suffix):

-target x86_64-apple-ios${MIN_IOS_VERSION}-macabi

I also add the minimum os version flag to the macOS version:

-mmacosx-version-min=${MIN_OSX_VERSION}

Here MIN_IOS_VERSION="13.0" and MIN_OSX_VERSION="10.15"

Anton
  • 1,655
  • 15
  • 16
  • where we need to set above configuration ? can you please update answer with image. – Hardik Thakkar Aug 13 '19 at 12:07
  • 1
    The question was about customizing the compilation of a regular 3rd party library package using make on a command line. Here is a rough sketch of what you need to do. For more information please read about `make` and `configure`. `export CFLAGS="$CFLAGS -target x86_64-apple-ios13.0-macabi"; export CXXFLAGS="$CXXFLAGS -target x86_64-apple-ios13.0-macabi"; configure; make` – Anton Aug 15 '19 at 15:55
  • Sorted my issue, the lack of proper documentation is insane! – Pedro Paulo Amorim Nov 27 '20 at 13:15