Cocoa Geek


Using Doxygen with xCode

Posted in Cocoa, General Development by andrew on the July 19th, 2008

Further to my Doxygen post a couple of weeks ago i thought i would just write something up on using it in xCode. There are some really useful features for not only viewing the documentation you produce but automatically updating your documentation as you compile.

Viewing documentation in xCode

First of all create a new group in the project files hierarchy - call this group something like Documentation.

Add the index.html file that was created when you first ran Dexoygen on this project. Double clicking on this file will probably just show the HTML that was produced for this file, which is pretty useless. To change this default behavior right click on index.html and select the Get Info under file type which will be set to text.html this needs changing to text.html.documentation. Close the Get Info window and double click the index.html file again this time it will open in the standard documentation browser.

Updating the documentation as you compile

This time you need to add a new build phase to your compile. Find your target file and right click again. This time choose Add > New Build Phase > New Run Script Build Phase when you run this you will get a nice window allowing you to write a shell script that will be run after the other build phases are compleated. It is important before you do this that you make sure you saved you config file in the doxygen Gui and saved it in the root of your projects file structure.

Now just add the following to the script field:

/Applications/Doxygen.app/Contents/Resources/doxygen Doxyfile

Where Doxyfile is the name of your config file for your project. You can rename this build phase to make it more obvious to you or someone else what it is doing.

Leave a Reply