Project

General

Profile

Xcode project

First, you must be sure, all libs (OpenCV, Irrlicht) are build for the same architecture (e.g. Intel 64 bit).

Then you could create an XCode project:

  • You must link the Irrlicht static lib (libirrlicht.a).
  • You must link OpenCV dynamic libs (several of them)

Linking Irrlicht

First, it is *not* necessary to create Carbon, Cocoa or other special application. Command line will do.

My *Build Settings* were following:

  • Architectures: 64-bit Intel (just my option, you could use 32-bit, but irrlicht must be also build as 32-bit lib)
  • Base SDK: 10.7 Lion (again does not matter)
  • Build Active Architecture only: YES
  • Compiler: Apple LLVM 3.1 (also GCC 4.2 will do)
  • C++ standard library: *libstdc++*
  • GCC_PRECOMPILE_PREFIX_HEADER = YES
  • GCC_PREFIX_HEADER = (empty)

In *Build Phases* just link the binary with following files:

  • Frameworks:
    • IOKit
    • OpenGL
    • Carbon
    • Cocoa
  • Other files:
    • libirrlicht.a (e.g. in /usr/lib)

Now, click in XCode file browser on *libirrlicht.a* and in *Utilities* pane (right side) look in *Identity and Type* section. *File Type* must be *Mach-O object code*.

Linking OpenCV

In *Build settings*

Add to the *Header Search Path* path to the OpenCV include files (e.g. /opt/local/include).

In *Build Phases* just link the binary with following files (Other button):

  • /opt/local/lib/libopencv_calib3d.2.3.1.dylib
  • /opt/local/lib/libopencv_contrib.2.3.1.dylib
  • /opt/local/lib/libopencv_core.2.3.1.dylib
  • /opt/local/lib/libopencv_features2d.2.3.1.dylib
  • /opt/local/lib/libopencv_flann.2.3.1.dylib
  • /opt/local/lib/libopencv_gpu.2.3.1.dylib
  • /opt/local/lib/libopencv_highgui.2.3.1.dylib
  • /opt/local/lib/libopencv_imgproc.2.3.1.dylib
  • /opt/local/lib/libopencv_legacy.2.3.1.dylib
  • /opt/local/lib/libopencv_ml.2.3.1.dylib
  • /opt/local/lib/libopencv_objdetect.2.3.1.dylib
  • /opt/local/lib/libopencv_ts.2.3.1.dylib
  • /opt/local/lib/libopencv_video.2.3.1.dylib

Not all libs are necessary. That depends on your application.

Conclusion

Thats all. Just be carefull on versions of libs (32/64-bit), appropriate settings of the .a lib and compiler settings.