版權聲明

所有的部落格文章都可以在右邊[blog文章原始檔案]下載最原始的文字檔案,並依你高興使用 docutil 工具轉換成任何對應的格式方便離線閱覽,除了集結成書販賣歡迎任意取用,引用

Doxygen in XCode 2

Doxygen in XCode 2

Doxygen in xcode 1 <---- 第一集的連結。

第二集是因為 XCode 3.0 可以將你自己的說明文件整合進 xcode 的doc set中,所以 Apple 就寫了一個如何整合的說明文件:

http://developer.apple.com/tools/creatingdocsetswithdoxygen.html

簡單來說和第一集只有幾個不同點:

Doxygen setting 部分:

  • 需要在設定的部分 HTML tag 頁面中勾選 GENERATE_HTML 和 GENERATE_DOCSET 並設定 GENERATE_DOCSET 下面兩個相關欄位。 DOCSET_FEEDNAME 和 DOCSET_BUNDLE_ID 如果你不知道這兩個是幹麼的,就把FEEDNAME想像成視窗標題, BUNDLE_ID 想像成網址即可。

Xcode 部分:

  • Build phase 變得稍微複雜一點點,下面是改變後的 script:

    #  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
    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/DoxygenDocs.docset/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/\""
         >> $TEMP_DIR/loadDocSet.scpt
    echo "end tell" >> $TEMP_DIR/loadDocSet.scpt
    
    #  Run the load-docset applescript command.
    
    osascript $TEMP_DIR/loadDocSet.scpt
    
    exit 0
    
  • 在 target inspect 的 Build Tag 中增加一個變數 DOXYGEN_PATH 內容是 doxygen 所 在的絕對路徑。

如果看這篇不知道握在胡說八道什麼,建議先參考一下第一集 ( Doxygen in xcode 1 ) 和一開始提到的 Apple 官方文件,應該不用看英文光看圖就懂了~

沒有留言:

Related Posts with Thumbnails