@ -2,9 +2,6 @@
# C M a k e f i l e f o r O p e n C V d o c s
# C M a k e f i l e f o r O p e n C V d o c s
#
#
file ( GLOB FILES_TEX *.tex *.sty *.bib )
file ( GLOB FILES_TEX_PICS pics/*.png pics/*.jpg )
if ( BUILD_DOCS AND HAVE_SPHINX )
if ( BUILD_DOCS AND HAVE_SPHINX )
project ( opencv_docs )
project ( opencv_docs )
@ -23,59 +20,84 @@ if(BUILD_DOCS AND HAVE_SPHINX)
set ( OPTIONAL_DOC_LIST "" )
set ( OPTIONAL_DOC_LIST "" )
set ( OPENCV2_BASE_MODULES core imgproc highgui video calib3d features2d objdetect ml flann gpu photo stitching nonfree contrib legacy )
# b u i l d l i s t s o f m o d u l e s t o b e d o c u m e n t e d
# b u i l d l i s t s o f m o d u l e s t o b e d o c u m e n t e d
set ( OPENCV2 _MODULES "" )
set ( BASE_MODULES "" )
set ( OPENCV _MODULES "" )
set ( EXTRA _MODULES "" )
foreach ( mod ${ OPENCV_MODULES_BUILD } ${ OPENCV_MODULES_DISABLED_USER } ${ OPENCV_MODULES_DISABLED_AUTO } ${ OPENCV_MODULES_DISABLED_FORCE } )
foreach ( mod ${ OPENCV_MODULES_BUILD } ${ OPENCV_MODULES_DISABLED_USER } ${ OPENCV_MODULES_DISABLED_AUTO } ${ OPENCV_MODULES_DISABLED_FORCE } )
string ( REGEX REPLACE "^opencv_" "" mod "${mod}" )
string ( REGEX REPLACE "^opencv_" "" mod "${mod}" )
if ( "${OPENCV_MODULE_opencv_${mod}_LOCATION}" STREQUAL "${OpenCV_SOURCE_DIR}/modules/${mod}" )
if ( "${OPENCV_MODULE_opencv_${mod}_LOCATION}" STREQUAL "${OpenCV_SOURCE_DIR}/modules/${mod}" )
list ( APPEND OPENCV2 _MODULES ${ mod } )
list ( APPEND BASE _MODULES ${ mod } )
else ( )
else ( )
list ( APPEND OPENCV _MODULES ${ mod } )
list ( APPEND EXTRA _MODULES ${ mod } )
endif ( )
endif ( )
endforeach ( )
endforeach ( )
list ( REMOVE_ITEM OPENCV2_MODULES ${ OPENCV2_BASE_MODULES } )
ocv_list_sort ( OPENCV2_MODULES )
set ( FIXED_ORDER_MODULES core imgproc highgui video calib3d features2d objdetect ml flann gpu photo stitching nonfree contrib legacy )
ocv_list_sort ( OPENCV_MODULES )
list ( REMOVE_ITEM BASE_MODULES ${ FIXED_ORDER_MODULES } )
ocv_list_sort ( BASE_MODULES )
ocv_list_sort ( EXTRA_MODULES )
set ( BASE_MODULES ${ FIXED_ORDER_MODULES } ${ BASE_MODULES } )
# b u i l d l i s t s o f d o c u m e n t a t i o n f i l e s a n d g e n e r a t e t a b l e o f c o n t e n t s f o r r e f e r e n c e m a n u a l
# b u i l d l i s t s o f d o c u m e n t a t i o n f i l e s a n d g e n e r a t e t a b l e o f c o n t e n t s f o r r e f e r e n c e m a n u a l
set ( OPENCV_FILES_REF "" )
set ( OPENCV_FILES_REF_PICT "" )
set ( OPENCV_REFMAN_TOC "" )
foreach ( mod ${ OPENCV2_BASE_MODULES } ${ OPENCV2_MODULES } ${ OPENCV_MODULES } )
set ( DOC_FAKE_ROOT "${CMAKE_CURRENT_BINARY_DIR}/fake-root" )
file ( GLOB_RECURSE _OPENCV_FILES_REF "${OPENCV_MODULE_opencv_${mod}_LOCATION}/doc/*.rst" )
set ( DOC_FAKE_ROOT_FILES "" )
file ( GLOB_RECURSE _OPENCV_FILES_REF_PICT "${OPENCV_MODULE_opencv_${mod}_LOCATION}/doc/*.png" "${OPENCV_MODULE_opencv_${mod}_LOCATION}/doc/*.jpg" )
list ( APPEND OPENCV_FILES_REF ${ _OPENCV_FILES_REF } )
list ( APPEND OPENCV_FILES_REF_PICT ${ _OPENCV_FILES_REF_PICT } )
set ( toc_file "${OPENCV_MODULE_opencv_${mod}_LOCATION}/doc/${mod}.rst" )
function ( ocv_doc_add_file_to_fake_root source destination )
if ( EXISTS "${toc_file}" )
add_custom_command (
file ( RELATIVE_PATH toc_file "${OpenCV_SOURCE_DIR}/modules" "${toc_file}" )
O U T P U T " $ { D O C _ F A K E _ R O O T } / $ { d e s t i n a t i o n } "
set ( OPENCV_REFMAN_TOC "${OPENCV_REFMAN_TOC} ${toc_file}\n" )
C O M M A N D " $ { C M A K E _ C O M M A N D } " - E c o p y " $ { s o u r c e } " " $ { D O C _ F A K E _ R O O T } / $ { d e s t i n a t i o n } "
D E P E N D S " $ { s o u r c e } "
C O M M E N T " C o p y i n g $ { d e s t i n a t i o n } t o f a k e r o o t . . . "
V E R B A T I M
)
list ( APPEND DOC_FAKE_ROOT_FILES "${DOC_FAKE_ROOT}/${destination}" )
set ( DOC_FAKE_ROOT_FILES "${DOC_FAKE_ROOT_FILES}" PARENT_SCOPE )
endfunction ( )
function ( ocv_doc_add_to_fake_root source )
if ( ARGC GREATER 1 )
set ( destination "${ARGV1}" )
else ( )
file ( RELATIVE_PATH destination "${OpenCV_SOURCE_DIR}" "${source}" )
endif ( )
if ( IS_DIRECTORY "${source}" )
file ( GLOB_RECURSE files RELATIVE "${source}" "${source}/*" )
foreach ( file ${ files } )
ocv_doc_add_file_to_fake_root ( "${source}/${file}" "${destination}/${file}" )
endforeach ( )
else ( )
ocv_doc_add_file_to_fake_root ( "${source}" "${destination}" )
endif ( )
endif ( )
endforeach ( )
file ( GLOB_RECURSE _OPENCV_FILES_REF "${OpenCV_SOURCE_DIR}/platforms/android/service/doc/*.rst" )
set ( DOC_FAKE_ROOT_FILES "${DOC_FAKE_ROOT_FILES}" PARENT_SCOPE )
file ( GLOB_RECURSE _OPENCV_FILES_REF_PICT "${OpenCV_SOURCE_DIR}/platforms/android/service/doc/*.png" "${OpenCV_SOURCE_DIR}/platforms/android/service/doc/*.jpg" )
endfunction ( )
list ( APPEND OPENCV_FILES_REF ${ _OPENCV_FILES_REF } )
list ( APPEND OPENCV_FILES_REF_PICT ${ _OPENCV_FILES_REF_PICT } )
configure_file ( "${OpenCV_SOURCE_DIR}/modules/refman.rst.in" "${OpenCV_SOURCE_DIR}/modules/refman.rst" IMMEDIATE @ONLY )
set ( OPENCV_REFMAN_TOC "" )
foreach ( mod ${ BASE_MODULES } ${ EXTRA_MODULES } )
if ( EXISTS "${OPENCV_MODULE_opencv_${mod}_LOCATION}/doc/${mod}.rst" )
ocv_doc_add_to_fake_root ( "${OPENCV_MODULE_opencv_${mod}_LOCATION}/doc" modules/ ${ mod } /doc )
set ( OPENCV_REFMAN_TOC "${OPENCV_REFMAN_TOC} ${mod}/doc/${mod}.rst\n" )
endif ( )
endforeach ( )
file ( GLOB_RECURSE OPENCV_FILES_UG user_guide/*.rst )
configure_file ( "${OpenCV_SOURCE_DIR}/modules/refman.rst.in" "${DOC_FAKE_ROOT}/modules/refman.rst" @ONLY )
file ( GLOB_RECURSE OPENCV_FILES_TUT tutorials/*.rst )
file ( GLOB_RECURSE OPENCV_FILES_TUT_PICT tutorials/*.png tutorials/*.jpg )
set ( OPENCV_DOC_DEPS conf.py ${ OPENCV_FILES_REF } ${ OPENCV_FILES_REF_PICT }
ocv_doc_add_to_fake_root ( "${OpenCV_SOURCE_DIR}/index.rst" )
$ { O P E N C V _ F I L E S _ U G } $ { O P E N C V _ F I L E S _ T U T } $ { O P E N C V _ F I L E S _ T U T _ P I C T } )
ocv_doc_add_to_fake_root ( "${OpenCV_SOURCE_DIR}/doc" )
ocv_doc_add_to_fake_root ( "${OpenCV_SOURCE_DIR}/platforms/android" )
ocv_doc_add_to_fake_root ( "${OpenCV_SOURCE_DIR}/samples" )
if ( PDFLATEX_COMPILER )
if ( PDFLATEX_COMPILER )
add_custom_target ( docs
add_custom_target ( docs
C O M M A N D $ { S P H I N X _ B U I L D } - b l a t e x - c $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / . . .
C O M M A N D $ { S P H I N X _ B U I L D } - b l a t e x - c " $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } " " $ { D O C _ F A K E _ R O O T } " .
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y _ d i r e c t o r y $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / p i c s $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / d o c / o p e n c v 1 / p i c s
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y _ d i r e c t o r y $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / p i c s $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / d o c / o p e n c v 1 / p i c s
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y _ i f _ d i f f e r e n t $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / m y m a t h . s t y $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R }
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y _ i f _ d i f f e r e n t $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / m y m a t h . s t y $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R }
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } " $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / p a t c h _ r e f m a n _ l a t e x . p y " o p e n c v 2 r e f m a n . t e x
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } " $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / p a t c h _ r e f m a n _ l a t e x . p y " o p e n c v 2 r e f m a n . t e x
@ -95,7 +117,7 @@ if(BUILD_DOCS AND HAVE_SPHINX)
C O M M A N D $ { C M A K E _ C O M M A N D } - E e c h o " G e n e r a t i n g o p e n c v _ c h e a t s h e e t . p d f "
C O M M A N D $ { C M A K E _ C O M M A N D } - E e c h o " G e n e r a t i n g o p e n c v _ c h e a t s h e e t . p d f "
C O M M A N D $ { P D F L A T E X _ C O M P I L E R } - i n t e r a c t i o n = b a t c h m o d e " $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / o p e n c v _ c h e a t s h e e t . t e x "
C O M M A N D $ { P D F L A T E X _ C O M P I L E R } - i n t e r a c t i o n = b a t c h m o d e " $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / o p e n c v _ c h e a t s h e e t . t e x "
C O M M A N D $ { P D F L A T E X _ C O M P I L E R } - i n t e r a c t i o n = b a t c h m o d e " $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / o p e n c v _ c h e a t s h e e t . t e x "
C O M M A N D $ { P D F L A T E X _ C O M P I L E R } - i n t e r a c t i o n = b a t c h m o d e " $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / o p e n c v _ c h e a t s h e e t . t e x "
D E P E N D S $ { O P E N C V _ D O C _ D E P S }
D E P E N D S $ { D O C _ F A K E _ R O O T _ F I L E S }
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R }
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R }
C O M M E N T " G e n e r a t i n g t h e P D F M a n u a l s "
C O M M E N T " G e n e r a t i n g t h e P D F M a n u a l s "
)
)
@ -109,9 +131,9 @@ if(BUILD_DOCS AND HAVE_SPHINX)
endif ( )
endif ( )
add_custom_target ( html_docs
add_custom_target ( html_docs
C O M M A N D $ { S P H I N X _ B U I L D } - b h t m l - c $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / . . . / _ h t m l
C O M M A N D " $ { S P H I N X _ B U I L D } " - b h t m l - c " $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } " " $ { D O C _ F A K E _ R O O T } " . / _ h t m l
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / m y m a t h . s t y $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R }
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / m y m a t h . s t y $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R }
D E P E N D S $ { O P E N C V _ D O C _ D E P S }
D E P E N D S $ { D O C _ F A K E _ R O O T _ F I L E S }
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R }
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R }
C O M M E N T " G e n e r a t i n g O n l i n e D o c u m e n t a t i o n "
C O M M E N T " G e n e r a t i n g O n l i n e D o c u m e n t a t i o n "
)
)