Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Just cleaned some stuff to only show undocumented functions refered
[simgrid.git] / buildtools / Cmake / GenerateRefGuide.cmake
1 #### Generate the html documentation
2
3 file(GLOB_RECURSE source_doxygen
4   "${CMAKE_HOME_DIRECTORY}/tools/gras/*.[chl]"
5   "${CMAKE_HOME_DIRECTORY}/src/*.[chl]"
6   "${CMAKE_HOME_DIRECTORY}/include/*.[chl]"
7   )
8
9 if(FIG2DEV_PATH)
10
11   set(DOC_PNGS
12     ${CMAKE_HOME_DIRECTORY}/doc/webcruft/simgrid_logo_2011.png
13     ${CMAKE_HOME_DIRECTORY}/doc/webcruft/simgrid_logo_2011_small.png
14     )
15
16   configure_file(${CMAKE_HOME_DIRECTORY}/doc/ref_guide/doxygen/RefGuideDoxyfile.in ${CMAKE_HOME_DIRECTORY}/doc/ref_guide/doxygen/RefGuideDoxyfile @ONLY)
17
18   ADD_CUSTOM_TARGET(ref_guide
19     COMMENT "Generating the SimGrid ref guide..."
20     DEPENDS ${REF_GUIDE_SOURCES} ${DOC_FIGS} ${source_doxygen}
21     COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_HOME_DIRECTORY}/doc/ref_guide/html
22     COMMAND ${CMAKE_COMMAND} -E make_directory   ${CMAKE_HOME_DIRECTORY}/doc/ref_guide/html
23     WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/doc/ref_guide/
24     )
25
26   ADD_CUSTOM_COMMAND(TARGET ref_guide
27     DEPENDS ${source_doxygen}
28     COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_HOME_DIRECTORY}/doc/ref_guide/doxygen/logcategories.doc
29     COMMAND ${CMAKE_HOME_DIRECTORY}/tools/doxygen/xbt_log_extract_hierarchy.pl > ${CMAKE_HOME_DIRECTORY}/doc/ref_guide/doxygen/logcategories.doc
30     WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}
31     )
32
33   foreach(file ${DOC_FIGS})
34     string(REPLACE ".fig" ".png" tmp_file ${file})
35     string(REPLACE "${CMAKE_HOME_DIRECTORY}/doc/shared/fig/" "${CMAKE_HOME_DIRECTORY}/doc/ref_guide/html/" tmp_file ${tmp_file})
36     ADD_CUSTOM_COMMAND(TARGET ref_guide
37       COMMAND ${FIG2DEV_PATH}/fig2dev -Lpng -S 4 ${file} ${tmp_file}
38       )
39   endforeach(file ${DOC_FIGS})
40
41   foreach(file ${DOC_PNGS})
42     ADD_CUSTOM_COMMAND(TARGET ref_guide
43       COMMAND ${CMAKE_COMMAND} -E copy ${file} ${CMAKE_HOME_DIRECTORY}/doc/ref_guide/html/
44       )
45   endforeach(file ${DOC_PNGS})
46
47   ADD_CUSTOM_COMMAND(TARGET ref_guide
48     COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/doc/simgrid.css                          ${CMAKE_HOME_DIRECTORY}/doc/ref_guide/html/
49     )
50
51   ADD_CUSTOM_COMMAND(TARGET ref_guide
52     COMMAND ${FIG2DEV_PATH}/fig2dev -Lmap ${CMAKE_HOME_DIRECTORY}/doc/shared/fig/simgrid_modules.fig | perl -pe 's/imagemap/simgrid_modules/g'| perl -pe 's/<IMG/<IMG style=border:0px/g' | ${CMAKE_HOME_DIRECTORY}/tools/doxygen/fig2dev_postprocessor.pl > ${CMAKE_HOME_DIRECTORY}/doc/ref_guide/doxygen/simgrid_modules.map
53     COMMAND ${CMAKE_COMMAND} -E echo "XX First Doxygen pass"
54     COMMAND ${DOXYGEN_PATH}/doxygen RefGuideDoxyfile
55     COMMAND ${CMAKE_HOME_DIRECTORY}/tools/doxygen/index_create.pl ../../shared/doxygen/simgridrefguide.tag index-API.doc
56
57     COMMAND ${CMAKE_COMMAND} -E echo "XX Second Doxygen pass"
58     COMMAND ${DOXYGEN_PATH}/doxygen RefGuideDoxyfile
59
60     COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_HOME_DIRECTORY}/doc/ref_guide/html/dir*
61
62     WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/doc/ref_guide/doxygen
63     )
64
65 else(DOXYGEN_PATH AND FIG2DEV_PATH)
66
67   ADD_CUSTOM_TARGET(ref_guide
68     COMMENT "Generating the SimGrid documentation..."
69     )
70
71   ADD_CUSTOM_COMMAND(TARGET ref_guide
72     COMMAND ${CMAKE_COMMAND} -E echo "DOXYGEN_PATH     = ${DOXYGEN_PATH}"
73     COMMAND ${CMAKE_COMMAND} -E echo "FIG2DEV_PATH     = ${FIG2DEV_PATH}"
74     COMMAND ${CMAKE_COMMAND} -E echo "IN ORDER TO GENERATE THE DOCUMENTATION YOU NEED ALL TOOLS !!!"
75     COMMAND ${CMAKE_COMMAND} -E echo "FAIL TO MAKE SIMGRID DOCUMENTATION see previous messages for details ..."
76     COMMAND false
77     )
78
79 endif(FIG2DEV_PATH)
80
81 ##############################################################################"
82
83 ADD_CUSTOM_TARGET(ref_guide_pdf
84     COMMAND ${CMAKE_COMMAND} -E echo "XX First pass simgrid_documentation.pdf"
85     COMMAND make clean
86     COMMAND make pdf || true
87     COMMAND ${CMAKE_COMMAND} -E echo "XX Second pass simgrid_documentation.pdf"
88     COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_HOME_DIRECTORY}/doc/latex/refman.pdf
89     COMMAND make pdf || true
90     COMMAND ${CMAKE_COMMAND} -E echo "XX Write Simgrid_documentation.pdf"
91     COMMAND ${CMAKE_COMMAND} -E rename ${CMAKE_HOME_DIRECTORY}/doc/latex/refman.pdf ${CMAKE_HOME_DIRECTORY}/doc/latex/simgrid_documentation.pdf
92
93     WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/doc/latex/
94 )
95 add_dependencies(ref_guide_pdf ref_guide)