Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add scripts to distrib.
[simgrid.git] / buildtools / Cmake / src / CMakeDocs.txt
1 if(BIBTEX2HTML)
2 set(BIBTEX2HTML_PATH ${BIBTEX2HTML})
3 else(BIBTEX2HTML)
4 find_path(BIBTEX2HTML_PATH      NAMES bibtex2html       PATHS NO_DEFAULT_PATHS)
5 endif(BIBTEX2HTML)
6
7 find_path(FIG2DEV_PATH  NAMES fig2dev   PATHS NO_DEFAULT_PATHS)
8 find_path(DOXYGEN_PATH  NAMES doxygen   PATHS NO_DEFAULT_PATHS)
9 find_path(BIBTOOL_PATH  NAMES bibtool   PATHS NO_DEFAULT_PATHS)
10 find_path(ICONV_PATH    NAMES iconv     PATHS NO_DEFAULT_PATHS)
11
12 message("\tFIG2DEV_PATH : ${FIG2DEV_PATH}")
13 message("\tDOXYGEN_PATH : ${DOXYGEN_PATH}")
14 message("\tBIBTOOL_PATH : ${BIBTOOL_PATH}")
15 message("\tICONV_PATH   : ${ICONV_PATH}")
16
17 if(BIBTEX2HTML_PATH)
18         exec_program("${BIBTEX2HTML_PATH}/bibtex2html -version" OUTPUT_VARIABLE SORTIE_BIBTEX2HTML_VERSION)
19         STRING(REPLACE "[-bibtex]" "" SORTIE_BIBTEX2HTML_VERSION_2 ${SORTIE_BIBTEX2HTML_VERSION})
20         if(${SORTIE_BIBTEX2HTML_VERSION_2} STREQUAL ${SORTIE_BIBTEX2HTML_VERSION}) # mauvaise version
21                 message("\nERROR --> NEED to set bibtex2html path with \"ccmake ./\" or with \"cmake -DBIBTEX2HTML=<path_to> ./\"")
22                 message("\nTake care having install the good bibtex2html \n\t(download it : ftp://ftp-sop.inria.fr/epidaure/Softs/bibtex2html/bibtex2html-1.02.tar.gz)")
23                 message("\n")
24         endif(${SORTIE_BIBTEX2HTML_VERSION_2} STREQUAL ${SORTIE_BIBTEX2HTML_VERSION})
25 endif(BIBTEX2HTML_PATH)
26 message("\tBIBTEX2HTML_PATH   : ${BIBTEX2HTML_PATH}")
27
28 exec_program("rm -rf ${PROJECT_DIRECTORY}/doc/html"  "${PROJECT_DIRECTORY}/doc/")
29 exec_program("mkdir -p ${PROJECT_DIRECTORY}/doc/html"  "${PROJECT_DIRECTORY}/doc/")
30 exec_program("find ${PROJECT_DIRECTORY}/tools/gras  ${PROJECT_DIRECTORY}/src ${PROJECT_DIRECTORY}/include -name \"*.[chl]\"" OUTPUT_VARIABLE LISTE_UNE)
31 exec_program("find ${PROJECT_DIRECTORY} -name \"*.doc\" |grep -v logcategories.doc"  "${PROJECT_DIRECTORY}/doc/" OUTPUT_VARIABLE LISTE_DEUX)
32
33 set(DOCSSOURCES "${LISTE_UNE}\n${LISTE_DEUX}")
34 string(REPLACE "\n" ";" DOCSSOURCES ${DOCSSOURCES})
35
36 set(FIGS
37 ${PROJECT_DIRECTORY}/doc/fig/simgrid_modules.fig
38 ${PROJECT_DIRECTORY}/doc/fig/simgrid_modules2.fig
39 ${PROJECT_DIRECTORY}/doc/fig/amok_bw_test.fig
40 ${PROJECT_DIRECTORY}/doc/fig/amok_bw_sat.fig
41 ${PROJECT_DIRECTORY}/doc/fig/gras_comm.fig
42 )
43
44 string(REPLACE ".fig" ".png\n" LISTE_TROIS ${FIGS})
45
46 set(PNGS 
47 ${PROJECT_DIRECTORY}/doc/webcruft/simgrid_logo.png
48 ${PROJECT_DIRECTORY}/doc/webcruft/simgrid_logo_small.png
49 ${PROJECT_DIRECTORY}/doc/webcruft/poster_thumbnail.png
50 )
51
52 if(DOXYGEN_PATH AND FIG2DEV_PATH)
53
54         exec_program("${FIG2DEV_PATH}/fig2dev -Lmap ${PROJECT_DIRECTORY}/doc/fig/simgrid_modules.fig | grep -e IMG -e MAP -e AREA | sed 's/imagemap/simgrid_modules/g' | sed 's/\\.gif/.png/' | sed 's/<IMG /<IMG style=\"border:0px \"/g' | sed 's/\\.gif/.png/' > ${PROJECT_DIRECTORY}/doc/simgrid_modules.map"  "${PROJECT_DIRECTORY}/doc/")
55
56         foreach(file ${FIGS})
57                 string(REPLACE ".fig" ".png" tmp_file ${file})
58                 string(REPLACE "${PROJECT_DIRECTORY}/doc/fig/" "${PROJECT_DIRECTORY}/doc/html/" tmp_file ${tmp_file})
59                 exec_program("${FIG2DEV_PATH}/fig2dev -Lpng ${file} > ${tmp_file}"  "${PROJECT_DIRECTORY}/doc/")
60         endforeach(file ${FIGS})
61
62
63         exec_program("touch ${PROJECT_DIRECTORY}/doc/index-API.doc ${PROJECT_DIRECTORY}/doc/.FAQ.doc.toc ${PROJECT_DIRECTORY}/doc/.index.doc.toc ${PROJECT_DIRECTORY}/doc/.contrib.doc.toc ${PROJECT_DIRECTORY}/doc/.history.doc.toc"  "${PROJECT_DIRECTORY}/doc/")
64         exec_program("test -e ${PROJECT_DIRECTORY}/doc/html || mkdir ${PROJECT_DIRECTORY}/doc/html"  "${PROJECT_DIRECTORY}/doc/")
65
66         foreach(file ${PNGS})
67                 exec_program("cp ${file} ${PROJECT_DIRECTORY}/doc/html/"  "${PROJECT_DIRECTORY}/doc/")
68         endforeach(file ${PNGS})
69
70         exec_program("cp ${PROJECT_DIRECTORY}/doc/webcruft/Paje_MSG_screenshot_thn.jpg ${PROJECT_DIRECTORY}/doc/webcruft/Paje_MSG_screenshot.jpg ${PROJECT_DIRECTORY}/doc/html/"  "${PROJECT_DIRECTORY}/doc/")
71         exec_program("cp ${PROJECT_DIRECTORY}/doc/triva-time_interval.png ${PROJECT_DIRECTORY}/doc/html/"  "${PROJECT_DIRECTORY}/doc/")
72         exec_program("cp ${PROJECT_DIRECTORY}/doc/triva-graph_configuration.png ${PROJECT_DIRECTORY}/doc/html/"  "${PROJECT_DIRECTORY}/doc/")
73         exec_program("cp ${PROJECT_DIRECTORY}/doc/triva-graph_visualization.png ${PROJECT_DIRECTORY}/doc/html/"  "${PROJECT_DIRECTORY}/doc/")
74         exec_program("cp ${PROJECT_DIRECTORY}/doc/simgrid.css ${PROJECT_DIRECTORY}/doc/html/"  "${PROJECT_DIRECTORY}/doc/") 
75
76         set(top_srcdir "..")
77         set(WARNING "This file is generated, do not edit")
78         set(srcdir ".")
79         configure_file(${PROJECT_DIRECTORY}/doc/Doxyfile.in ${PROJECT_DIRECTORY}/doc/Doxyfile @ONLY)
80 # First pass
81         exec_program("${DOXYGEN_PATH}/doxygen ${PROJECT_DIRECTORY}/doc/Doxyfile" "${PROJECT_DIRECTORY}/doc/")
82
83         exec_program("${PROJECT_DIRECTORY}/tools/doxygen/index_create.pl" "${PROJECT_DIRECTORY}/doc/"
84         ARGS simgrid.tag index-API.doc)
85         exec_program("${PROJECT_DIRECTORY}/tools/doxygen/toc_create.pl" "${PROJECT_DIRECTORY}/doc/"
86         ARGS FAQ.doc index.doc contrib.doc gtut-introduction.doc history.doc)
87 # Second pass
88         exec_program("${DOXYGEN_PATH}/doxygen ${PROJECT_DIRECTORY}/doc/Doxyfile" "${PROJECT_DIRECTORY}/doc/")
89 # Post-processing
90         exec_program("rm -f ${PROJECT_DIRECTORY}/doc/html/dir*"  "${PROJECT_DIRECTORY}/doc/")
91         exec_program("${PROJECT_DIRECTORY}/tools/doxygen/index_php.pl""${PROJECT_DIRECTORY}/doc/"
92         ARGS index.php.in html/index.html index.php)
93         exec_program("${PROJECT_DIRECTORY}/tools/doxygen/doxygen_postprocesser.pl"  "${PROJECT_DIRECTORY}/doc/")
94
95 #html/gras.html:
96         exec_program("echo \"<html><META HTTP-EQUIV='Refresh' content='0;URL=http://simgrid.gforge.inria.fr/doc/group__GRAS__API.html'>\" > ${PROJECT_DIRECTORY}/doc/html/gras.html"  "${PROJECT_DIRECTORY}/doc/")
97         exec_program("echo \"<center><h2><br><a href='http://simgrid.gforge.inria.fr/doc/group__GRAS__API.html'>Grid Reality And Simulation.</a></h2></center></html>\" >> ${PROJECT_DIRECTORY}/doc/html/gras.html"  "${PROJECT_DIRECTORY}/doc/")
98 #html/amok.html:
99         exec_program("echo \"<html><META HTTP-EQUIV='Refresh' content='0;URL=http://simgrid.gforge.inria.fr/doc/group__AMOK__API.html'>\" > ${PROJECT_DIRECTORY}/doc/html/amok.html"  "${PROJECT_DIRECTORY}/doc/")
100         exec_program("echo \"<center><h2><br><a href='http://simgrid.gforge.inria.fr/doc/group__AMOK__API.html'>Advanced Metacomputing Overlay Kit.</a></h2></center></html>\" >> ${PROJECT_DIRECTORY}/doc/html/amok.html"  "${PROJECT_DIRECTORY}/doc/")
101 #html/msg.html:
102         exec_program("echo \"<html><META HTTP-EQUIV='Refresh' content='0;URL=http://simgrid.gforge.inria.fr/doc/group__MSG__API.html'>\" > ${PROJECT_DIRECTORY}/doc/html/msg.html"  "${PROJECT_DIRECTORY}/doc/")
103         exec_program("echo \"<center><h2><br><a href='http://simgrid.gforge.inria.fr/doc/group__MSG__API.html'>Meta SimGrid.</a></h2></center></html>\" >> ${PROJECT_DIRECTORY}/doc/html/msg.html"  "${PROJECT_DIRECTORY}/doc/")
104 #html/simdag.html:
105         exec_program("echo \"<html><META HTTP-EQUIV='Refresh' content='0;URL=http://simgrid.gforge.inria.fr/doc/group__SD__API.html'>\" > ${PROJECT_DIRECTORY}/doc/html/simdag.html"  "${PROJECT_DIRECTORY}/doc/")
106         exec_program("echo \"<center><h2><br><a href='http://simgrid.gforge.inria.fr/doc/group__SD__API.html'>DAG Simulator.</a></h2></center></html>\" >> ${PROJECT_DIRECTORY}/doc/html/simdag.html"  "${PROJECT_DIRECTORY}/doc/")
107
108 if(BIBTOOL_PATH AND BIBTEX2HTML_PATH AND ICONV_PATH)
109
110 #publis_count.html: all.bib
111         exec_program("${PROJECT_DIRECTORY}/tools/doxygen/bibtex2html_table_count.pl < ${PROJECT_DIRECTORY}/doc/all.bib > ${PROJECT_DIRECTORY}/doc/publis_count.html"  "${PROJECT_DIRECTORY}/doc/")
112
113 #publis_core.bib: all.bib 
114         exec_program("${BIBTOOL_PATH}/bibtool -- 'select.by.string={category \"core\"}' -- 'preserve.key.case={on}' -- 'preserve.keys={on}' ${PROJECT_DIRECTORY}/doc/all.bib -o ${PROJECT_DIRECTORY}/doc/publis_core.bib"  "${PROJECT_DIRECTORY}/doc/")
115
116 #publis_extern.bib: all.bib 
117         exec_program("${BIBTOOL_PATH}/bibtool -- 'select.by.string={category \"extern\"}' -- 'preserve.key.case={on}' -- 'preserve.keys={on}' ${PROJECT_DIRECTORY}/doc/all.bib -o ${PROJECT_DIRECTORY}/doc/publis_extern.bib"  "${PROJECT_DIRECTORY}/doc/")
118
119 #publis_intra.bib: all.bib 
120         exec_program("${BIBTOOL_PATH}/bibtool -- 'select.by.string={category \"intra\"}' -- 'preserve.key.case={on}' -- 'preserve.keys={on}' ${PROJECT_DIRECTORY}/doc/all.bib -o ${PROJECT_DIRECTORY}/doc/publis_intra.bib"  "${PROJECT_DIRECTORY}/doc/")
121
122 #%_bib.latin1.html: %.bib
123         exec_program("find ${PROJECT_DIRECTORY}/doc/ -name \"*.bib\""  "${PROJECT_DIRECTORY}/doc/" OUTPUT_VARIABLE LISTE_QUATRE)
124         string(REPLACE "\n" ";" LISTE_QUATRE ${LISTE_QUATRE})
125         foreach(file ${LISTE_QUATRE})
126                 string(REPLACE ".bib" "_bib.latin1.html" file_tmp "${file}")
127                 string(REPLACE ".html" ".html.tmp" file_tmp2 "${file_tmp}")
128                 exec_program("${BIBTEX2HTML_PATH}/bibtex2html -single-output -nv -force -sort year -copy-icons ${file} -output ${file_tmp2} 2>&1 | grep -v 'WARNING: unknown field type'"  "${PROJECT_DIRECTORY}/doc/")
129                 exec_program("${PROJECT_DIRECTORY}/tools/doxygen/bibtex2html_postprocessor.pl < ${file_tmp2} > ${file_tmp}"  "${PROJECT_DIRECTORY}/doc/")
130                 #message("file ${file}\nfile_tmp ${file_tmp}")
131         endforeach(file ${LISTE_QUATRE})
132
133
134 #%_bib.html: %_bib.latin1.html
135         exec_program("find ${PROJECT_DIRECTORY}/doc/ -name \"*_bib.latin1.html\""  "${PROJECT_DIRECTORY}/doc/" OUTPUT_VARIABLE LISTE_CINQ)
136         string(REPLACE "\n" ";" LISTE_CINQ ${LISTE_CINQ})
137         foreach(file ${LISTE_CINQ})
138                 string(REPLACE "_bib.latin1.html" "_bib.html" file_tmp "${file}")
139                 exec_program("${ICONV_PATH}/iconv --from-code latin1 --to-code utf8 ${file} --output ${file_tmp}"  "${PROJECT_DIRECTORY}/doc/")
140                 #message("file ${file}\nfile_tmp ${file_tmp}")
141         endforeach(file ${LISTE_CINQ})
142 endif(BIBTOOL_PATH AND BIBTEX2HTML_PATH AND ICONV_PATH)
143
144 endif(DOXYGEN_PATH AND FIG2DEV_PATH)
145
146 file(WRITE ${PROJECT_DIRECTORY}/doc/logcategories.sh    "\#! /bin/sh")  
147 file(APPEND ${PROJECT_DIRECTORY}/doc/logcategories.sh   "\npwd=`pwd`")
148 file(APPEND ${PROJECT_DIRECTORY}/doc/logcategories.sh   "\nrm -f $pwd/logcategories.doc")
149 file(APPEND ${PROJECT_DIRECTORY}/doc/logcategories.sh   "\nset -e")
150 file(APPEND ${PROJECT_DIRECTORY}/doc/logcategories.sh   "\necho \"/* Generated file, do not edit */\"     > $pwd/logcategories.doc")
151 file(APPEND ${PROJECT_DIRECTORY}/doc/logcategories.sh   "\necho \"/** \\addtogroup XBT_log_cats\"          >> $pwd/logcategories.doc")
152 file(APPEND ${PROJECT_DIRECTORY}/doc/logcategories.sh   "\necho \"    @{\"                                >> $pwd/logcategories.doc")
153 file(APPEND ${PROJECT_DIRECTORY}/doc/logcategories.sh   "\ncd ${PROJECT_DIRECTORY}/src")
154 file(APPEND ${PROJECT_DIRECTORY}/doc/logcategories.sh   "\n${PROJECT_DIRECTORY}/tools/doxygen/xbt_log_extract_hierarchy.pl      >> $pwd/logcategories.doc")
155 file(APPEND ${PROJECT_DIRECTORY}/doc/logcategories.sh   "\necho \"@}*/\"                                 >> $pwd/logcategories.doc")
156
157 exec_program("chmod a=rwx ${PROJECT_DIRECTORY}/doc/logcategories.sh"  "${PROJECT_DIRECTORY}/doc/")
158 exec_program("${PROJECT_DIRECTORY}/doc/logcategories.sh" "${PROJECT_DIRECTORY}/doc/"
159 ARGS ${DOCSSOURCES})
160
161
162 file(WRITE ${PROJECT_DIRECTORY}/doc/realtoc.sh  "\#! /bin/sh")  
163 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\n\necho \"Check individual TOCs\"")
164 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\nfor n in gtut-tour-*.doc ; do")
165 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\n  sed -n '/Table of Contents/,/hr/p' $n|grep ref > tmp.curtoc;")
166 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\n  grep -E '\\\\s?u?b?section' $n | grep -v _toc | sed -e 's/\\\\section //' -e 's/\\\\subsection /subsection/' -e 's/ .*//' | sed -e 's/^/ - \\\\ref /' -e 's/- \\\\ref subsection/   - \\\\ref /' > tmp.realtoc;")
167 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\n  if ! diff -q tmp.curtoc tmp.realtoc >/dev/null; then")
168 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\n    echo \"Wrong toc for $n. Should be ;\"")
169 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\n    cat tmp.realtoc;")
170 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\n  fi ;")
171 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\ndone")
172 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\n\nrm tmp.realtoc tmp.curtoc")
173 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\necho \"Check main TOC\"")
174 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\nfor n in gtut-tour-*doc; do")
175 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\n  grep @page $n | sed -e 's/@page //' -e 's/ .*//' -e 's/^/ - \\\\ref /' >>tmp.realtoc;")
176 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\n  sed -n -e '/Table of Contents/,/hr/p' $n|sed -e 's/^/   /'| grep -v toc|grep -v '<hr>'|grep [^[:blank:]] >>tmp.realtoc;")
177 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\ndone")
178 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\ngrep ' *- \\\\ref' gtut-tour.doc > tmp.curtoc")
179 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\nif ! diff -b -u tmp.curtoc tmp.realtoc ; then")
180 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\n  echo \"Wrong toc for gtut-tour.doc Right one is in tmp.realtoc\";")
181 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\nelse")
182 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\n  rm tmp.realtoc;")
183 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\nfi ;")
184 file(APPEND ${PROJECT_DIRECTORY}/doc/realtoc.sh "\nrm tmp.curtoc")
185
186 exec_program("chmod a=rwx ${PROJECT_DIRECTORY}/doc/realtoc.sh"  "${PROJECT_DIRECTORY}/doc/")
187 exec_program("${PROJECT_DIRECTORY}/doc/realtoc.sh" "${PROJECT_DIRECTORY}/doc/")