0

Im currently working on a Swift Framework using OpenCV (3.4.3), and im having some troubles or getting confused about how the build processes work.

Note I'm not using CocoaPods, Im using the framework file/folder provided by OpenCV

So my problem is that I'm creating the swift framework that depends on OpenCV, once I've built my framework and add/link it to a App (Its added to the embedded frameworks section), the app runs fine with no errors. This is where my confusion lies, I would expect to also add OpenCV to my app then have them link at runtime/compile time, but that's not the case OpenCV is magically linked and working. I have also double, triple checked that there is no references of OpenCV in the app to ensure its not getting pulled in anywhere.

For some sanity checks I created a basic framework called TestFramework, which had 1 class, with a static function just so I can test the above process. I added TestFramework to the main framework im working on, and built it. I then added that Framework to my app, and it would not build because the TestFramework was not present in the App as a dependency. Then adding the framework allowed it to build, and the main framework then was able to call the code within the TestFramework.

There seems to be some discrepancy between how the two work, unless the OpenCV framework is built in a different way allowing it to work without the app depending on it.

Any help or thoughts would be great, thanks.

Jake Wade
  • 571
  • 3
  • 19
  • Can you please elaborate this statement: "I have also double, triple checked that there is no references of OpenCV in the app to ensure its not getting pulled in anywhere". Does this mean that your app does NOT call any functions in OpenCV? If not, can you try calling one and see if the app builds? – jms Aug 19 '19 at 02:32
  • Yes so the App does not currently include or use OpenCV but the Framework does. I've done some more digging and part of the issue is that OpenCV is built as a Static Framework, so it gets compiled into the end Framework. So I tried to build the dynamic library and still get a similar issue. – Jake Wade Aug 19 '19 at 08:25
  • @jms I got a little bit further with my build process, and have created a new question as I have a new problem. https://stackoverflow.com/questions/57559389/swift-framework-with-opencv-dynamic-framework-library-not-loaded . If you wouldn't mind taking a look to see if you have a solution to the new problem that would be much appreciated – Jake Wade Aug 19 '19 at 15:42
  • I was gonna boil down the question to the static/dynamic linking of libraries. Good that you found this out by yourself. Sure I will look at the question when I have time. – jms Aug 20 '19 at 13:46

0 Answers0