Made reference manual table of contents autogenerated
authorAndrey Kamaev <no@email>
Wed, 30 May 2012 14:06:47 +0000 (14:06 +0000)
committerAndrey Kamaev <no@email>
Wed, 30 May 2012 14:06:47 +0000 (14:06 +0000)
doc/CMakeLists.txt
modules/refman.rst [deleted file]
modules/refman.rst.in [new file with mode: 0644]

index 4fad59d..cf19934 100644 (file)
@@ -11,8 +11,44 @@ if(BUILD_DOCS AND HAVE_SPHINX)
 
   project(opencv_docs)
 
-  file(GLOB_RECURSE OPENCV_FILES_REF ../modules/*.rst)
-  file(GLOB_RECURSE OPENCV_FILES_REF_PICT ../modules/*.png ../modules/*.jpg)
+  set(OPENCV2_BASE_MODULES core imgproc highgui video calib3d features2d objdetect ml flann gpu photo stitching nonfree contrib legacy)
+
+  # build lists of modules to be documented
+  set(OPENCV2_MODULES "")
+  set(OPENCV_MODULES "")
+
+  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}")
+      list(APPEND OPENCV2_MODULES ${mod})
+    else()
+      list(APPEND OPENCV_MODULES ${mod})
+    endif()
+  endforeach()
+  list(REMOVE_ITEM OPENCV2_MODULES ${OPENCV2_BASE_MODULES})
+  ocv_list_sort(OPENCV2_MODULES)
+  ocv_list_sort(OPENCV_MODULES)
+
+  # build lists of documentation files and generate table of contents for reference manual
+  set(OPENCV_FILES_REF "")
+  set(OPENCV_FILES_REF_PICT "")
+  set(OPENCV_REFMAN_TOC "")
+
+  foreach(mod ${OPENCV2_BASE_MODULES} ${OPENCV2_MODULES} ${OPENCV_MODULES})
+    file(GLOB_RECURSE _OPENCV_FILES_REF "${OPENCV_MODULE_opencv_${mod}_LOCATION}/doc/*.rst")
+    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")
+    if(EXISTS "${toc_file}")
+      file(RELATIVE_PATH toc_file "${OpenCV_SOURCE_DIR}/modules" "${toc_file}")
+      set(OPENCV_REFMAN_TOC "${OPENCV_REFMAN_TOC}   ${toc_file}\r\n")
+    endif()
+  endforeach()
+
+  configure_file("${OpenCV_SOURCE_DIR}/modules/refman.rst.in" "${OpenCV_SOURCE_DIR}/modules/refman.rst" IMMEDIATE @ONLY)
+
   file(GLOB_RECURSE OPENCV_FILES_UG user_guide/*.rst)
   file(GLOB_RECURSE OPENCV_FILES_TUT tutorials/*.rst)
   file(GLOB_RECURSE OPENCV_FILES_TUT_PICT tutorials/*.png tutorials/*.jpg)
@@ -54,6 +90,6 @@ if(BUILD_DOCS AND HAVE_SPHINX)
     set_target_properties(html_docs PROPERTIES FOLDER "documentation")
   endif()
 endif()
-        
+
 install(FILES ${FILES_DOC} DESTINATION "${OPENCV_DOC_INSTALL_PATH}" COMPONENT main)
 install(FILES ${FILES_DOC_VS} DESTINATION "${OPENCV_DOC_INSTALL_PATH}/vidsurv" COMPONENT main)
diff --git a/modules/refman.rst b/modules/refman.rst
deleted file mode 100644 (file)
index dc15ab9..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-############################
-OpenCV API Reference
-############################
-
-.. toctree::
-   :maxdepth: 2
-
-   core/doc/intro.rst
-   core/doc/core.rst
-   imgproc/doc/imgproc.rst
-   highgui/doc/highgui.rst
-   video/doc/video.rst
-   calib3d/doc/calib3d.rst
-   features2d/doc/features2d.rst
-   objdetect/doc/objdetect.rst
-   ml/doc/ml.rst
-   flann/doc/flann.rst
-   gpu/doc/gpu.rst
-   photo/doc/photo.rst
-   stitching/doc/stitching.rst
-   nonfree/doc/nonfree.rst
-   contrib/doc/contrib.rst
-   legacy/doc/legacy.rst
-
diff --git a/modules/refman.rst.in b/modules/refman.rst.in
new file mode 100644 (file)
index 0000000..e039c09
--- /dev/null
@@ -0,0 +1,9 @@
+############################
+OpenCV API Reference
+############################
+
+.. toctree::
+   :maxdepth: 2
+
+   core/doc/intro.rst
+@OPENCV_REFMAN_TOC@