How to package Apple Frameworks

To package an Apple framework:

  • Copy/create a framework folder XXX.framework (XXX being the name of your framework), to your package folder, where you should put all the subdirectories (Headers, Modules, etc).
def package(self):
    # If you have the framework folder built in your build_folder:
    self.copy("XXX.framework/*", symlinks=True)
    # Or build the destination folder:
    tools.mkdir("XXX.framework/Headers")
    self.copy("*.h", dst="XXX.framework/Headers")
    # ...
  • Declare the framework in the cpp_info object.
def package_info(self):
    ...
    self.cpp_info.includedirs = ['XXX.framework/Headers']
    self.cpp_info.exelinkflags.append("-framework XXX")
    # Note that -F flags are not automatically adjusted in "cmake"
    # generator so it will be needed to declare its path like this:
    # self.cpp_info.exelinkflags.append("-F path/to/the/framework -framework XXX")
    self.cpp_info.sharedlinkflags = self.cpp_info.exelinkflags