Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is only a partial answer because I also haven't yet figured out how to do this with the OpenCV libraries. (<strong>Figured it out. See update below.</strong>) But I have done it with other libraries (<a href="http://developer.snowmintcs.com/frameworks/sm2dgraphview/" rel="nofollow">SM2DGraphView</a>).</p> <p>There are three things that need to happen:</p> <ol> <li><p>You need to copy the OpenCV libraries that your program uses into the application bundle. To do that (in Xcode 3, anyway), add a Copy Files build phase to your target. Drag the library files from Xcode's file list onto the build phase. Double-click the Copy Files item and set the destination to Frameworks. <br><br>Note that you need to make sure that the library you include in your Xcode project is a library file and not a symlink to a library file. Otherwise only the symlink will be copied to your application bundle.</p></li> <li><p>The install path of the OpenCV framework files needs to be set to <code>@executable_path/../Framework</code>. If the framework was being built in Xcode, you'd do this in the project settings. Since OpenCV is not being built in Xcode you need to do it after the fact with the <code>install_name_tool</code> command line program: <code>install_name_tool -id @executable_path/../Frameworks libopencv_imgproc.2.3.1.dylib</code>. You should be able to set this up in a Run Script build phase in your target.</p></li> <li><p>The executable needs to find the library in the bundle's <code>Frameworks</code> directory. This is where I'm currently stuck.</p></li> </ol> <p><strong>Update</strong></p> <p>I found the correct install_name_tool commands to get the program to see the libraries (and the libraries to see the other libraries). The information on <a href="http://doc.qt.nokia.com/qq/qq09-mac-deployment.html" rel="nofollow">the Qt page for deploying OS X programs</a> was the key.</p> <p>I ran <code>otool -L</code> on the executable file in my program's Contents/MacOS directory and saw this [non-relevant lines removed]:</p> <pre><code>lib/libopencv_core.2.3.dylib (compatibility version 2.3.0, current version 2.3.1) lib/libopencv_imgproc.2.3.dylib (compatibility version 2.3.0, current version 2.3.1) lib/libopencv_highgui.2.3.dylib (compatibility version 2.3.0, current version 2.3.1) </code></pre> <p>So I used these commands (while in the Contents/MacOS directory) to get the program to look in the right place for the libraries:</p> <pre><code>install_name_tool -change lib/libopencv_core.2.3.dylib @executable_path/../Frameworks/libopencv_core.2.3.1.dylib CocoaCVTest install_name_tool -change lib/libopencv_imgproc.2.3.dylib @executable_path/../Frameworks/libopencv_imgproc.2.3.1.dylib CocoaCVTest install_name_tool -change lib/libopencv_highgui.2.3.dylib @executable_path/../Frameworks/libopencv_highgui.2.3.1.dylib CocoaCVTest </code></pre> <p>Then I changed to the Contents/Frameworks directory and used these commands to tell the libraries where they were installed:</p> <pre><code>install_name_tool -id @executable_path/../Frameworks/libopencv_core.2.3.1.dylib libopencv_core.2.3.1.dylib install_name_tool -id @executable_path/../Frameworks/libopencv_imgproc.2.3.1.dylib libopencv_imgproc.2.3.1.dylib install_name_tool -id @executable_path/../Frameworks/libopencv_highgui.2.3.1.dylib libopencv_highgui.2.3.1.dylib </code></pre> <p>Now the imgproc library needs to be told where to find the core library and highgui needs to be told where to find core and imgproc:</p> <pre><code>install_name_tool -change lib/libopencv_core.2.3.dylib @executable_path/../Frameworks/libopencv_core.2.3.1.dylib libopencv_imgproc.2.3.1.dylib install_name_tool -change lib/libopencv_core.2.3.dylib @executable_path/../Frameworks/libopencv_core.2.3.1.dylib libopencv_highgui.2.3.1.dylib install_name_tool -change lib/libopencv_imgproc.2.3.dylib @executable_path/../Frameworks/libopencv_imgproc.2.3.1.dylib libopencv_highgui.2.3.1.dylib </code></pre> <p>I'm still running into an issue where highgui is looking for a lot of libraries in /opt/local/bin but I'm fairly confident that the OpenCV part of the problem is solved. Now I just need to get all these commands into a build phase in Xcode.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload