2012年7月28日土曜日

[doxygen] 入門



色々調べた結果採用する方向です

まず、なんとかFORTRANのコードで基本的なhtml出力は得られたのでメモ。

[1] Installation
sudo apt-get install doxygen
 でOK

[2] Minimum use

fortranのコードがある場所で
doxygen -g hoge.conf
これで、標準的な出力設定ファイルが生成される。名前は、任意でOK.
次に、自分用にカスタマイズする。以下にオリジナルとカスタマイズ後のファイルの差分を示す。
ポイントは、「OPTIMIZEU_FOR_FORTRAN」や「EXTRACT_ALL」をYESにして、
「FILE_PATTERNS」に「*.f」を設定している点です。また、コードを表示するために「SOURCE_BROWSER」と「INLINE_SOURCES」をYESにします。

また、ソースに書式通りにコメントを書き込みます。下記に例を示す。
そして、
doxygen hoge.conf
とすると./html/index.htmlが出力されます。
今回の投稿は、最小限の使用ですので今後は下記についてが課題になると思います。

■出力ディレクトリ等の設定
■latex経由のPDF出力

---- 設定ファイルの差分---
*** org.conf 2012-07-28 13:39:06.803258079 +0900
--- common.conf 2012-07-28 13:36:44.702147423 +0900
***************
*** 25,31 ****
  # The PROJECT_NAME tag is a single word (or a sequence of words surrounded
  # by quotes) that should identify the project.
  
! PROJECT_NAME           =
  
  # The PROJECT_NUMBER tag can be used to enter a project or revision number.
  # This could be handy for archiving the generated documentation or
--- 25,31 ----
  # The PROJECT_NAME tag is a single word (or a sequence of words surrounded
  # by quotes) that should identify the project.
  
! PROJECT_NAME           = "First use of doxygen"
  
  # The PROJECT_NUMBER tag can be used to enter a project or revision number.
  # This could be handy for archiving the generated documentation or
***************
*** 199,205 ****
  # sources only. Doxygen will then generate output that is more tailored for
  # Fortran.
  
! OPTIMIZE_FOR_FORTRAN   = NO
  
  # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
  # sources. Doxygen will then generate output that is tailored for
--- 199,205 ----
  # sources only. Doxygen will then generate output that is more tailored for
  # Fortran.
  
! OPTIMIZE_FOR_FORTRAN   = YES
  
  # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
  # sources. Doxygen will then generate output that is tailored for
***************
*** 297,313 ****
  # Private class members and static file members will be hidden unless
  # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
  
! EXTRACT_ALL            = NO
  
  # If the EXTRACT_PRIVATE tag is set to YES all private members of a class
  # will be included in the documentation.
  
! EXTRACT_PRIVATE        = NO
  
  # If the EXTRACT_STATIC tag is set to YES all static members of a file
  # will be included in the documentation.
  
! EXTRACT_STATIC         = NO
  
  # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
  # defined locally in source files will be included in the documentation.
--- 297,313 ----
  # Private class members and static file members will be hidden unless
  # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
  
! EXTRACT_ALL            = YES
  
  # If the EXTRACT_PRIVATE tag is set to YES all private members of a class
  # will be included in the documentation.
  
! EXTRACT_PRIVATE        = YES
  
  # If the EXTRACT_STATIC tag is set to YES all static members of a file
  # will be included in the documentation.
  
! EXTRACT_STATIC         = YES
  
  # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
  # defined locally in source files will be included in the documentation.
***************
*** 591,597 ****
  # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
  # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
  
! FILE_PATTERNS          =
  
  # The RECURSIVE tag can be used to turn specify whether or not subdirectories
  # should be searched for input files as well. Possible values are YES and NO.
--- 591,597 ----
  # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
  # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
  
! FILE_PATTERNS          = *.f
  
  # The RECURSIVE tag can be used to turn specify whether or not subdirectories
  # should be searched for input files as well. Possible values are YES and NO.
***************
*** 690,701 ****
  # Note: To get rid of all source code in the generated output, make sure also
  # VERBATIM_HEADERS is set to NO.
  
! SOURCE_BROWSER         = NO
  
  # Setting the INLINE_SOURCES tag to YES will include the body
  # of functions and classes directly in the documentation.
  
! INLINE_SOURCES         = NO
  
  # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
  # doxygen to hide any special comment blocks from generated source code
--- 690,701 ----
  # Note: To get rid of all source code in the generated output, make sure also
  # VERBATIM_HEADERS is set to NO.
  
! SOURCE_BROWSER         = YES
  
  # Setting the INLINE_SOURCES tag to YES will include the body
  # of functions and classes directly in the documentation.
  
! INLINE_SOURCES         = YES
  
  # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
  # doxygen to hide any special comment blocks from generated source code
***************
*** 1389,1395 ****
  # toolkit from AT&T and Lucent Bell Labs. The other options in this section
  # have no effect if this option is set to NO (the default)
  
! HAVE_DOT               = NO
  
  # By default doxygen will write a font called FreeSans.ttf to the output
  # directory and reference it in all dot files that doxygen generates. This
--- 1389,1395 ----
  # toolkit from AT&T and Lucent Bell Labs. The other options in this section
  # have no effect if this option is set to NO (the default)
  
! HAVE_DOT               = YES
  
  # By default doxygen will write a font called FreeSans.ttf to the output
  # directory and reference it in all dot files that doxygen generates. This
***************
*** 1464,1470 ****
  # the time of a run. So in most cases it will be better to enable call graphs
  # for selected functions only using the \callgraph command.
  
! CALL_GRAPH             = NO
  
  # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
  # doxygen will generate a caller dependency graph for every global function
--- 1464,1470 ----
  # the time of a run. So in most cases it will be better to enable call graphs
  # for selected functions only using the \callgraph command.
  
! CALL_GRAPH             = YES
  
  # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
  # doxygen will generate a caller dependency graph for every global function
***************
*** 1472,1478 ****
  # the time of a run. So in most cases it will be better to enable caller
  # graphs for selected functions only using the \callergraph command.
  
! CALLER_GRAPH           = NO
  
  # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
  # will graphical hierarchy of all classes instead of a textual one.
--- 1472,1478 ----
  # the time of a run. So in most cases it will be better to enable caller
  # graphs for selected functions only using the \callergraph command.
  
! CALLER_GRAPH           = YES
  
  # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
  # will graphical hierarchy of all classes instead of a textual one.
ソースコメント記入例
      
   !-----------------------------------------------------------
      ! MODULE: test program
      !> @author
      !> Author name
      !
      ! DESCRIPTION:
      !> test program for using doxigen 
      ! REVISION HISTORY:
      ! 16 Apr 2012 - Initial Version
      ! TODO_28_jul_2012 - add explain of subroutine add - todo1
      !-----------------------------------------------------------
      program test
      integer a,b
      a=1
      b=2
      write(*,*) a
      call add(a)
      write(*,*) a
      call add(b)
      end
      !> Subroutine add
      !> @param[in] sa you want to add 1
      !> @brief 
      ! add 1 to argument
      subroutine add(sa)
      integer sa
      sa = sa + 1
      end

0 件のコメント:

コメントを投稿