Here are a set of instructions for installing fftw3 and using it in an Xcode project.
- Download and install Macports
- In a terminal window type
sudo port install fftw-3 +universal
- If you also want single precision, you can add it by typing (Note: fftw-3-single requires fftw-3.)
sudo port install fftw-3-single +universal
- In your Xcode project, you will need to alter the search paths for header files and for libraries. Note, I am using XCode 7.
- Select your project -> Build Settings -> Search Paths (As shown in the figure below).
- Add /usr/local/include to the Header Search Paths (both debug and release)
- Add /usr/local/lib to the Library Search Paths (both debut and release)
- Once you’ve done the above, you should now be able to #include <fftw3.h>. You can not yet use fftw; you still need to link in the library.
- To link the library,
- Select your project -> Build Phases
- Select “Link Binary with Libraries”
- Click on the + symbol to add a new library.
- Now click “Add Other…”
- Simultaneously type Cmd+Shift+g
- Type in /usr/local/lib
- Select libfftw3.a and click on Open.
- If you also want single precision, you can add libfftw3f.a by following the same procedure.