grame-cncm / libmusicxml

A C/C++ library to support the MusicXML format.
Mozilla Public License 2.0
152 stars 33 forks source link

`make iOS` creates a macOS library #64

Open JakubMazur opened 7 months ago

JakubMazur commented 7 months ago

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 commented 7 months ago

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 commented 7 months ago

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

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