Tutorial XCode 4.0 Doxygen

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 ]
then
echo doxygen config file does not exist
$DOXYGEN_PATH -g $SOURCE_ROOT/doxygen.config
fi

# 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.

$DOXYGEN_PATH $TEMP_DIR/doxygen.config

# make will invoke docsetutil. Take a look at the Makefile to see how this is done.

make -C $SOURCE_ROOT/html install
echo “success”
# 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\””
>> $TEMP_DIR/loadDocSet.scpt
echo “end tell” >> $TEMP_DIR/loadDocSet.scpt

# Run the load-docset applescript command.

osascript $TEMP_DIR/loadDocSet.scpt

exit 0
Like this:

example with script

example with script

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

 doxygen pathhey

now you just have to run you app… and you´ve a got it!!

Anuncios

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s

A %d blogueros les gusta esto: