Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/doc/api/CMakeLists.txt @ 11275

Last change on this file since 11275 was 7401, checked in by landauf, 14 years ago

merged doc branch back to trunk

  • Property svn:eol-style set to native
File size: 4.3 KB
RevLine 
[6417]1# Add a "doc" target with CMake build system.
[2656]2# And configure doxy.config.in to doxy.config
[2633]3#
4# target "doc" allows building the documentation with doxygen/dot on WIN32 and Linux
[6417]5# Creates .chm windows help file if MS HTML help workshop
[2633]6# (available from http://msdn.microsoft.com/workshop/author/htmlhelp)
7# is installed with its DLLs in PATH.
8#
9#
10# Please note, that the tools, e.g.:
11# doxygen, dot, latex, dvips, makeindex, gswin32, etc.
12# must be in path.
13#
[6417]14# Note about Visual Studio Projects:
[2633]15# MSVS hast its own path environment which may differ from the shell.
16# See "Menu Tools/Options/Projects/VC++ Directories" in VS 7.1
17#
18# author Jan Woetzel 2004-2006
19# www.mip.informatik.uni-kiel.de/~jw
[2637]20# Adjustments for Orxonox by Reto Grieder
[2633]21
[2637]22FIND_PACKAGE(Doxygen QUIET)
[2633]23
24IF (DOXYGEN_FOUND)
25  # click+jump in Emacs and Visual Studio (for doxy.config) (jw)
[2637]26  IF(CMAKE_BUILD_TOOL MATCHES "msdev|devenv")
[2633]27    SET(DOXY_WARN_FORMAT "\"$file($line) : $text \"")
[2637]28  ELSE()
[2633]29    SET(DOXY_WARN_FORMAT "\"$file:$line: $text \"")
[2637]30  ENDIF()
[2656]31
32  SET(DOXY_INPUT_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
33  SET(DOXY_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
[6417]34
[2633]35  # we need latex for doxygen because of the formulas
[2637]36  # Orxonox doesn't
37  #FIND_PACKAGE(LATEX)
38  #IF    (NOT LATEX_COMPILER)
39  #  MESSAGE(STATUS "latex command LATEX_COMPILER not found but usually required. You will probably get warnings and user inetraction on doxy run.")
40  #ENDIF (NOT LATEX_COMPILER)
41  #IF    (NOT MAKEINDEX_COMPILER)
42  #  MESSAGE(STATUS "makeindex command MAKEINDEX_COMPILER not found but usually required.")
43  #ENDIF (NOT MAKEINDEX_COMPILER)
44  #IF    (NOT DVIPS_CONVERTER)
45  #  MESSAGE(STATUS "dvips command DVIPS_CONVERTER not found but usually required.")
46  #ENDIF (NOT DVIPS_CONVERTER)
[6417]47
[7401]48  SET(INTERNAL_DOCFILE ${CMAKE_CURRENT_BINARY_DIR}/Internal.dox)
49  IF(WIN32)
50    SET(_working_dir ${RUNTIME_LIBRARY_DIRECTORY})
51  ELSE()
52    SET(_working_dir ${CMAKE_CURRENT_BINARY_DIR})
53  ENDIF()
54  ADD_CUSTOM_COMMAND(
55    OUTPUT ${INTERNAL_DOCFILE}
56    COMMAND orxonox-main
57    ARGS --noIOConsole --generateDoc ${INTERNAL_DOCFILE}
58    WORKING_DIRECTORY ${_working_dir}
59    COMMENT "Generating additional Doxygen documentation from Orxonox executable"
60  )
61  ADD_CUSTOM_TARGET(doc_internal DEPENDS ${INTERNAL_DOCFILE})
62  IF (NOT EXISTS ${INTERNAL_DOCFILE})
63    FILE(WRITE ${INTERNAL_DOCFILE} "// empty...")
64  ENDIF()
65
66  # Take care of most of the conditional compilation problems
67  # (Doxygen requires separate input for that)
68  IF(WIN32)
69    SET(DOXY_PLATFORM_DEF "ORXONOX_PLATFORM_WINDOWS")
70  ELSEIF(APPLE)
71    SET(DOXY_PLATFORM_DEF "ORXONOX_PLATFORM_APPLE ORXONOX_PLATFORM_UNIX")
72  ELSE()
73    SET(DOXY_PLATFORM_DEF "ORXONOX_PLATFORM_LINUX ORXONOX_PLATFORM_UNIX")
74  ENDIF()
75  IF(MSVC)
76    SET(DOXY_COMPILER_DEF "ORXONOX_COMPILER_MSVC")
77  ELSE()
78    SET(DOXY_COMPILER_DEF "ORXONOX_COMPILER_GCC")
79  ENDIF()
80
[2656]81  IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in)
[2633]82    # use (configured) doxy.config from (out of place) BUILD tree:
[2656]83    SET(DOXY_CONFIG ${CMAKE_CURRENT_BINARY_DIR}/doxy.config)
[3196]84    SET(DOXY_LOGFILE ${CMAKE_CURRENT_BINARY_DIR}/doxy.log)
[7401]85    CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in ${CMAKE_CURRENT_BINARY_DIR}/doxy.config @ONLY)
[2637]86  ELSE()
[3196]87    MESSAGE(FATAL_ERROR "Warning: Could not find dox.config.in in the root directory.")
[2637]88  ENDIF()
[6417]89
[2633]90  ADD_CUSTOM_TARGET(doc ${DOXYGEN_EXECUTABLE} ${DOXY_CONFIG})
[6417]91
[2633]92  # create a windows help .chm file using hhc.exe
93  # HTMLHelp DLL must be in path!
94  # fallback: use hhw.exe interactively
[2637]95  IF(WIN32)
[2633]96    FIND_PACKAGE(HTMLHelp)
[6417]97    IF(HTML_HELP_COMPILER)
[2656]98      SET(TMP ${DOXY_OUTPUT_DIR}/html/index.hhp)
[2637]99      STRING(REGEX REPLACE "/" "\\\\" HHP_FILE ${TMP})
[3196]100      ADD_CUSTOM_TARGET(doc_chm ${HTML_HELP_COMPILER} ${HHP_FILE})
101      ADD_DEPENDENCIES(doc_chm doc)
[2670]102      # Adding a dependency somehow adds doc target as default build target
[3196]103      SET_TARGET_PROPERTIES(doc doc_chm PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE)
[2633]104    ENDIF(HTML_HELP_COMPILER)
[6417]105  ENDIF (WIN32)
[2657]106
107
108  # Installation
109  INSTALL(
110    FILES ${DOXY_CONFIG} ${CMAKE_CURRENT_BINARY_DIR}/doxy.log
[5695]111    DESTINATION ${DOC_INSTALL_DIRECTORY}/api OPTIONAL
[2657]112  )
[3196]113  # Install command always needs the directory
[2670]114  IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/html)
115    FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html)
[2659]116  ENDIF()
[2670]117  INSTALL(
118    DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
[5695]119    DESTINATION ${DOC_INSTALL_DIRECTORY}/api
[2670]120  )
[2633]121ENDIF(DOXYGEN_FOUND)
Note: See TracBrowser for help on using the repository browser.