This tutorial will explain how to setup Doxygen with X-Code 4.0. If you want to document your code exactly as Apple Documentation, you might use Doxygen and follow this tutorial.Apple guidefor this purpose is based on previous versions of xCode, and could be helpless for xcode 4.0
So, i wil try to explain it the easiest possible , step by step.
- Step 1. Download & Install Doxygen at:
Download Doxygen and the drag it to Applications folder
- Step 2.
After adding a build Phase, you have to copy this script in the shell space:
# Build the doxygen documentation for the project and load the docset into Xcode.
# Use the following to adjust the value of the $DOXYGEN_PATH User-Defined Setting:
# Binary install location: /Applications/Doxygen.app/Contents/Resources/doxygen
# Source build install location: /usr/local/bin/doxygen
# If the config file doesn’t exist, run ‘doxygen -g $SOURCE_ROOT/doxygen.config’ to
# a get default file.
if ! [ -f $SOURCE_ROOT/doxygen.config ]
echo doxygen config file does not exist
$DOXYGEN_PATH -g $SOURCE_ROOT/doxygen.config
# Append the proper input/output directories and docset info to the config file.
# This works even though values are assigned higher up in the file. Easier than sed.
cp $SOURCE_ROOT/doxygen.config $TEMP_DIR/doxygen.config
echo “INPUT = $SOURCE_ROOT” >> $TEMP_DIR/doxygen.config
echo “OUTPUT_DIRECTORY = $SOURCE_ROOT/DoxygenDocs.docset” >> $TEMP_DIR/doxygen.config
# This command makes all work! it tells Doxygen app to scan recursively the source forlder.
echo “RECURSIVE = YES” >> $TEMP_DIR/Doxyfile
echo “EXTRACT_ALL = YES” >> $TEMP_DIR/Doxyfile
echo “GENERATE_DOCSET = YES” >> $TEMP_DIR/doxygen.config
echo “DOCSET_BUNDLE_ID = com.mycompany.DoxygenExample” >> $TEMP_DIR/doxygen.config
# Run doxygen on the updated config file.
# Note: doxygen creates a Makefile that does most of the heavy lifting.
# make will invoke docsetutil. Take a look at the Makefile to see how this is done.
make -C $SOURCE_ROOT/html install
# Construct a temporary applescript file to tell Xcode to load a docset.
rm -f $TEMP_DIR/loadDocSet.scpt
echo “tell application \”Xcode\”” >> $TEMP_DIR/loadDocSet.scpt
echo “load documentation set with path \”/Users/$USER/Library/Developer/Shared/Documentation/DocSets/com.mycompany.DoxygenExample.docset\””
echo “end tell” >> $TEMP_DIR/loadDocSet.scpt
# Run the load-docset applescript command.
Step 3. Now, you need to tell xcode where to find Doxygen. we will user a preprocessor defintion:
Click on project -> the select you app project -> add Building Setting -> add New User-Defined setting
then, type: DOXYGEN_PATH
And in value: /Applications/Doxygen.app/Contents/Resources/doxygen or your where you have instaled doxygen
now you just have to run you app… and you´ve a got it!!