[2656] | 1 | # Add a "doc" target with CMake build system. |
---|
| 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 |
---|
| 5 | # Creates .chm windows help file if MS HTML help workshop |
---|
| 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 | # |
---|
| 14 | # Note about Visual Studio Projects: |
---|
| 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] | 22 | FIND_PACKAGE(Doxygen QUIET) |
---|
[2633] | 23 | |
---|
| 24 | IF (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}) |
---|
[2633] | 34 | |
---|
| 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) |
---|
[2633] | 47 | |
---|
[2656] | 48 | IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in) |
---|
| 49 | CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in ${CMAKE_CURRENT_BINARY_DIR}/doxy.config @ONLY) |
---|
[2633] | 50 | # use (configured) doxy.config from (out of place) BUILD tree: |
---|
[2656] | 51 | SET(DOXY_CONFIG ${CMAKE_CURRENT_BINARY_DIR}/doxy.config) |
---|
[3196] | 52 | SET(DOXY_LOGFILE ${CMAKE_CURRENT_BINARY_DIR}/doxy.log) |
---|
[2637] | 53 | ELSE() |
---|
[3196] | 54 | MESSAGE(FATAL_ERROR "Warning: Could not find dox.config.in in the root directory.") |
---|
[2637] | 55 | ENDIF() |
---|
[2633] | 56 | |
---|
| 57 | ADD_CUSTOM_TARGET(doc ${DOXYGEN_EXECUTABLE} ${DOXY_CONFIG}) |
---|
| 58 | |
---|
| 59 | # create a windows help .chm file using hhc.exe |
---|
| 60 | # HTMLHelp DLL must be in path! |
---|
| 61 | # fallback: use hhw.exe interactively |
---|
[2637] | 62 | IF(WIN32) |
---|
[2633] | 63 | FIND_PACKAGE(HTMLHelp) |
---|
[2637] | 64 | IF(HTML_HELP_COMPILER) |
---|
[2656] | 65 | SET(TMP ${DOXY_OUTPUT_DIR}/html/index.hhp) |
---|
[2637] | 66 | STRING(REGEX REPLACE "/" "\\\\" HHP_FILE ${TMP}) |
---|
[3196] | 67 | ADD_CUSTOM_TARGET(doc_chm ${HTML_HELP_COMPILER} ${HHP_FILE}) |
---|
| 68 | ADD_DEPENDENCIES(doc_chm doc) |
---|
[2670] | 69 | # Adding a dependency somehow adds doc target as default build target |
---|
[3196] | 70 | SET_TARGET_PROPERTIES(doc doc_chm PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE) |
---|
[2633] | 71 | ENDIF(HTML_HELP_COMPILER) |
---|
| 72 | ENDIF (WIN32) |
---|
[2657] | 73 | |
---|
| 74 | |
---|
| 75 | # Installation |
---|
| 76 | INSTALL( |
---|
| 77 | FILES ${DOXY_CONFIG} ${CMAKE_CURRENT_BINARY_DIR}/doxy.log |
---|
| 78 | DESTINATION ${ORXONOX_DOC_INSTALL_PATH}/api |
---|
| 79 | OPTIONAL |
---|
| 80 | ) |
---|
[3196] | 81 | # Install command always needs the directory |
---|
[2670] | 82 | IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/html) |
---|
| 83 | FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html) |
---|
[2659] | 84 | ENDIF() |
---|
[2670] | 85 | INSTALL( |
---|
| 86 | DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html |
---|
| 87 | DESTINATION ${ORXONOX_DOC_INSTALL_PATH}/api |
---|
| 88 | ) |
---|
[2633] | 89 | ENDIF(DOXYGEN_FOUND) |
---|