1 # =======================================================================
2 # Created on: 2014-03-21
4 # Copyright (c) 1996-1999 Matra Datavision
5 # Copyright (c) 1999-2014 OPEN CASCADE SAS
7 # This file is part of Open CASCADE Technology software library.
9 # This library is free software; you can redistribute it and/or modify it under
10 # the terms of the GNU Lesser General Public License version 2.1 as published
11 # by the Free Software Foundation, with special exception defined in the file
12 # OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
13 # distribution for complete text of the license and disclaimer of any warranty.
15 # Alternatively, this file may be used under the terms of Open CASCADE
16 # commercial license or contractual agreement.
18 # =======================================================================
19 # This script defines command gendoc compiling OCCT documents
20 # from *.md files to HTML pages
21 # =======================================================================
23 # load auxiliary tools
24 source [file join [file dirname [info script]] occaux.tcl]
26 # ======================================
28 # ======================================
31 proc OCCDoc_PrintHelpMessage {} {
32 puts "\nUsage: gendoc \[-h\] {-refman|-overview} \[-html|-pdf|-chm\] \[-m=<list of modules>|-ug=<list of docs>\] \[-v\] \[-s=<search_mode>\] \[-mathjax=<path>\] \[-update_images_size\]"
36 puts "choice of documentation to be generated:"
37 puts " -overview : To generate Overview and User Guides"
38 puts " (cannot be used with -refman)"
39 puts " -refman : To generate class Reference Manual"
40 puts " (cannot be used with -overview)"
42 puts "choice of output format:"
43 puts " -html : To generate HTML files"
44 puts " (default, cannot be used with -pdf or -chm)"
45 puts " -pdf : To generate PDF files"
46 puts " (cannot be used with -refman, -html, or -chm)"
47 puts " -chm : To generate CHM files"
48 puts " (cannot be used with -html or -pdf)"
50 puts "additional options:"
51 puts " -m=<modules_list> : List of OCCT modules (separated with comma),"
52 puts " for generation of Reference Manual"
53 puts " -ug=<docs_list> : List of MarkDown documents (separated with comma),"
54 puts " to use for generation of Overview / User Guides"
55 puts " -mathjax=<path> : To use local or alternative copy of MathJax"
56 puts " -s=<search_mode> : Specifies the Search mode of HTML documents"
57 puts " Can be: none | local | server | external"
58 puts " -h : Prints this help message"
59 puts " -v : Enables more verbose output"
60 puts " -update_images_size: Updates width of images in *.md files during pdf generation for @figure alias. It takes actual size of image."
63 # A command for User Documentation compilation
68 set GEN_MODE "HTML_ONLY"
73 set UPDATE_IMAGES_SIZE "NO"
74 set SEARCH_MODE "none"
75 set MATHJAX_LOCATION "https://cdn.mathjax.org/mathjax/latest"
76 set mathjax_js_name "MathJax.js"
77 set DOCTYPE_COMBO_FLAG 0
78 set GENMODE_COMBO_FLAG 0
79 set GENERATE_PRODUCTS_REFMAN "NO"
81 global available_docfiles; # The full list of md files for HTML or CHM generation
82 global available_pdf; # The full list of md files for PDF generation
88 # Load list of docfiles
89 if { [OCCDoc_LoadFilesList] != 0 } {
90 puts "Error: File FILES_HTML.txt or FILES_PDF.txt was not found on this computer.\nAborting..."
95 if {[OCCDoc_ParseArguments $args] == 1} {
99 # Print help message if no arguments provided
100 if {[llength $args_names] == 0} {
101 OCCDoc_PrintHelpMessage
105 foreach arg_n $args_names {
107 OCCDoc_PrintHelpMessage
109 } elseif {$arg_n == "html"} {
110 if { ([ lsearch $args_names "refman" ] == -1) &&
111 ([ lsearch $args_names "overview" ] == -1) } {
112 puts "Warning: Please specify -refman or -overview argument."
115 if { [ lsearch $args_names "refman" ] != -1 } {
118 if { $GENMODE_COMBO_FLAG != 1 } {
119 set GEN_MODE "HTML_ONLY"
120 set GENMODE_COMBO_FLAG 1
122 puts "Error: Options -html, -pdf and -chm can not be combined."
125 } elseif {$arg_n == "chm"} {
126 if { ([ lsearch $args_names "refman" ] == -1) &&
127 ([ lsearch $args_names "overview" ] == -1) } {
128 puts "Warning: Please specify -refman or -overview argument."
131 if { [ lsearch $args_names "refman" ] != -1 } {
134 if { $GENMODE_COMBO_FLAG != 1 } {
135 set GEN_MODE "CHM_ONLY"
136 set GENMODE_COMBO_FLAG 1
138 puts "Error: Options -html, -pdf and -chm cannot be combined."
141 } elseif {$arg_n == "pdf"} {
142 if { ([ lsearch $args_names "refman" ] == -1) &&
143 ([ lsearch $args_names "overview" ] == -1) } {
144 puts "Warning: Please specify -refman or -overview argument."
147 if { [ lsearch $args_names "refman" ] != -1 } {
150 if { $GENMODE_COMBO_FLAG != 1 } {
151 set GEN_MODE "PDF_ONLY"
152 set GENMODE_COMBO_FLAG 1
154 puts "Error: Options -html, -pdf and -chm cannot be combined."
157 } elseif {$arg_n == "overview"} {
158 if { $DOCTYPE_COMBO_FLAG != 1 } {
159 set DOC_TYPE "OVERVIEW"
160 set DOCTYPE_COMBO_FLAG 1
162 puts "Error: Options -refman and -overview cannot be combined."
166 # Print ignored options
167 if { [ lsearch $args_names "m" ] != -1 } {
168 puts "\nInfo: The following options will be ignored: \n"
172 } elseif {$arg_n == "refman"} {
173 if { $DOCTYPE_COMBO_FLAG != 1 } {
174 set DOC_TYPE "REFMAN"
175 set DOCTYPE_COMBO_FLAG 1
176 if { [file exists [OCCDoc_GetProdRootDir]/src/VAS/Products.tcl] } {
177 set GENERATE_PRODUCTS_REFMAN "YES"
180 puts "Error: Options -refman and -overview cannot be combined."
183 # Print ignored options
184 if { ([ lsearch $args_names "pdf" ] != -1) ||
185 ([ lsearch $args_names "chm" ] != -1) ||
186 ([ lsearch $args_names "ug" ] != -1) } {
187 puts "\nInfo: The following options will be ignored: \n"
188 if { [ lsearch $args_names "pdf" ] != -1 } {
191 if { [ lsearch $args_names "chm" ] != -1 } {
194 if { [ lsearch $args_names "ug" ] != -1 } {
200 } elseif {$arg_n == "v"} {
202 } elseif {$arg_n == "update_images_size"} {
203 set UPDATE_IMAGES_SIZE "YES"
204 } elseif {$arg_n == "ug"} {
205 if { ([ lsearch $args_names "refman" ] != -1) } {
208 if {$args_values(ug) != "NULL"} {
209 set DOCFILES $args_values(ug)
211 puts "Error in argument ug."
214 # Check if all chosen docfiles are correct
215 foreach docfile $DOCFILES {
216 if { [ lsearch $args_names "pdf" ] == -1 } {
217 # Check to generate HTMLs
218 if { [lsearch $available_docfiles $docfile] == -1 } {
219 puts "Error: File \"$docfile\" is not presented in the list of available docfiles."
220 puts " Please specify the correct docfile name."
224 # Check to generate PDFs
225 if { [lsearch $available_pdf $docfile] == -1 } {
226 puts "Error: File \"$docfile\" is not presented in the list of generic PDFs."
227 puts " Please specify the correct pdf name."
232 } elseif {$arg_n == "m"} {
233 if { [ lsearch $args_names "overview" ] != -1 } {
236 if {$args_values(m) != "NULL"} {
237 set MODULES $args_values(m)
239 puts "Error in argument m."
242 } elseif {$arg_n == "s"} {
243 if { [ lsearch $args_names "pdf" ] != -1 } {
246 if {$args_values(s) != "NULL"} {
247 set SEARCH_MODE $args_values(s)
249 puts "Error in argument s."
252 } elseif {$arg_n == "mathjax"} {
253 if { [ lsearch $args_names "pdf" ] != -1 } {
254 set possible_mathjax_loc $args_values(mathjax)
255 if {[file exist [file join $possible_mathjax_loc $mathjax_js_name]]} {
256 set MATHJAX_LOCATION $args_values(mathjax)
257 puts "$MATHJAX_LOCATION"
259 puts "Warning: $mathjax_js_name is not found in $possible_mathjax_loc."
260 puts " MathJax will be used from $MATHJAX_LOCATION"
263 puts "Warning: MathJax is not used with pdf and will be ignored."
266 puts "\nWrong argument: $arg_n"
267 OCCDoc_PrintHelpMessage
272 # Check the existence of the necessary tools
279 OCCDoc_DetectNecessarySoftware $DOXYGEN_PATH $GRAPHVIZ_PATH $INKSCAPE_PATH $HHC_PATH $PDFLATEX_PATH
281 if {$DOXYGEN_PATH == ""} {
286 if {"$::tcl_platform(platform)" == "windows"} {
287 if { ($GEN_MODE == "CHM_ONLY") && ($HHC_PATH == "") } {
293 if { ($PDFLATEX_PATH == "") && ($GEN_MODE == "PDF_ONLY") } {
298 # If we do not specify list for docfiles with -m argument,
299 # we assume that we have to generate all docfiles
300 if { [llength $DOCFILES] == 0 } {
301 if { $GEN_MODE != "PDF_ONLY" } {
302 set DOCFILES $available_docfiles
304 set DOCFILES $available_pdf
311 set DOXYLOG [OCCDoc_GetRootDir]/doc/doxygen_warnings_and_errors.log
312 set PDFLOG [OCCDoc_GetRootDir]/doc/pdflatex_warnings_and_errors.log
314 file delete -force $PDFLOG
315 file delete -force $DOXYLOG
317 # Start main activities
318 if { $GEN_MODE != "PDF_ONLY" } {
319 if { [OCCDoc_GetProdRootDir] == ""} {
320 OCCDoc_Main $DOC_TYPE $DOCFILES $MODULES $GEN_MODE $VERB_MODE $UPDATE_IMAGES_SIZE $SEARCH_MODE $MATHJAX_LOCATION $GENERATE_PRODUCTS_REFMAN $DOXYGEN_PATH $GRAPHVIZ_PATH $INKSCAPE_PATH $HHC_PATH
322 if { $DOC_TYPE == "REFMAN" } {
323 if { $MODULES != "" } {
324 foreach module $MODULES {
325 OCCDoc_Main $DOC_TYPE $DOCFILES $module $GEN_MODE $VERB_MODE $UPDATE_IMAGES_SIZE $SEARCH_MODE $MATHJAX_LOCATION $GENERATE_PRODUCTS_REFMAN $DOXYGEN_PATH $GRAPHVIZ_PATH $INKSCAPE_PATH $HHC_PATH
328 OCCDoc_Main $DOC_TYPE $DOCFILES $MODULES $GEN_MODE $VERB_MODE $UPDATE_IMAGES_SIZE $SEARCH_MODE $MATHJAX_LOCATION $GENERATE_PRODUCTS_REFMAN $DOXYGEN_PATH $GRAPHVIZ_PATH $INKSCAPE_PATH $HHC_PATH
331 foreach md $DOCFILES {
332 OCCDoc_Main $DOC_TYPE $md $MODULES $GEN_MODE $VERB_MODE $UPDATE_IMAGES_SIZE $SEARCH_MODE $MATHJAX_LOCATION $GENERATE_PRODUCTS_REFMAN $DOXYGEN_PATH $GRAPHVIZ_PATH $INKSCAPE_PATH $HHC_PATH
337 puts "Generating OCCT User Guides in PDF format...\n"
338 foreach pdf $DOCFILES {
340 puts "Info: Processing file $pdf\n"
342 # Some values are hardcoded because they are related only to PDF generation
343 OCCDoc_Main "OVERVIEW" [list $pdf] {} "PDF_ONLY" $VERB_MODE $UPDATE_IMAGES_SIZE "none" $MATHJAX_LOCATION "NO" $DOXYGEN_PATH $GRAPHVIZ_PATH $INKSCAPE_PATH $HHC_PATH
345 puts "[clock format [clock seconds] -format {%Y-%m-%d %H:%M}] Generation completed."
349 # Main procedure for documents compilation
350 proc OCCDoc_Main {docType {docfiles {}} {modules {}} generatorMode verboseMode updateImagesSize searchMode mathjaxLocation generateProductsRefman DOXYGEN_PATH GRAPHVIZ_PATH INKSCAPE_PATH HHC_PATH} {
352 global available_docfiles
355 set ROOTDIR [OCCDoc_GetRootDir [OCCDoc_GetProdRootDir]]
356 set INDIR [OCCDoc_GetDoxDir]
357 set OUTDIR $ROOTDIR/doc
358 set PDFDIR $OUTDIR/pdf
359 set UGDIR $PDFDIR/user_guides
360 set DGDIR $PDFDIR/dev_guides
361 set TAGFILEDIR $OUTDIR/refman
362 set HTMLDIR $OUTDIR/overview/html
363 set LATEXDIR $OUTDIR/overview/latex
364 set DOXYFILE $OUTDIR/OCCT.cfg
366 # OUTDIR for products documentation should be separate directories for each components
367 if { [OCCDoc_GetProdRootDir] != ""} {
368 if { $docType == "REFMAN" } {
369 if { "$modules" != "" } {
370 source "[OCCDoc_GetSourceDir [OCCDoc_GetProdRootDir]]/VAS/${modules}.tcl"
371 set doc_component_name [${modules}:documentation_name]
372 set OUTDIR $OUTDIR/$doc_component_name
375 if {[regexp {([^/]+)/([^/]+)/([^/]+)} $docfiles dump doc_type doc_component doc_name]} {
376 set PDFNAME [file rootname $doc_name]
377 set OUTDIR $OUTDIR/$doc_component
379 error "Could not parse input path to *.md file: \"${docfiles}\""
382 set HTMLDIR $OUTDIR/html
383 set LATEXDIR $OUTDIR/latex
384 set DOXYFILE $OUTDIR/OCCT.cfg
385 set TAGFILEDIR $OUTDIR/refman
388 # Create or cleanup the output folders
389 if { [string compare -nocase $generateProductsRefman "YES"] != 0 } {
390 if { ![file exists $OUTDIR] } {
393 if { ![file exists $HTMLDIR] } {
396 if { [OCCDoc_GetProdRootDir] == ""} {
397 if { ![file exists $PDFDIR] } {
400 if { ![file exists $UGDIR] } {
403 if { ![file exists $DGDIR] } {
408 if { $generatorMode == "PDF_ONLY" } {
409 if { [file exists $LATEXDIR] } {
410 file delete -force $LATEXDIR
415 if { $docType == "REFMAN" } {
416 if { ![file exists $TAGFILEDIR] } {
417 file mkdir $TAGFILEDIR
422 set mathjax_relative_location $mathjaxLocation
423 if { [file isdirectory "$mathjaxLocation"] } {
424 if { $generatorMode == "HTML_ONLY" } {
426 set mathjax_relative_location [OCCDoc_GetRelPath $HTMLDIR $mathjaxLocation]
427 } elseif { $generatorMode == "CHM_ONLY" } {
429 set mathjax_relative_location [file normalize $mathjaxLocation]
433 if { $generateProductsRefman == "YES" } {
434 set DOCDIR "$OUTDIR/refman"
435 puts "\nGenerating OCC Products Reference Manual\n"
437 if { $docType == "REFMAN"} {
438 set DOCDIR "$OUTDIR/refman"
439 puts "\nGenerating Open CASCADE Reference Manual\n"
440 } elseif { $docType == "OVERVIEW" } {
441 if { [OCCDoc_GetProdRootDir] == ""} {
442 set DOCDIR "$OUTDIR/overview"
447 if { ($generatorMode == "HTML_ONLY") || ($generatorMode == "CHM_ONLY") } {
448 if { $generatorMode == "HTML_ONLY" } {
449 set FORMAT " in HTML format..."
450 } elseif { $generatorMode == "CHM_ONLY" } {
451 set FORMAT " in CHM format..."
453 puts "Generating OCCT User Guides$FORMAT\n"
456 puts "Error: Invalid documentation type: $docType. Can not process."
462 puts "[clock format [clock seconds] -format {%Y-%m-%d %H:%M}] Generating Doxyfile..."
464 if { [OCCDoc_MakeDoxyfile $docType $DOCDIR $TAGFILEDIR $DOXYFILE $generatorMode $docfiles $modules $verboseMode $searchMode $HHC_PATH $mathjax_relative_location $GRAPHVIZ_PATH [OCCDoc_GetProdRootDir]] == -1 } {
468 # update image sizes in *.md files if necessary
469 if { ("$::tcl_platform(platform)" == "windows") &&
470 ($updateImagesSize == "YES") } {
471 if { [OCCDoc_UpdateImagesSize $docfiles [OCCDoc_GetDoxDir [OCCDoc_GetProdRootDir]] $verboseMode] == -1 } {
477 set starttimestamp [clock format [clock seconds] -format {%Y-%m-%d %H:%M}]
479 if { ($generatorMode == "HTML_ONLY") || ($docType == "REFMAN") } {
480 puts "$starttimestamp Generating HTML files..."
482 # Copy index file to provide fast access to HTML documentation
483 file copy -force $INDIR/resources/index.html $DOCDIR/index.html
484 } elseif { $generatorMode == "CHM_ONLY" } {
485 puts "$starttimestamp Generating CHM file..."
486 } elseif { $generatorMode == "PDF_ONLY" } {
487 puts "$starttimestamp Generating PDF file..."
490 set DOXYLOG $OUTDIR/doxygen_warnings_and_errors.log
491 set RESULT [catch {exec $DOXYGEN_PATH $DOXYFILE >> $OUTDIR/doxygen_out.log} DOX_ERROR]
493 set NbErrors [regexp -all -line {^\s*[^\s]+} $DOX_ERROR]
495 puts "\nWarning: Doxygen reported $NbErrors messages."
496 puts "See log in $DOXYLOG\n"
497 set DOX_ERROR_FILE [open $DOXYLOG "a"]
498 if {$generatorMode == "PDF_ONLY"} {
499 puts $DOX_ERROR_FILE "\n===================================================="
500 puts $DOX_ERROR_FILE "Logfile for $docfiles"
501 puts $DOX_ERROR_FILE "====================================================\n"
503 puts $DOX_ERROR_FILE $DOX_ERROR
504 close $DOX_ERROR_FILE
508 # Close the Doxygen application
511 # Start Post Processing
512 set curtime [clock format [clock seconds] -format {%Y-%m-%d %H:%M}]
513 if { $docType == "REFMAN" } {
514 # Post Process generated HTML pages and draw dependency graphs
515 if {[OCCDoc_PostProcessor $DOCDIR] == 0} {
516 puts "$curtime Generation completed."
517 puts "\nInfo: doxygen log file is located in:"
518 puts "$OUTDIR/doxygen_out.log."
519 puts "\nReference Manual is generated in \n$DOCDIR"
521 } elseif { $docType == "OVERVIEW" } {
522 # Start PDF generation routine
523 if { $generatorMode == "PDF_ONLY" } {
524 set OS $::tcl_platform(platform)
525 if { $OS == "unix" } {
527 } elseif { $OS == "windows" } {
531 # Prepare a list of TeX files, generated by Doxygen
534 set TEXFILES [glob $LATEXDIR -type f -directory $LATEXDIR -tails "*.tex" ]
535 foreach path $TEXFILES {
536 if { [string compare -nocase $path $LATEXDIR] == 0 } {
537 set DEL_IDX [lsearch $TEXFILES $path]
538 if { $DEL_IDX != -1 } {
539 set TEXFILES [lreplace $TEXFILES $DEL_IDX $DEL_IDX]
543 set TEXFILES [string map [list refman.tex ""] $TEXFILES]
544 if {$verboseMode == "YES"} {
545 puts "Info: Preprocessing generated TeX files..."
547 OCCDoc_ProcessTex $TEXFILES $LATEXDIR $verboseMode
549 if {$verboseMode == "YES"} {
550 puts "Info: Converting SVG images to PNG format..."
553 if { $INKSCAPE_PATH != "" } {
554 OCCDoc_ProcessSvg $LATEXDIR $verboseMode
556 puts "Warning: SVG images will be lost in PDF documents."
559 if {$verboseMode == "YES"} {
560 puts "Info: Generating PDF file from TeX files..."
562 foreach TEX $TEXFILES {
563 # Rewrite existing REFMAN.tex file...
564 set TEX [lindex [split $TEX "."] 0]
566 if {$verboseMode == "YES"} {
567 puts "Info: Generating PDF file from $TEX..."
570 OCCDoc_MakeRefmanTex $TEX $LATEXDIR $verboseMode $available_pdf
572 if {"$::tcl_platform(platform)" == "windows"} {
577 if {$verboseMode == "YES"} {
578 # ...and use it to generate PDF from TeX...
579 if {$is_win == "yes"} {
580 puts "Info: Executing $LATEXDIR/make.bat..."
582 puts "Info: Executing $LATEXDIR/Makefile..."
585 set PDFLOG $OUTDIR/pdflatex_warnings_and_errors.log
587 if {"$is_win" == "yes"} {
588 set RESULT [catch {eval exec [auto_execok $LATEXDIR/make.bat] >> "$OUTDIR/pdflatex_out.log"} LaTeX_ERROR]
590 set RESULT [catch {eval exec "make -f $LATEXDIR/Makefile" >> "$OUTDIR/pdflatex_out.log"} LaTeX_ERROR]
592 # Small workaround for *nix stations
595 set RESULT [catch {eval exec "pdflatex refman.tex" >> "$OUTDIR/pdflatex_out.log"} LaTeX_ERROR]
600 set NbErrors [regexp -all -line {^\s*[^\s]+} $LaTeX_ERROR]
602 puts "\nWarning: PDFLaTeX reported $NbErrors messages.\nSee log in $PDFLOG\n"
603 set LaTeX_ERROR_FILE [open $PDFLOG "a"]
604 puts $LaTeX_ERROR_FILE "\n===================================================="
605 puts $LaTeX_ERROR_FILE "Logfile of file $TEX:"
606 puts $LaTeX_ERROR_FILE "====================================================\n"
607 puts $LaTeX_ERROR_FILE $LaTeX_ERROR
608 close $LaTeX_ERROR_FILE
612 # ...and place it to the specific folder
613 if {![file exists "$LATEXDIR/refman.pdf"]} {
614 puts "Fatal: PDFLaTeX failed to create output file, stopping!"
618 set destFolder $PDFDIR
619 set parsed_string [split $TEX "_"]
620 if { [OCCDoc_GetProdRootDir] == ""} {
621 if { [lsearch $parsed_string "tutorial"] != -1 } {
622 set TEX [string map [list occt__ occt_] $TEX]
623 set destFolder $PDFDIR
624 } elseif { [lsearch $parsed_string "user"] != -1 } {
625 set TEX [string map [list user_guides__ ""] $TEX]
626 set destFolder $UGDIR
627 } elseif { [lsearch $parsed_string "dev"] != -1 } {
628 set TEX [string map [list dev_guides__ ""] $TEX]
629 set destFolder $DGDIR
632 set destFolder $OUTDIR
635 file rename -force $LATEXDIR/refman.pdf "$destFolder/$TEX.pdf"
637 } elseif { $generatorMode == "CHM_ONLY" } {
638 if { [OCCDoc_GetProdRootDir] == ""} {
639 file rename $OUTDIR/overview.chm $OUTDIR/occt_overview.chm
641 file rename -force $ROOTDIR/doc/overview.chm $OUTDIR/occt_overview.chm
646 if { $generatorMode == "HTML_ONLY" } {
647 puts "\nHTML documentation is generated in \n$DOCDIR"
649 if { $generatorMode == "CHM_ONLY" } {
650 puts "\nGenerated CHM documentation is in \n$OUTDIR/overview.chm"
656 # Remove temporary Doxygen files
657 set deleteList [glob -nocomplain -type f "*.tmp"]
658 foreach file $deleteList {
662 puts "\nPDF files are generated in \n[file normalize $OUTDIR]"
667 # Generates Doxygen configuration file for Overview documentation
668 proc OCCDoc_MakeDoxyfile {docType outDir tagFileDir {doxyFileName} {generatorMode ""} {DocFilesList {}} {ModulesList {}} verboseMode searchMode hhcPath mathjaxLocation graphvizPath productsPath} {
669 set inputDir [OCCDoc_GetDoxDir [OCCDoc_GetProdRootDir]]
671 set TEMPLATES_DIR [OCCDoc_GetDoxDir]/resources
672 set occt_version [OCCDoc_DetectCasVersion]
674 # Delete existent doxyfile
675 file delete $doxyFileName
677 # Copy specific template to the target folder
678 if { $docType == "REFMAN" } {
679 file copy "$TEMPLATES_DIR/occt_rm.doxyfile" $doxyFileName
680 } elseif { $docType == "OVERVIEW" } {
681 if { $generatorMode == "HTML_ONLY" || $generatorMode == "CHM_ONLY" } {
682 file copy "$TEMPLATES_DIR/occt_ug_html.doxyfile" $doxyFileName
683 } elseif { $generatorMode == "PDF_ONLY"} {
684 file copy "$TEMPLATES_DIR/occt_ug_pdf.doxyfile" $doxyFileName
686 puts "Error: Unknown generation mode"
690 puts "Error: Cannot generate unknown document type"
694 set doxyFile [open $doxyFileName "a"]
695 # Write specific options
696 if { $docType == "REFMAN" } {
698 # Load lists of modules scripts
699 if { $productsPath == "" } {
700 set modules_scripts [glob -nocomplain -type f -directory "[OCCDoc_GetSourceDir $productsPath]/OS/" *.tcl]
702 set modules_scripts [glob -nocomplain -type f -directory "[OCCDoc_GetSourceDir $productsPath]/VAS/" *.tcl]
704 if { [llength $modules_scripts] != 0} {
705 foreach module_file $modules_scripts {
710 set ALL_MODULES [OCCDoc_GetModulesList $productsPath]
711 if { [llength $ModulesList] == 0 } {
712 # by default take all modules
713 set modules $ALL_MODULES
715 set modules $ModulesList
718 # Detect invalid names of modules
719 foreach module $modules {
720 if { $module == "" } {
723 if {[lsearch $ALL_MODULES $module] == -1 } {
724 puts "Error: No module $module is known. Aborting..."
730 set one_module [expr [llength $modules] == 1]
732 set title "OCCT [$modules:name]"
735 set title "Open CASCADE Technology"
739 # Get list of header files in the specified modules
741 foreach module $modules {
742 if { $module == "" } {
745 foreach tk [$module:toolkits] {
746 foreach pk [split [OCCDoc_GetPackagesList [OCCDoc_Locate $tk $productsPath]]] {
747 if { [llength $pk] != "{}" } {
748 lappend filelist [OCCDoc_GetHeadersList "p" "$pk" "$productsPath"]
754 # Filter out files Handle_*.hxx and *.lxx
756 foreach fileset $filelist {
758 foreach hdr $fileset {
759 if { ! [regexp {Handle_.*[.]hxx} $hdr] && ! [regexp {.*[.]lxx} $hdr] } {
763 lappend hdrlist $hdrset
765 set filelist $hdrlist
767 set doxyFile [open $doxyFileName "a"]
769 puts $doxyFile "PROJECT_NAME = \"$title\""
770 puts $doxyFile "PROJECT_NUMBER = $occt_version"
771 puts $doxyFile "OUTPUT_DIRECTORY = $outDir/."
772 puts $doxyFile "GENERATE_TAGFILE = $outDir/${name}.tag"
774 if { [string tolower $searchMode] == "none" } {
775 puts $doxyFile "SEARCHENGINE = NO"
776 puts $doxyFile "SERVER_BASED_SEARCH = NO"
777 puts $doxyFile "EXTERNAL_SEARCH = NO"
779 puts $doxyFile "SEARCHENGINE = YES"
780 if { [string tolower $searchMode] == "local" } {
781 puts $doxyFile "SERVER_BASED_SEARCH = NO"
782 puts $doxyFile "EXTERNAL_SEARCH = NO"
783 } elseif { [string tolower $searchMode] == "server" } {
784 puts $doxyFile "SERVER_BASED_SEARCH = YES"
785 puts $doxyFile "EXTERNAL_SEARCH = NO"
786 } elseif { [string tolower $searchMode] == "external" } {
787 puts $doxyFile "SERVER_BASED_SEARCH = YES"
788 puts $doxyFile "EXTERNAL_SEARCH = YES"
790 puts "Error: Wrong search engine type: $searchMode."
796 puts $doxyFile "DOTFILE_DIRS = $outDir/html"
797 puts $doxyFile "DOT_PATH = $graphvizPath"
798 puts $doxyFile "INCLUDE_PATH = [OCCDoc_GetSourceDir $productsPath]"
800 # list of files to generate
801 set mainpage [OCCDoc_MakeMainPage $outDir $outDir/$name.dox $modules $productsPath]
803 puts $doxyFile "INPUT = $mainpage \\"
804 foreach header $filelist {
805 puts $doxyFile " $header \\"
808 puts $doxyFile "MATHJAX_FORMAT = HTML-CSS"
809 puts $doxyFile "MATHJAX_RELPATH = ${mathjaxLocation}"
813 } elseif { $docType == "OVERVIEW" } {
815 # Add common options for generation of Overview and User Guides
816 puts $doxyFile "PROJECT_NUMBER = $occt_version"
817 puts $doxyFile "OUTPUT_DIRECTORY = $outDir/."
818 puts $doxyFile "PROJECT_LOGO = [OCCDoc_GetDoxDir]/resources/occ_logo.png"
820 set PARAM_INPUT "INPUT ="
821 set PARAM_IMAGEPATH "IMAGE_PATH = [OCCDoc_GetDoxDir]/resources/ "
822 foreach docFile $DocFilesList {
823 set NEW_IMG_PATH "$inputDir/$docFile"
824 if { [string compare $NEW_IMG_PATH [OCCDoc_GetRootDir $productsPath]] != 0 } {
825 set img_string [file dirname $NEW_IMG_PATH]/images
826 if { [file exists $img_string] } {
827 append PARAM_IMAGEPATH " $img_string"
830 append PARAM_INPUT " " $inputDir/$docFile
832 puts $doxyFile $PARAM_INPUT
833 puts $doxyFile $PARAM_IMAGEPATH
835 # Add document type-specific options
836 if { $generatorMode == "HTML_ONLY"} {
838 puts $doxyFile "GENERATE_TREEVIEW = YES"
840 # Set a reference to a TAGFILE
841 if { $tagFileDir != "" } {
842 if {[file exists $tagFileDir/OCCT.tag] == 1} {
843 #set tagPath [OCCDoc_GetRelPath $tagFileDir $outDir/html]
844 set tagPath $tagFileDir
845 puts $doxyFile "TAGFILES = $tagFileDir/OCCT.tag=../../refman/html"
848 # HTML Search engine options
849 if { [string tolower $searchMode] == "none" } {
850 puts $doxyFile "SEARCHENGINE = NO"
851 puts $doxyFile "SERVER_BASED_SEARCH = NO"
852 puts $doxyFile "EXTERNAL_SEARCH = NO"
854 puts $doxyFile "SEARCHENGINE = YES"
855 if { [string tolower $searchMode] == "local" } {
856 puts $doxyFile "SERVER_BASED_SEARCH = NO"
857 puts $doxyFile "EXTERNAL_SEARCH = NO"
858 } elseif { [string tolower $searchMode] == "server" } {
859 puts $doxyFile "SERVER_BASED_SEARCH = YES"
860 puts $doxyFile "EXTERNAL_SEARCH = NO"
861 } elseif { [string tolower $searchMode] == "external" } {
862 puts $doxyFile "SERVER_BASED_SEARCH = YES"
863 puts $doxyFile "EXTERNAL_SEARCH = YES"
865 puts "Error: Wrong search engine type: $searchMode."
870 } elseif { $generatorMode == "CHM_ONLY"} {
871 # specific options for CHM file generation
872 puts $doxyFile "GENERATE_TREEVIEW = NO"
873 puts $doxyFile "SEARCHENGINE = NO"
874 puts $doxyFile "GENERATE_HTMLHELP = YES"
875 puts $doxyFile "CHM_FILE = ../../overview.chm"
876 puts $doxyFile "HHC_LOCATION = \"$hhcPath\""
877 puts $doxyFile "DISABLE_INDEX = YES"
881 puts $doxyFile "MATHJAX_RELPATH = ${mathjaxLocation}"