开发者

Create multiple executables in XCode

There are various versions of this question but I havnt been able to find what Im looking for.

I have a bunch of cpp files in the OpenCV samples directory. I would like to create a project in XCode that can compile and build all the executables. I opened a new project, added all the sample source files, included the correct header files开发者_StackOverflow中文版 and the right link paths and then got stuck because I dont know how to make the project build and link executables for each relevant cpp file. Im guessing Im doing this completely wrong so any help would be appreciated.


In Xcode 4, click on the Project icon in the navigator which should bring up a Projects and Targets section in the main pane. There should be an "Add Target" button at the bottom. Just add a new target and then specify which source files you want in the "Compile Sources" section in the "Build Phases" tab.

Xcode 3 is should be similar. Add a new target and tell it which source files to use.

HTH


You don't need XCode to build samples, OpenCV on Mac OS X makes use of cmake to generate makefiles which, in turn, are being consumed by gcc.

Please read: http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port

So, assuming you have cmake installed, in OpenCV source directory run:

sudo cmake -D BUILD_EXAMPLES=ON -G "Unix Makefiles" .

You have Makefile in your 'samples' directory now and can compile samples:

cd samples
sudo make

The sample binaries will be put in the 'bin' directory. Voilà!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜