You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. # Author Yann Renard / INRIA
  2. # Date 2008-10-15
  3. #
  4. # this CMake script iterates over several source documentation directories in
  5. # order to compile it with doxygen. It has the ability to configure the
  6. # doxyfile depending on some variables and to build documentation sources from
  7. # computer generated templates (.dox-skeleton) and hand written documentation
  8. # parts (.dox-part)
  9. ADD_CUSTOM_TARGET(${PROJECT_NAME} ALL)
  10. # look for doxygen, if not present, no need to generate documentation
  11. FIND_PROGRAM(doxygen_bin "doxygen" PATHS ${LIST_DEPENDENCIES_PATH}/bin NO_DEFAULT_PATH)
  12. FIND_PROGRAM(doxygen_bin "doxygen" PATHS ${LIST_DEPENDENCIES_PATH}/bin "C:/Program Files/doxygen/bin")
  13. IF(doxygen_bin)
  14. MESSAGE(STATUS " Found doxygen...")
  15. # intializes the variable that will be used in the doxyfile for input
  16. # directories
  17. STRING(REPLACE "\\" "/" ov_doxy_input "${OV_BASE_DIR}/cmake-modules")
  18. SET(ov_doxy_input "\\\"${ov_doxy_input}\\\"")
  19. # intializes the variable that will contain the list of resource files to
  20. # copy to the target directory
  21. SET(RESOURCE_FILES "")
  22. SET(DOX_PART_FILES "")
  23. # iterates on each project we have
  24. #
  25. # for each project, we look at its resources and store them in a list
  26. # for each project, we look at partial documentation files (.dox-part) and
  27. # parse them to get |ov[a-zA-Z0-9_]*_begin| or |ov[a-zA-Z0-9_]*_end|
  28. # tokens. This tokens will later be included in the skeleton doxumentation
  29. # files (.dox-skeleton)
  30. GET_PROPERTY(CURRENT_PROJECTS GLOBAL PROPERTY OV_PROP_CURRENT_PROJECTS)
  31. FOREACH(current_project ${CURRENT_PROJECTS})
  32. # MESSAGE(STATUS " [ OK ] Project ${current_project}")
  33. STRING(REGEX REPLACE " +$" "" current_project ${current_project})
  34. # updates the doxyfile variable for input directories
  35. IF(EXISTS "${current_project}/include")
  36. SET(current_project_include "${current_project}/include")
  37. SET(ov_doxy_input "${ov_doxy_input} \\\"${current_project_include}\\\"")
  38. ENDIF(EXISTS "${current_project}/include")
  39. IF(EXISTS "${current_project}/src")
  40. # MESSAGE(STATUS " [ OK ] Candidate src directory found ${current_project_src}")
  41. SET(current_project_src "${current_project}/src")
  42. SET(ov_doxy_input "${ov_doxy_input} \\\"${current_project_src}\\\"")
  43. ENDIF(EXISTS "${current_project}/src")
  44. IF(EXISTS "${current_project}/doc")
  45. # MESSAGE(STATUS " [ OK ] Candidate doc directory found ${current_project_doc}")
  46. SET(current_project_doc "${current_project}/doc")
  47. SET(ov_doxy_input "${ov_doxy_input} \\\"${current_project_doc}\\\"")
  48. # looks for resources and stores them in a list
  49. FILE(GLOB_RECURSE resource_files_tmp "${current_project_doc}/*.png" "${current_project_doc}/*.svg" "${current_project_doc}/*.css" "${current_project_doc}/*.php")
  50. SET(RESOURCE_FILES ${RESOURCE_FILES} ${resource_files_tmp})
  51. # looks for partial hand written documentation
  52. FILE(GLOB_RECURSE doxs "${current_project_doc}/*.dox-part")
  53. SET(DOX_PART_FILES "${DOX_PART_FILES};${doxs}")
  54. ENDIF(EXISTS "${current_project}/doc")
  55. IF(EXISTS "${current_project}/box-algorithm-doc")
  56. LIST(APPEND dir_list "." "box-algorithm-doc/dox-part")
  57. FOREACH(file_path ${dir_list})
  58. SET(current_project_doc "${current_project}/${file_path}")
  59. MESSAGE(STATUS " [ OK ] Candidate doc directory found ${current_project_doc}")
  60. SET(ov_doxy_input "${ov_doxy_input} \\\"${current_project_doc}\\\"")
  61. # looks for resources and stores them in a list
  62. FILE(GLOB_RECURSE resource_files_tmp "${current_project_doc}/*.png" "${current_project_doc}/*.svg" "${current_project_doc}/*.css" "${current_project_doc}/*.php")
  63. SET(RESOURCE_FILES ${RESOURCE_FILES} ${resource_files_tmp})
  64. # looks for partial hand written documentation
  65. FILE(GLOB_RECURSE doxs "${current_project_doc}/*.dox-part")
  66. SET(DOX_PART_FILES "${DOX_PART_FILES};${doxs}")
  67. ENDFOREACH(file_path ${dir_list})
  68. ENDIF(EXISTS "${current_project}/box-algorithm-doc")
  69. ENDFOREACH(current_project)
  70. # the final doxyfile filename is generated, platform compliantly
  71. SET(ov_doxy_final "${CMAKE_CURRENT_BINARY_DIR}/doxyfile")
  72. IF(WIN32)
  73. STRING(REPLACE "/" "\\\\" ov_doxy_final ${ov_doxy_final})
  74. ENDIF(WIN32)
  75. # these two lines configure the variables used to configure the doxyfile
  76. SET(ov_doxy_input "${ov_doxy_input} \\\"${CMAKE_CURRENT_SOURCE_DIR}\\\"")
  77. SET(ov_doxy_input "${ov_doxy_input} \\\"${CMAKE_CURRENT_BINARY_DIR}\\\"")
  78. SET(ov_doxy_strip_from_path ${ov_doxy_input})
  79. SET(ov_doxy_version ${PROJECT_VERSION})
  80. # then the doxyfile is configured
  81. GET_PROPERTY(CURRENT_PROJECTS GLOBAL PROPERTY OV_PROP_CURRENT_PROJECTS_BUILD_DIR)
  82. FOREACH(current_project ${CURRENT_PROJECTS})
  83. # MESSAGE(STATUS "DUH ${current_project}")
  84. STRING(REGEX REPLACE " +$" "" current_project ${current_project})
  85. SET(current_project_src "${current_project}/src")
  86. # updates the doxyfile variable for input directories
  87. SET(ov_plugin_inspector_load_path "${ov_plugin_inspector_load_path}:${current_project}")
  88. ENDFOREACH(current_project)
  89. # create folder to put the output from doxygen to
  90. file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../doc")
  91. file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../doc/html")
  92. file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/algorithm-doc")
  93. file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/algorithm-snapshots")
  94. file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/box-algorithm-doc")
  95. file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/box-algorithm-snapshots")
  96. # then the doxyfile is configured
  97. CONFIGURE_FILE(
  98. CreateDoxygen.cmake-skeleton
  99. CreateDoxygen.cmake
  100. @ONLY)
  101. CONFIGURE_FILE(
  102. openvibe.dox-base
  103. openvibe.dox
  104. @ONLY)
  105. IF(WIN32)
  106. ADD_CUSTOM_COMMAND(
  107. TARGET ${PROJECT_NAME}
  108. POST_BUILD
  109. COMMAND ${LIST_DEPENDENCIES_PATH}/cmake/bin/cmake.exe -P CreateDoxygen.cmake
  110. WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
  111. )
  112. ELSEIF(UNIX)
  113. ADD_CUSTOM_COMMAND(
  114. TARGET ${PROJECT_NAME}
  115. POST_BUILD
  116. COMMAND cmake -P CreateDoxygen.cmake
  117. WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
  118. )
  119. ENDIF(WIN32)
  120. INSTALL(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../doc/" DESTINATION ${DIST_DOCDIR})
  121. ELSE(doxygen_bin)
  122. MESSAGE(STATUS " FAILED to find doxygen...")
  123. ENDIF(doxygen_bin)