Integrating cocos2d API reference into XCode

You can have the cocos2d API reference integrated into XCode by following these steps:

Install doxygen

Select the cocos2d-documentation target

  • Open the cocos2d-iphone xcode project
  • Select the “cocos2d-documentation” target
    • XCode -> Project -> Set Active Target -> cocos2d-documentation

doc-target

Build the target

  • Build the target like any other target
    • XCode -> Build -> Build

doc-build

Open the XCode Documentation

  • Open The XCode documentation browser
    • XCode -> Help -> Documentation

doc-help

Use the cocos2d API reference

  • Select the cocos2d-documentation component from the available DOC SETS
  • Search for your favorite word. eg: AtlasSprite

doc-search

79 Responses to “Integrating cocos2d API reference into XCode”


  • with Doxygen 1.5.7 the build worked but i couldnt find the cocos2d documentation in the doc sets (even after xcode restart). with Doxygen 1.7.2 im getting the dot tool not found and the mscgen tool not found problem. I fixed the dot tool problem with graphviz but what about the mscgen tool path????? im using cocos2d 0.99.5 (stable)

  • i fixed the mscgen tool path problem by setting it to blank in doxygen.config. However I am having the following error:

    error: tag OUTPUT_DIRECTORY: Output directory `/Users/…/cocos2d-iphone-0.99.5/build/cocos2d-ios.build/Debug-iphoneos/cocos2d-documentation.build/doxygen_output’ does not exist and cannot be created

  • When I “Integrating cocos2d(0.99.5) API reference into XCode”, I get 2 warnings and 430 errors. Xcode show :
    2 warnings:
    warning: the dot tool could not be found at /Applications/Doxygen.app/Contents/Resources/
    warning: the mscgen tool could not be found at /Applications/Doxygen.app/Contents/Resources/

    430 errors:
    error: problems opening map file /Users/neal/cocos2d-iphone-0.99.5/build/cocos2d-ios.build/Debug/cocos2d-documentation.build/doxygen_output/html/interface_c_c_motion_streak__inherit__graph.map for inclusion in the docs!

  • I couldn’t get the docs to generate using Doxygen 1.7.3. I received the 430 errors, including the dot tool and mscgen tool errors as previously described. I uninstalled Doxygen 1.7.3 and downloaded 1.5.8 from http://olex.openlogic.com/packages/doxygen/1.5.8#package_detail_tabs

    The docs built and installed just fine with Doxygen 1.5.8. I restarted Xcode and the new docset appeared. Stick with 1.5.8 and you shouldn’t have any issues. This was clearly a case of using a later version of the Doxygen software for a script developed specifically to work with an earlier version. I’m sure it is possible to get it working with the latest version, but I gave up after an hour or so of playing with different settings and reverted to the version specified in the script file for cocos2d 0.99.5.

  • If you have any problem with creating docset, you may be using Doxygen 1.7+.
    The newer Doxygen version does not come with dot tool.
    If you install graphviz, you may still have the problem building docset using Xcode.

    If you’re using Doxygen 1.7+, just remove it and reinstall Doxygen 1.5.x.
    The problem is that Doxygen 1.7+ and Xcode do not work together.
    cocos2d-iphone 0.99.5 does not have any problem.

    Hope it helps~

  • im still having problems doing this. Now i am using Doxygen 1.5.8 (ive also tried 1.5.7) and they build cocos2d-documentation successfully but the docset is not showing up. I restarted xcode and rebuilt several times. I only have iOS 4.x docset…. maybe its making the docset in a different location or something like that? can it be added manually?

  • got it to work finally… apparently it wasnt creating a ‘/doxygen_output’ folder inside the build folder for some reason (permission). I had to change the OUTPUT_DIRECTORY in the doxygen script to another location and build.. then i moved the doxygen_output folder back to the location it should be in (build folder) and built again to generate the docset

  • works with the latest version of graphviz and doxygen. Just install mscgen from mac ports, edit the doxygen.config file in the main cocos2d project directory to point the mscgen path and dot path to the respective directories. on my machine it was /opt/local/bin for mscgen and /usr/local/bin for dot.

  • @KDaker

    I have the same problem as you, it can’t create teh doxygen_output directory. If I edit doxygen.cofig and change OUTPUT_DIRECTORY = /tmp I still have the same error. How did you successfully change the script?

  • @helena

    I found an easier workaround for the same doxygen_output directory problem. Using doxygen 1.5.8, all I did was rename the folder that contained all your cocos2d download and put it in my root level user directory.

    Basically, renamed “cocos2d iphone 1.0.0 beta” folder to “cocos2d” and put it in /Users/(yourusername)/

    Worked flawlessly, after more than half an hour of fighting with the doxygen.config file. I suspect a sufficiently long path may confuse make (which gets run by the script). Unfriendly characters in the path name could also throw it off.

    Hope this helps (if you still haven’t found a solution). Cheers

  • Does this same process work for xcode 4? thanks!

  • @Mar, the working solution for Xcode 4 was using doxygen 1.5.8 as described @Jose

  • I installed the doxygen 1.5.8 becuase 1.7.4 didnt make the doxygen.app folder
    but after I build the project I didnt sucsses to find the docuements in help
    and I have the error of build:

    2011-08-15 19:15:19.321 osascript[377:903] Error loading /Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: dlopen(/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types, 262): no suitable image found. Did find: /Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: no matching architecture in universal wrapper
    osascript: OpenScripting.framework – scripting addition “/Library/ScriptingAdditions/Adobe Unit Types.osax” declares no loadable handlers.

    anyone can help me?

  • Is the build step take a long time? I waited for dozens of minutes, but it didn’t finish and the Xcode had no responding.

  • The current distributed build of Doxygen.app does not include mcsgen or dot. Install mcsgen and graphviz (for dot) using brew (or macports?) and then edit the doxygen.config file and change the locations. Also, you can change the $DOXYGEN_PATH argument if you want to install Doxygen.app somewhere other than /Applications.

  • For me, the Applescript file was not created properly. All it says is “tell application Xcode\ end tell”.

  • I fixed the AppleScript (maybe I broke the build script but I fixed it). But Xcode 4.2 refuses to open the documentation.

  • After a restart, Xcode now opens the documentation fine.

  • Is it just me or does it seem like oxygen is a poor solution for documentation with Xcode?

    Any chance of getting a native Xcode 4 formatted doc set? Best would be a one that you could simply punch a URL into the documentation manager in Xcode and use it that way.

  • Thanks to everyone for the advices on getting the doxygen documentation integrated with Xcode. After I got the documentation installed, I realized how far it is from an ideal solution. For starters it doesn’t appear to be integrated with Xcode’s quick help, which is a shame because that’s what I use the most. I hope a more native solution (Xcode’s formatted doc set) is implemented soon!

    Cheers,

    -spacey

  • Dash (free on the App Store) includes a Cocos2D docset, fwiw

  • Use appledoc. Works much better, looks much sweeter )

  • After two hours, I finally managed to integrate cocos2d doc in Xcode.

    I used doxygen 1.5.8 as @Jose said. My version of Xcode is 4.3.3. I installed both cocos2d 1.x and cocos2d 2.x, and I did the operation of adding the doc twice, but at the end only one appear.

    The Quick Help works well (when alt+clic, I can go directly to the corresponding doc), apart from sometimes (e.g. CCLayer goes to CCNode)

  • copy the build shell to build.sh, and executed, then sucessed, but all digram didn’t gen

  • This how-to needs to be updated for cocos2d 2.x and Xcode 4.6.

  • I’m running cocos2d 2.1-rc0a and Xcode 4.6. After failing to build the docset with the latest version of Doxygen, v1.8.3.1, I was able to successfully build the docset by simply installing the older Doxygen v1.5.8 from ftp://ftp.stack.nl/pub/users/dimitri/

  • I managed to install documentation with latest Doxygen from Homebrew repo.

    $ brew install doxygen –with-dot
    $ brew install mscgen
    $ brew install graphvis

    Then in doxygen.config I edited paths from /Applications/Doxygen.app/….. to /usr/local/bin/ (the path Homebrew links installed apps).

    Then I built documentation and got only 5 warnings. Now I have cocos2d 2.1.0-rc1 documentation in Xcode 4.6.2 and OSX 10.8.3.

Leave a Reply




Social Widgets powered by AB-WebLog.com.