2014-10-09 12:04:00 +02:00
|
|
|
#-----------------------
|
2010-05-11 19:44:00 +02:00
|
|
|
# CMake file for OpenCV docs
|
2014-10-09 12:04:00 +02:00
|
|
|
#-----------------------
|
2010-05-11 19:44:00 +02:00
|
|
|
|
2014-12-24 16:41:01 +01:00
|
|
|
set(HAVE_DOC_GENERATOR BUILD_DOCS AND DOXYGEN_FOUND)
|
2010-05-11 19:44:00 +02:00
|
|
|
|
2014-10-09 12:04:00 +02:00
|
|
|
if(HAVE_DOC_GENERATOR)
|
2012-03-03 16:49:23 +01:00
|
|
|
project(opencv_docs)
|
2012-05-30 16:06:47 +02:00
|
|
|
# build lists of modules to be documented
|
2013-11-12 16:38:59 +01:00
|
|
|
set(BASE_MODULES "")
|
|
|
|
set(EXTRA_MODULES "")
|
2012-05-30 16:06:47 +02:00
|
|
|
|
|
|
|
foreach(mod ${OPENCV_MODULES_BUILD} ${OPENCV_MODULES_DISABLED_USER} ${OPENCV_MODULES_DISABLED_AUTO} ${OPENCV_MODULES_DISABLED_FORCE})
|
|
|
|
string(REGEX REPLACE "^opencv_" "" mod "${mod}")
|
|
|
|
if("${OPENCV_MODULE_opencv_${mod}_LOCATION}" STREQUAL "${OpenCV_SOURCE_DIR}/modules/${mod}")
|
2013-11-12 16:38:59 +01:00
|
|
|
list(APPEND BASE_MODULES ${mod})
|
2012-05-30 16:06:47 +02:00
|
|
|
else()
|
2013-11-12 16:38:59 +01:00
|
|
|
list(APPEND EXTRA_MODULES ${mod})
|
2012-05-30 16:06:47 +02:00
|
|
|
endif()
|
|
|
|
endforeach()
|
2014-10-09 12:04:00 +02:00
|
|
|
ocv_list_sort(BASE_MODULES)
|
|
|
|
ocv_list_sort(EXTRA_MODULES)
|
2014-08-11 21:26:39 +02:00
|
|
|
set(FIXED_ORDER_MODULES core imgproc imgcodecs videoio highgui video calib3d features2d objdetect ml flann photo stitching)
|
2013-11-12 16:38:59 +01:00
|
|
|
list(REMOVE_ITEM BASE_MODULES ${FIXED_ORDER_MODULES})
|
2014-10-09 12:04:00 +02:00
|
|
|
set(BASE_MODULES ${FIXED_ORDER_MODULES} ${BASE_MODULES})
|
2013-11-12 16:38:59 +01:00
|
|
|
|
2014-10-09 12:04:00 +02:00
|
|
|
set(DOC_LIST
|
|
|
|
"${OpenCV_SOURCE_DIR}/doc/opencv-logo.png"
|
|
|
|
"${OpenCV_SOURCE_DIR}/doc/opencv-logo2.png"
|
|
|
|
"${OpenCV_SOURCE_DIR}/doc/opencv-logo-white.png"
|
|
|
|
"${OpenCV_SOURCE_DIR}/doc/opencv.ico"
|
|
|
|
"${OpenCV_SOURCE_DIR}/doc/pattern.png"
|
|
|
|
"${OpenCV_SOURCE_DIR}/doc/acircles_pattern.png")
|
|
|
|
set(OPTIONAL_DOC_LIST "")
|
|
|
|
endif(HAVE_DOC_GENERATOR)
|
2013-11-12 16:38:59 +01:00
|
|
|
|
2014-10-09 12:04:00 +02:00
|
|
|
# ========= Doxygen docs =========
|
2014-11-21 09:28:14 +01:00
|
|
|
|
2014-12-24 16:41:01 +01:00
|
|
|
if(BUILD_DOCS AND DOXYGEN_FOUND)
|
2014-11-21 09:28:14 +01:00
|
|
|
# not documented modules list
|
2015-01-19 16:03:29 +01:00
|
|
|
list(APPEND blacklist "ts" "java" "python2" "python3" "world" "contrib_world")
|
2014-10-31 16:09:19 +01:00
|
|
|
|
2014-10-09 12:04:00 +02:00
|
|
|
# gathering headers
|
2014-11-21 09:28:14 +01:00
|
|
|
set(paths_include)
|
|
|
|
set(paths_doc)
|
|
|
|
set(paths_bib)
|
2014-12-01 17:22:04 +01:00
|
|
|
set(paths_sample)
|
|
|
|
set(paths_tutorial)
|
|
|
|
set(refs_main)
|
|
|
|
set(refs_extra)
|
2014-11-26 12:21:08 +01:00
|
|
|
set(deps)
|
2014-11-21 09:28:14 +01:00
|
|
|
foreach(m ${BASE_MODULES} ${EXTRA_MODULES})
|
|
|
|
list(FIND blacklist ${m} _pos)
|
|
|
|
if(${_pos} EQUAL -1)
|
2014-11-26 12:21:08 +01:00
|
|
|
# include folder
|
2014-11-21 09:28:14 +01:00
|
|
|
set(header_dir "${OPENCV_MODULE_opencv_${m}_LOCATION}/include")
|
|
|
|
if(EXISTS "${header_dir}")
|
|
|
|
list(APPEND paths_include "${header_dir}")
|
2014-11-26 12:21:08 +01:00
|
|
|
list(APPEND deps ${header_dir})
|
2014-11-21 09:28:14 +01:00
|
|
|
endif()
|
2014-11-26 12:21:08 +01:00
|
|
|
# doc folder
|
2014-11-21 09:28:14 +01:00
|
|
|
set(docs_dir "${OPENCV_MODULE_opencv_${m}_LOCATION}/doc")
|
|
|
|
if(EXISTS "${docs_dir}")
|
|
|
|
list(APPEND paths_doc "${docs_dir}")
|
2014-11-26 12:21:08 +01:00
|
|
|
list(APPEND deps ${docs_dir})
|
|
|
|
endif()
|
2014-12-01 17:22:04 +01:00
|
|
|
# sample folder
|
|
|
|
set(sample_dir "${OPENCV_MODULE_opencv_${m}_LOCATION}/samples")
|
|
|
|
if(EXISTS "${sample_dir}")
|
|
|
|
list(APPEND paths_sample "${sample_dir}")
|
|
|
|
list(APPEND deps ${sample_dir})
|
|
|
|
endif()
|
|
|
|
# tutorial folder
|
|
|
|
set(tutorial_dir "${OPENCV_MODULE_opencv_${m}_LOCATION}/tutorials")
|
|
|
|
if(EXISTS "${tutorial_dir}")
|
|
|
|
list(APPEND paths_tutorial "${tutorial_dir}")
|
|
|
|
list(APPEND deps ${tutorial_dir})
|
|
|
|
endif()
|
2014-11-26 12:21:08 +01:00
|
|
|
# BiBTeX file
|
|
|
|
set(bib_file "${docs_dir}/${m}.bib")
|
|
|
|
if(EXISTS "${bib_file}")
|
|
|
|
set(paths_bib "${paths_bib} ${bib_file}")
|
|
|
|
list(APPEND deps ${bib_file})
|
2014-11-21 09:28:14 +01:00
|
|
|
endif()
|
2014-12-01 17:22:04 +01:00
|
|
|
# Reference entry
|
|
|
|
# set(one_ref "@ref ${m} | ${m}\n")
|
|
|
|
set(one_ref "\t- ${m}. @ref ${m}\n")
|
|
|
|
list(FIND EXTRA_MODULES ${m} _pos)
|
|
|
|
if(${_pos} EQUAL -1)
|
|
|
|
set(refs_main "${refs_main}${one_ref}")
|
|
|
|
else()
|
|
|
|
set(refs_extra "${refs_extra}${one_ref}")
|
|
|
|
endif()
|
2014-10-09 12:04:00 +02:00
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
2014-12-01 17:22:04 +01:00
|
|
|
# fix references
|
|
|
|
# set(ref_header "Module name | Folder\n----------- | ------")
|
|
|
|
# if(refs_main)
|
|
|
|
# set(refs_main "### Main modules\n${ref_header}\n${refs_main}")
|
|
|
|
# endif()
|
|
|
|
# if(refs_extra)
|
|
|
|
# set(refs_extra "### Extra modules\n${ref_header}\n${refs_extra}")
|
|
|
|
# endif()
|
|
|
|
if(refs_main)
|
|
|
|
set(refs_main "- Main modules:\n${refs_main}")
|
|
|
|
endif()
|
|
|
|
if(refs_extra)
|
|
|
|
set(refs_extra "- Extra modules:\n${refs_extra}")
|
|
|
|
endif()
|
2014-11-21 09:28:14 +01:00
|
|
|
|
2014-10-09 12:04:00 +02:00
|
|
|
# additional config
|
2014-10-31 16:09:19 +01:00
|
|
|
set(doxyfile "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile")
|
|
|
|
set(rootfile "${CMAKE_CURRENT_BINARY_DIR}/root.markdown")
|
2014-11-21 09:28:14 +01:00
|
|
|
set(bibfile "${CMAKE_CURRENT_SOURCE_DIR}/opencv.bib")
|
2014-12-01 17:22:04 +01:00
|
|
|
set(faqfile "${CMAKE_CURRENT_SOURCE_DIR}/faq.markdown")
|
2014-11-27 11:23:24 +01:00
|
|
|
set(tutorial_path "${CMAKE_CURRENT_SOURCE_DIR}/tutorials")
|
2014-11-28 15:18:32 +01:00
|
|
|
set(tutorial_py_path "${CMAKE_CURRENT_SOURCE_DIR}/py_tutorials")
|
2014-12-01 14:40:06 +01:00
|
|
|
set(user_guide_path "${CMAKE_CURRENT_SOURCE_DIR}/user_guide")
|
2014-12-01 17:22:04 +01:00
|
|
|
set(example_path "${CMAKE_SOURCE_DIR}/samples")
|
|
|
|
|
|
|
|
# set export variables
|
|
|
|
string(REPLACE ";" " \\\n" CMAKE_DOXYGEN_INPUT_LIST "${rootfile} ; ${faqfile} ; ${paths_include} ; ${paths_doc} ; ${tutorial_path} ; ${tutorial_py_path} ; ${user_guide_path} ; ${paths_tutorial}")
|
|
|
|
string(REPLACE ";" " \\\n" CMAKE_DOXYGEN_IMAGE_PATH "${paths_doc} ; ${tutorial_path} ; ${tutorial_py_path} ; ${user_guide_path} ; ${paths_tutorial}")
|
|
|
|
# TODO: remove paths_doc from EXAMPLE_PATH after face module tutorials/samples moved to separate folders
|
|
|
|
string(REPLACE ";" " \\\n" CMAKE_DOXYGEN_EXAMPLE_PATH "${example_path} ; ${paths_doc} ; ${paths_sample}")
|
2014-10-09 12:04:00 +02:00
|
|
|
set(CMAKE_DOXYGEN_LAYOUT "${CMAKE_CURRENT_SOURCE_DIR}/DoxygenLayout.xml")
|
|
|
|
set(CMAKE_DOXYGEN_OUTPUT_PATH "doxygen")
|
2014-12-01 17:22:04 +01:00
|
|
|
set(CMAKE_DOXYGEN_MAIN_REFERENCE "${refs_main}")
|
|
|
|
set(CMAKE_DOXYGEN_EXTRA_REFERENCE "${refs_extra}")
|
2014-11-21 09:28:14 +01:00
|
|
|
set(CMAKE_EXTRA_BIB_FILES "${bibfile} ${paths_bib}")
|
2014-12-26 16:39:40 +01:00
|
|
|
if (CMAKE_DOXYGEN_GENERATE_QHP)
|
|
|
|
set(CMAKE_DOXYGEN_GENERATE_QHP "YES")
|
|
|
|
else()
|
|
|
|
set(CMAKE_DOXYGEN_GENERATE_QHP "NO")
|
|
|
|
endif()
|
2014-12-26 15:30:33 +01:00
|
|
|
|
|
|
|
list(APPEND CMAKE_DOXYGEN_HTML_FILES "${CMAKE_CURRENT_SOURCE_DIR}/opencv.ico")
|
|
|
|
list(APPEND CMAKE_DOXYGEN_HTML_FILES "${CMAKE_CURRENT_SOURCE_DIR}/pattern.png")
|
|
|
|
list(APPEND CMAKE_DOXYGEN_HTML_FILES "${CMAKE_CURRENT_SOURCE_DIR}/acircles_pattern.png")
|
|
|
|
list(APPEND CMAKE_DOXYGEN_HTML_FILES "${CMAKE_CURRENT_SOURCE_DIR}/bodybg.png")
|
|
|
|
list(APPEND CMAKE_DOXYGEN_HTML_FILES "${CMAKE_CURRENT_SOURCE_DIR}/mymath.sty")
|
|
|
|
string(REPLACE ";" " \\\n" CMAKE_DOXYGEN_HTML_FILES "${CMAKE_DOXYGEN_HTML_FILES}")
|
|
|
|
|
2014-12-26 09:57:41 +01:00
|
|
|
if(PLANTUML_JAR)
|
|
|
|
set(CMAKE_DOXYGEN_PLANTUML_SUPPORT "PLANTUML_JAR_PATH = ${PLANTUML_JAR}\n")
|
|
|
|
else()
|
|
|
|
set(CMAKE_DOXYGEN_PLANTUML_SUPPORT "ALIASES += startuml{1}=\"@warning __No plantuml!__ \\n \\n @if DUMMY_PLANTUML_CODE\" enduml=\"@endif\"\n")
|
|
|
|
endif()
|
2014-11-21 09:28:14 +01:00
|
|
|
|
2014-10-09 12:04:00 +02:00
|
|
|
# writing file
|
|
|
|
configure_file(Doxyfile.in ${doxyfile} @ONLY)
|
2014-10-31 16:09:19 +01:00
|
|
|
configure_file(root.markdown.in ${rootfile} @ONLY)
|
2014-10-09 12:04:00 +02:00
|
|
|
|
|
|
|
add_custom_target(doxygen
|
2014-12-24 16:41:01 +01:00
|
|
|
COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile}
|
2014-11-27 11:23:24 +01:00
|
|
|
DEPENDS ${doxyfile} ${rootfile} ${bibfile} ${deps}
|
|
|
|
)
|
2014-10-09 12:04:00 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(HAVE_DOC_GENERATOR)
|
|
|
|
# installation
|
2012-12-08 14:07:55 +01:00
|
|
|
foreach(f ${DOC_LIST})
|
2014-01-17 13:30:31 +01:00
|
|
|
install(FILES "${f}" DESTINATION "${OPENCV_DOC_INSTALL_PATH}" COMPONENT docs)
|
2012-12-08 14:07:55 +01:00
|
|
|
endforeach()
|
|
|
|
foreach(f ${OPTIONAL_DOC_LIST})
|
2014-01-17 13:30:31 +01:00
|
|
|
install(FILES "${f}" DESTINATION "${OPENCV_DOC_INSTALL_PATH}" OPTIONAL COMPONENT docs)
|
2012-12-08 14:07:55 +01:00
|
|
|
endforeach()
|
2014-12-30 10:11:37 +01:00
|
|
|
|
|
|
|
# dummy targets
|
|
|
|
add_custom_target(docs)
|
|
|
|
add_custom_target(html_docs)
|
2014-10-09 12:04:00 +02:00
|
|
|
endif(HAVE_DOC_GENERATOR)
|