I’m consolidating some information from another post to give you guys some tips and tricks on how I designed the XCode 4 project for my open source and MIT-licensed project “A Collection of Useful C++ Classes for Digital Signal Processing”. All the sources and project files explained in this post are available in the Google Code SVN repo, or if you are too lazy you can download the entire source tree, plus prebuilt executable installers for Mac OS X and Windows from this one link:
DSP Filters 0.9.71 full sources plus prebuilt executables for Mac OS X and Windows (.zip)
First of all it is possible for a single XCode 4 project to target both Mac and iOS. Just use Add Target and create one Mac OS X target and one iOS target. This shows the two targets in DSPFiltersDemo:
[attachment=2]multiple_targets.jpg[/attachment]
The “Mac” and “iOS” groups (yellow folders) in the DSPFiltersDemo project each have their own set of framework references, icons, and plist. The plist and icons are set independently on the target’s build properties. Control over target membership of frameworks is accomplished through the Utilities panel (the area on the right of the window). The project contains frameworks for both platforms, but each framework is only a member of the appropriate target, as seen in this image:
[attachment=1]framework_references.jpg[/attachment]
A project can also have other projects included as children. The benefit of doing this is that you can add dependencies to child projects so they will build automatically when the main project is built. It also allows you add the outputs of child projects to your Build Phases as dependencies and libraries to link with. To add the dependency, select your project and click the plus sign under Target Dependencies, and you will see choices for your child projects. To link with the static library, select your project and drag the child project’s output library file into the “Link Binary With” portion of Build Phases. This is all demonstrated in this screenshot:
[attachment=0]child_projects.jpg[/attachment]
