Creating a Osx/iOS Plugin with a 3rd party Framework dependency

I’d like to write a UE4 plugin which has a dependency to a 3rd party framework and I am having problems figuring out how to declare a dependency to this framework.
PublicAdditionalFrameworks.AddRange does not seem to do the trick since it’s only used for built-in framworks (QuartzCore etc.).

Pulling out the dylib from the framework and adding it with PublicAdditionalLibraries.AddRange lets me compile my plugin but fails at startup because the library includes a @rpath definition (something like “@rpath …/bla.framwork/Versions/A/bla”) which leads to an error (“…/bla.framwork/Versions/A/bla” could not be found).

I found this question on AnswerHub which does not really have an answer, I have read the documentation here and here, looked at the build system code for mac and went through the plugins on github.

None of this resources really helped me.

So i guess the question is: Is it possible to create a plugin with a dependency to a 3rd party framework or can i somehow get the dylib to load up correctly?

I’m afraid that we don’t have support for using third party frameworks yet. And looking at the code that’s setting up the linker, the best/easiest temp workaround I can suggest is to copy this framework to /Library/Frameworks and use PublicAdditionalFrameworks.AddRange.

Alternatively, you could try copying and renaming the blah.dylib from the framework to libblah.dylib, using install_name_tool -id libblah.dylib libblah.dylib, then linking with it.

That’s for Mac. If you want to use it in iOS, your only option, I think, is to somehow get ahold of a static library instead of a framework as Apple forbids using frameworks and dylibs in iOS.

Thanks! Your suggestions worked great for Mac.

I went the route of copying/renaming the dylib.

Here is what i did (for reference):

  • Copy blah.framework/blah to /Binaries/Mac/libblah.dylib
  • Go to /Binaries/Mac/ and run “install_name_tool -id libblah.dylib libblah.dylib”
  • Add libblah.dylib to the plugin .Build.cs with PublicAdditionalFrameworks.AddRange

hey, i’m trying to do the same thing on framework in swift im writing which uses a third party sdk .
can you tell me the procedure for iOS apps how would you do that ?