2 # CMake file for OpenCV docs
5 file(GLOB FILES_DOC *.htm *.txt *.jpg *.png *.pdf)
6 file(GLOB FILES_DOC_PAPERS papers/*.pdf papers/*.ps)
7 file(GLOB FILES_DOC_VS vidsurv/*.doc)
8 file(GLOB FILES_TEX *.tex *.sty *.bib go)
9 file(GLOB FILES_TEX_PICS pics/*.png pics/*.jpg)
10 file(GLOB_RECURSE FILES_PLASTEX plastex/*)
12 if(BUILD_LATEX_DOCS AND PDFLATEX_COMPILER)
14 project(opencv_refman)
16 set(refman_copied_srcs)
18 #foreach(f ${refman_m4_srcs})
19 # get_filename_component(basef ${f} NAME_WE)
20 # set(outputf ${CMAKE_CURRENT_BINARY_DIR}/${basef}-c.tex)
25 # ARGS -DTARGET_LANGUAGE=c ${f} > ${outputf}
26 # WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
29 # list(APPEND refman_copied_srcs ${outputf})
32 foreach(f ${FILES_TEX})
33 get_filename_component(basef ${f} NAME)
34 set(outputf ${CMAKE_CURRENT_BINARY_DIR}/${basef})
38 COMMAND ${CMAKE_COMMAND}
39 ARGS -E copy ${f} ${outputf}
40 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
41 list(APPEND refman_copied_srcs ${outputf})
44 set(pdflatex_args -interaction=batchmode
45 "\"\\newcommand{\\genc}{true}\\newcommand{\\genpy}{true}\\newcommand{\\targetlang}{c}\\input{opencv.tex}\"")
48 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opencv.aux
49 DEPENDS ${refman_copied_srcs}
50 COMMAND ${PDFLATEX_COMPILER}
52 COMMENT "Latex (first pass)"
53 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
57 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opencv.bbl
58 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/opencv.aux
59 COMMAND ${BIBTEX_COMPILER}
60 ARGS ${CMAKE_CURRENT_BINARY_DIR}/opencv
62 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
66 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opencv.pdf
67 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/opencv.bbl
68 COMMAND ${PDFLATEX_COMPILER}
70 COMMENT "Latex (second pass)"
71 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
75 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opencv.log
76 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/opencv.bbl
77 ${CMAKE_CURRENT_BINARY_DIR}/opencv.pdf
78 COMMAND ${PDFLATEX_COMPILER}
80 COMMENT "Latex (third pass)"
81 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
84 set(PICS_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/pics")
85 message(STATUS "Copying pictures to the build directory")
86 make_directory(${PICS_OUT_DIR})
88 file(GLOB pics RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/pics" pics/*.jpg pics/*.png)
93 "${PICS_OUT_DIR}/${p}"
97 set(PYTHON_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/python_fragments")
98 message(STATUS "Copying python_fragments to the build directory")
99 make_directory(${PYTHON_OUT_DIR})
101 file(GLOB python_fragments RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/python_fragments" python_fragments/*.py)
103 foreach(p ${python_fragments})
105 "python_fragments/${p}"
106 "${PYTHON_OUT_DIR}/${p}"
110 #add_custom_target(MakePicsLink
111 # COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/pics ${CMAKE_CURRENT_BINARY_DIR}/pics
114 # Eventually trigger the whole process
115 add_custom_target(ReferenceManual ALL echo
116 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/opencv.log
119 #add_dependencies(ReferenceManual MakePicsLink)
121 install(FILES "${CMAKE_CURRENT_BINARY_DIR}/opencv.pdf"
122 DESTINATION "${OPENCV_DOC_INSTALL_PATH}" COMPONENT main)
124 endif() # BUILD_LATEX_DOCS AND PDFLATEX_COMPILER
126 install(FILES ${FILES_DOC} DESTINATION "${OPENCV_DOC_INSTALL_PATH}" COMPONENT main)
127 install(FILES ${FILES_DOC_PAPERS} DESTINATION "${OPENCV_DOC_INSTALL_PATH}/papers" COMPONENT main)
128 install(FILES ${FILES_DOC_VS} DESTINATION "${OPENCV_DOC_INSTALL_PATH}/vidsurv" COMPONENT main)
130 ########################################### Doxygen Docs #########################################
132 if(BUILD_DOXYGEN_DOCS AND DOXYGEN_FOUND)
134 set(DOXYGEN_LANGUAGE "English" CACHE STRING "Language used by doxygen")
135 mark_as_advanced(DOXYGEN_LANGUAGE)
137 set(CMAKE_DOXYGEN_IMAGE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pics")
139 set(module_names core imgproc calib3d features2d objdetect video highgui ml legacy contrib)
140 set(DOXYGEN_SOURCE_DIR)
141 set(doxy_html_dep_list)
143 foreach(m ${module_names})
144 set(module_hdr_path "${CMAKE_SOURCE_DIR}/modules/${m}/include/opencv2/${m}")
145 set(DOXYGEN_SOURCE_DIR ${DOXYGEN_SOURCE_DIR} ${module_hdr_path})
146 file(GLOB module_hdrs "${module_hdr_path}/*.h*")
147 set(doxy_html_dep_list ${doxy_html_dep_list} ${module_hdrs})
150 set(DOXYGEN_OUTPUT_DIR html)
151 string(REGEX REPLACE ";" " " CMAKE_DOXYGEN_INPUT_LIST "${DOXYGEN_SOURCE_DIR}")
153 configure_file(Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
154 set(HTML_TARGET "DOXY_HTML" )
156 add_custom_target(${HTML_TARGET} ALL
157 ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
158 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile ${doxy_html_dep_list})
159 exec_program(mkdir ARGS "-p \"${CMAKE_CURRENT_BINARY_DIR}/html/\"")
160 install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html" DESTINATION "${OPENCV_DOC_INSTALL_PATH}/html" COMPONENT main)