Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make iOS creates a macOS library #64

Open
JakubMazur opened this issue Feb 3, 2024 · 2 comments
Open

make iOS creates a macOS library #64

JakubMazur opened this issue Feb 3, 2024 · 2 comments

Comments

@JakubMazur
Copy link

JakubMazur commented Feb 3, 2024

I'm trying to compile for iOS with make ios, but when I'm trying to use it with Xcode I'm getting error:

  1. cloning repo
  2. from a build running make ios
  3. getting a libmusicxml2.a file from build/lib
  4. copy exports.h and libmusicxml.h to Xcode and linking it with bridging header
  5. I've also tried to make from iosdir but doesn't seems to make any difference
Showing Recent Messages
Building for 'iOS', but linking in object file (.../libmusicxml/libmusicxml2.a[2](factory.cpp.o)) built for 'macOS'

I also tried to build for Xcode with cmake -G Xcode but then (probably rightfully) scheme ALL_BUILD has also only macOS target.

I've tried to integrate then this library build for macOS with separate target in Xcode for macOS and it's working without issues. There is a way to compile this for iOS?

@JakubMazur JakubMazur changed the title make iOS creates an macOS library make iOS creates a macOS library Feb 3, 2024
@JakubMazur
Copy link
Author

This is (kind of) working:
https://stackoverflow.com/a/61317610/1317394

When I compile with

cmake -G Xcode -B ios \
    -DCMAKE_SYSTEM_NAME=iOS \
    -DCMAKE_Swift_COMPILER_FORCED=true \
    -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0

I can build on either simulator or device (can't create universal lib with that).

@arshiacont
Copy link
Contributor

To use this for both iOS and iOS-simulator you'd need to do either:

  • compile a separate .a for iOS and iOS simulator and in your host Xcode project link separately to the two libs for given platforms (Xcode provides the option)
  • More modern approach: write a script that compiles both as framework and then make a XCFramework out of it and just add that your project.

I have a script for the second that I can share next week when I get back to my build system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants