Apple's Xcode and its related tools installed in the default location. There is no Xcode project for PortAudio.
Mac 10.4 SDK. Look for "/Developer/SDKs/MacOSX10.4u.sdk" folder on your system. It may be installed with XCode. If not then you can download it from Apple Developer Connection. http://connect.apple.com/
./configure && make
You do not need to do "make install", and we don't recommend it; however, you may be using software that instructs you to do so, in which case you should follow those instructions. (Note from Phil: I had to do "sudo make install" after the command above, otherwise XCode complained that it could not find "/usr/local/lib/libportaudio.dylib" when I compiled an example.)
The result of these steps will be a file named "libportaudio.dylib" in the directory "usr/local/lib/".
By default, this will create universal binaries and therefore requires the Universal SDK from Apple, included with XCode 2.1 and higher.
build a non-universal library using configure options. use lipo(1) on whatever part of the library you plan to use.
Note that the first option may require an extremely recent version of PortAudio (February 5th '08 at least).
./configure --disable-mac-universal && make
The --disable-mac-universal option may also be used in conjunction with environment variables to give you more control over the universal binary build process. For example, to build a universal binary for the i386 and ppc architectures using the 10.4u sdk (which is the default on 10.4, but not 10.5), you might specify this configure command line:
CFLAGS="-O2 -g -Wall -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3" \ LDFLAGS="-arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3" \ ./configure --disable-mac-universal --disable-dependency-tracking
For more info, see Apple's documentation on the matter:
http://developer.apple.com/technotes/tn2005/tn2137.html http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/intro/chapter_1_section_1.html
lipo lib/.libs/libportaudio.a -thin i386 -output libportaudio.a
or if you want to extract a single architecture fat file:
lipo lib/.libs/libportaudio.a -extract i386 -output libportaudio.a
./configure --enable-mac-debug && make
This will enable -g and disable -DNDEBUG which will effectively enable asserts.
Once you've compiled PortAudio, the easiest and recommended way to use PortAudio in your XCode project is to add "<portaudio>/include/portaudio.h" and "<portaudio>/lib/.libs/libportaudio.a" to your project. Because "<portaudio>/lib/.libs/" is a hidden directory, you won't be able to navigate to it using the finder or the standard Mac OS file dialogs by clicking on files and folders. You can use command-shift-G in the finder to specify the exact path, or, from the shell, if you are in the portaudio directory, you can enter this command:
open lib/.libs
Then drag the "libportaudio.a" file into your XCode project and place it in the "External Frameworks and Libraries" group, if the project type has it. If not you can simply add it to the top level folder of the project.
You will need to add the following frameworks to your XCode project:
make -f Makefile.darwin
Back to the Tutorial: PortAudio Tutorials