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>\]"
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"
62 # A command for User Documentation compilation
67 set GEN_MODE "HTML_ONLY"
72 set SEARCH_MODE "none"
73 set MATHJAX_LOCATION "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1"
74 set mathjax_js_name "MathJax.js"
75 set DOCTYPE_COMBO_FLAG 0
76 set GENMODE_COMBO_FLAG 0
77 set GENERATE_PRODUCTS_REFMAN "NO"
79 global available_docfiles; # The full list of md files for HTML or CHM generation
80 global available_pdf; # The full list of md files for PDF generation
86 # Load list of docfiles
87 if { [OCCDoc_LoadFilesList] != 0 } {
88 puts "Error: File FILES_HTML.txt or FILES_PDF.txt was not found on this computer.\nAborting..."
93 if {[OCCDoc_ParseArguments $args] == 1} {
97 # Print help message if no arguments provided
98 if {[llength $args_names] == 0} {
99 OCCDoc_PrintHelpMessage
103 foreach arg_n $args_names {
105 OCCDoc_PrintHelpMessage
107 } elseif {$arg_n == "html"} {
108 if { ([ lsearch $args_names "refman" ] == -1) &&
109 ([ lsearch $args_names "overview" ] == -1) } {
110 puts "Warning: Please specify -refman or -overview argument."
113 if { [ lsearch $args_names "refman" ] != -1 } {
116 if { $GENMODE_COMBO_FLAG != 1 } {
117 set GEN_MODE "HTML_ONLY"
118 set GENMODE_COMBO_FLAG 1
120 puts "Error: Options -html, -pdf and -chm can not be combined."
123 } elseif {$arg_n == "chm"} {
124 if { ([ lsearch $args_names "refman" ] == -1) &&
125 ([ lsearch $args_names "overview" ] == -1) } {
126 puts "Warning: Please specify -refman or -overview argument."
129 if { [ lsearch $args_names "refman" ] != -1 } {
132 if { $GENMODE_COMBO_FLAG != 1 } {
133 set GEN_MODE "CHM_ONLY"
134 set GENMODE_COMBO_FLAG 1
136 puts "Error: Options -html, -pdf and -chm cannot be combined."
139 } elseif {$arg_n == "pdf"} {
140 if { ([ lsearch $args_names "refman" ] == -1) &&
141 ([ lsearch $args_names "overview" ] == -1) } {
142 puts "Warning: Please specify -refman or -overview argument."
145 if { [ lsearch $args_names "refman" ] != -1 } {
148 if { $GENMODE_COMBO_FLAG != 1 } {
149 set GEN_MODE "PDF_ONLY"
150 set GENMODE_COMBO_FLAG 1
152 puts "Error: Options -html, -pdf and -chm cannot be combined."
155 } elseif {$arg_n == "overview"} {
156 if { $DOCTYPE_COMBO_FLAG != 1 } {
157 set DOC_TYPE "OVERVIEW"
158 set DOCTYPE_COMBO_FLAG 1
160 puts "Error: Options -refman and -overview cannot be combined."
164 # Print ignored options
165 if { [ lsearch $args_names "m" ] != -1 } {
166 puts "\nInfo: The following options will be ignored: \n"
170 } elseif {$arg_n == "refman"} {
171 if { $DOCTYPE_COMBO_FLAG != 1 } {
172 set DOC_TYPE "REFMAN"
173 set DOCTYPE_COMBO_FLAG 1
174 if { [file exists [OCCDoc_GetProdRootDir]/src/VAS/Products.tcl] } {
175 set GENERATE_PRODUCTS_REFMAN "YES"
178 puts "Error: Options -refman and -overview cannot be combined."
181 # Print ignored options
182 if { ([ lsearch $args_names "pdf" ] != -1) ||
183 ([ lsearch $args_names "chm" ] != -1) ||
184 ([ lsearch $args_names "ug" ] != -1) } {
185 puts "\nInfo: The following options will be ignored: \n"
186 if { [ lsearch $args_names "pdf" ] != -1 } {
189 if { [ lsearch $args_names "chm" ] != -1 } {
192 if { [ lsearch $args_names "ug" ] != -1 } {
198 } elseif {$arg_n == "v"} {
200 } elseif {$arg_n == "ug"} {
201 if { ([ lsearch $args_names "refman" ] != -1) } {
204 if {$args_values(ug) != "NULL"} {
205 set DOCFILES $args_values(ug)
207 puts "Error in argument ug."
210 # Check if all chosen docfiles are correct
211 foreach docfile $DOCFILES {
212 if { [ lsearch $args_names "pdf" ] == -1 } {
213 # Check to generate HTMLs
214 if { [lsearch $available_docfiles $docfile] == -1 } {
215 puts "Error: File \"$docfile\" is not presented in the list of available docfiles."
216 puts " Please specify the correct docfile name."
220 # Check to generate PDFs
221 if { [lsearch $available_pdf $docfile] == -1 } {
222 puts "Error: File \"$docfile\" is not presented in the list of generic PDFs."
223 puts " Please specify the correct pdf name."
228 } elseif {$arg_n == "m"} {
229 if { [ lsearch $args_names "overview" ] != -1 } {
232 if {$args_values(m) != "NULL"} {
233 set MODULES $args_values(m)
235 puts "Error in argument m."
238 } elseif {$arg_n == "s"} {
239 if { [ lsearch $args_names "pdf" ] != -1 } {
242 if {$args_values(s) != "NULL"} {
243 set SEARCH_MODE $args_values(s)
245 puts "Error in argument s."
248 } elseif {$arg_n == "mathjax"} {
249 if { [ lsearch $args_names "pdf" ] != -1 } {
250 set possible_mathjax_loc $args_values(mathjax)
251 if {[file exist [file join $possible_mathjax_loc $mathjax_js_name]]} {
252 set MATHJAX_LOCATION $args_values(mathjax)
253 puts "$MATHJAX_LOCATION"
255 puts "Warning: $mathjax_js_name is not found in $possible_mathjax_loc."
256 puts " MathJax will be used from $MATHJAX_LOCATION"
259 puts "Warning: MathJax is not used with pdf and will be ignored."
262 puts "\nWrong argument: $arg_n"
263 OCCDoc_PrintHelpMessage
268 # Check the existence of the necessary tools
275 OCCDoc_DetectNecessarySoftware $DOXYGEN_PATH $GRAPHVIZ_PATH $INKSCAPE_PATH $HHC_PATH $PDFLATEX_PATH
277 if {$DOXYGEN_PATH == ""} {
282 if {"$::tcl_platform(platform)" == "windows"} {
283 if { ($GEN_MODE == "CHM_ONLY") && ($HHC_PATH == "") } {
289 if { ($PDFLATEX_PATH == "") && ($GEN_MODE == "PDF_ONLY") } {
294 # If we do not specify list for docfiles with -m argument,
295 # we assume that we have to generate all docfiles
296 if { [llength $DOCFILES] == 0 } {
297 if { $GEN_MODE != "PDF_ONLY" } {
298 set DOCFILES $available_docfiles
300 set DOCFILES $available_pdf
306 # Start main activities
307 if { $GEN_MODE != "PDF_ONLY" } {
308 if { [OCCDoc_GetProdRootDir] == ""} {
309 OCCDoc_Main $DOC_TYPE $DOCFILES $MODULES $GEN_MODE $VERB_MODE $SEARCH_MODE $MATHJAX_LOCATION $GENERATE_PRODUCTS_REFMAN $DOXYGEN_PATH $GRAPHVIZ_PATH $INKSCAPE_PATH $HHC_PATH
311 if { $DOC_TYPE == "REFMAN" } {
312 if { $MODULES != "" } {
313 foreach module $MODULES {
314 OCCDoc_Main $DOC_TYPE $DOCFILES $module $GEN_MODE $VERB_MODE $SEARCH_MODE $MATHJAX_LOCATION $GENERATE_PRODUCTS_REFMAN $DOXYGEN_PATH $GRAPHVIZ_PATH $INKSCAPE_PATH $HHC_PATH
317 OCCDoc_Main $DOC_TYPE $DOCFILES $MODULES $GEN_MODE $VERB_MODE $SEARCH_MODE $MATHJAX_LOCATION $GENERATE_PRODUCTS_REFMAN $DOXYGEN_PATH $GRAPHVIZ_PATH $INKSCAPE_PATH $HHC_PATH
320 foreach md $DOCFILES {
321 OCCDoc_Main $DOC_TYPE $md $MODULES $GEN_MODE $VERB_MODE $SEARCH_MODE $MATHJAX_LOCATION $GENERATE_PRODUCTS_REFMAN $DOXYGEN_PATH $GRAPHVIZ_PATH $INKSCAPE_PATH $HHC_PATH
326 puts "Generating OCCT User Guides in PDF format..."
327 foreach pdf $DOCFILES {
329 puts "\nInfo: Processing file $pdf"
331 # Some values are hardcoded because they are related only to PDF generation
332 OCCDoc_Main "OVERVIEW" [list $pdf] {} "PDF_ONLY" $VERB_MODE "none" $MATHJAX_LOCATION "NO" $DOXYGEN_PATH $GRAPHVIZ_PATH $INKSCAPE_PATH $HHC_PATH
334 puts "\n[clock format [clock seconds] -format {%Y-%m-%d %H:%M}] Generation completed."
338 # Main procedure for documents compilation
339 proc OCCDoc_Main {docType {docfiles {}} {modules {}} generatorMode verboseMode searchMode mathjaxLocation generateProductsRefman DOXYGEN_PATH GRAPHVIZ_PATH INKSCAPE_PATH HHC_PATH} {
341 global available_docfiles
344 set ROOTDIR [OCCDoc_GetRootDir [OCCDoc_GetProdRootDir]]
345 set INDIR [OCCDoc_GetDoxDir]
346 set OUTDIR $ROOTDIR/doc
347 set PDFDIR $OUTDIR/pdf
348 set UGDIR $PDFDIR/user_guides
349 set DGDIR $PDFDIR/dev_guides
350 set TAGFILEDIR $OUTDIR/refman
351 set HTMLDIR $OUTDIR/overview/html
352 set LATEXDIR $OUTDIR/overview/latex
353 set DOXYFILE $OUTDIR/OCCT.cfg
355 # OUTDIR for products documentation should be separate directories for each components
356 if { [OCCDoc_GetProdRootDir] != ""} {
357 if { $docType == "REFMAN" } {
358 if { "$modules" != "" } {
359 source "[OCCDoc_GetSourceDir [OCCDoc_GetProdRootDir]]/VAS/${modules}.tcl"
360 set doc_component_name [${modules}:documentation_name]
361 set OUTDIR $OUTDIR/$doc_component_name
364 if {[regexp {([^/]+)/([^/]+)/([^/]+)} $docfiles dump doc_type doc_component doc_name]} {
365 set PDFNAME [file rootname $doc_name]
366 set OUTDIR $OUTDIR/$doc_component
368 error "Could not parse input path to *.md file: \"${docfiles}\""
371 set HTMLDIR $OUTDIR/html
372 set LATEXDIR $OUTDIR/latex
373 set DOXYFILE $OUTDIR/OCCT.cfg
374 set TAGFILEDIR $OUTDIR/refman
377 # Create or cleanup the output folders
378 if { [string compare -nocase $generateProductsRefman "YES"] != 0 } {
379 if { ![file exists $OUTDIR] } {
382 if { ![file exists $HTMLDIR] } {
385 if { [OCCDoc_GetProdRootDir] == ""} {
386 if { ![file exists $PDFDIR] } {
389 if { ![file exists $UGDIR] } {
392 if { ![file exists $DGDIR] } {
397 if { $generatorMode == "PDF_ONLY" } {
398 if { [file exists $LATEXDIR] } {
399 file delete -force $LATEXDIR
404 if { $docType == "REFMAN" } {
405 if { ![file exists $TAGFILEDIR] } {
406 file mkdir $TAGFILEDIR
411 set mathjax_relative_location $mathjaxLocation
412 if { [file isdirectory "$mathjaxLocation"] } {
413 if { $generatorMode == "HTML_ONLY" } {
415 set mathjax_relative_location [OCCDoc_GetRelPath $HTMLDIR $mathjaxLocation]
416 } elseif { $generatorMode == "CHM_ONLY" } {
418 set mathjax_relative_location [file normalize $mathjaxLocation]
422 if { $generateProductsRefman == "YES" } {
423 set DOCDIR "$OUTDIR/refman"
424 puts "\nGenerating OCC Products Reference Manual\n"
426 if { $docType == "REFMAN"} {
427 set DOCDIR "$OUTDIR/refman"
428 puts "\nGenerating Open CASCADE Reference Manual\n"
429 } elseif { $docType == "OVERVIEW" } {
430 if { [OCCDoc_GetProdRootDir] == ""} {
431 set DOCDIR "$OUTDIR/overview"
436 if { ($generatorMode == "HTML_ONLY") || ($generatorMode == "CHM_ONLY") } {
437 if { $generatorMode == "HTML_ONLY" } {
438 set FORMAT " in HTML format..."
439 } elseif { $generatorMode == "CHM_ONLY" } {
440 set FORMAT " in CHM format..."
442 puts "Generating OCCT User Guides$FORMAT\n"
445 puts "Error: Invalid documentation type: $docType. Can not process."
451 puts "[clock format [clock seconds] -format {%Y-%m-%d %H:%M}] Generating Doxyfile..."
453 if { [OCCDoc_MakeDoxyfile $docType $DOCDIR $TAGFILEDIR $DOXYFILE $generatorMode $docfiles $modules $verboseMode $searchMode $HHC_PATH $mathjax_relative_location $GRAPHVIZ_PATH [OCCDoc_GetProdRootDir]] == -1 } {
458 set starttimestamp [clock format [clock seconds] -format {%Y-%m-%d %H:%M}]
460 if { ($generatorMode == "HTML_ONLY") || ($docType == "REFMAN") } {
461 set LOGPREFIX "html_"
462 puts "$starttimestamp Generating HTML files..."
464 # Copy index file to provide fast access to HTML documentation
465 file copy -force $INDIR/resources/index.html $DOCDIR/index.html
466 } elseif { $generatorMode == "CHM_ONLY" } {
468 puts "$starttimestamp Generating CHM file..."
469 } elseif { $generatorMode == "PDF_ONLY" } {
470 set LOGPREFIX "[file rootname [file tail [lindex $docfiles 0]]]_"
471 puts "$starttimestamp Generating PDF file..."
475 set DOXYLOG $OUTDIR/${LOGPREFIX}doxygen_err.log
476 set DOXYOUT $OUTDIR/${LOGPREFIX}doxygen_out.log
477 file delete -force $DOXYLOG
478 file delete -force $DOXYOUT
480 set RESULT [catch {exec $DOXYGEN_PATH $DOXYFILE >> $DOXYOUT} DOX_ERROR]
482 set NbErrors [regexp -all -line {^\s*[^\s]+} $DOX_ERROR]
484 puts "Warning: Doxygen reported $NbErrors messages."
485 puts "See log in $DOXYLOG"
486 set DOX_ERROR_FILE [open $DOXYLOG "a"]
487 if {$generatorMode == "PDF_ONLY"} {
488 puts $DOX_ERROR_FILE "\n===================================================="
489 puts $DOX_ERROR_FILE "Logfile for $docfiles"
490 puts $DOX_ERROR_FILE "====================================================\n"
492 puts $DOX_ERROR_FILE $DOX_ERROR
493 close $DOX_ERROR_FILE
497 # Close the Doxygen application
500 # Start Post Processing
501 set curtime [clock format [clock seconds] -format {%Y-%m-%d %H:%M}]
502 if { $docType == "REFMAN" } {
503 # Post Process generated HTML pages and draw dependency graphs
504 if {[OCCDoc_PostProcessor $DOCDIR] == 0} {
505 puts "$curtime Generation completed."
506 puts "\nInfo: doxygen log file is located in:"
508 puts "\nReference Manual is generated in \n$DOCDIR"
510 } elseif { $docType == "OVERVIEW" } {
511 # Start PDF generation routine
512 if { $generatorMode == "PDF_ONLY" } {
513 set OS $::tcl_platform(platform)
514 if { $OS == "unix" } {
516 } elseif { $OS == "windows" } {
520 # Prepare a list of TeX files, generated by Doxygen
523 set TEXFILES [glob $LATEXDIR -type f -directory $LATEXDIR -tails "*.tex" ]
524 foreach path $TEXFILES {
525 if { [string compare -nocase $path $LATEXDIR] == 0 } {
526 set DEL_IDX [lsearch $TEXFILES $path]
527 if { $DEL_IDX != -1 } {
528 set TEXFILES [lreplace $TEXFILES $DEL_IDX $DEL_IDX]
532 set TEXFILES [string map [list refman.tex ""] $TEXFILES]
533 if {$verboseMode == "YES"} {
534 puts "Info: Preprocessing generated TeX files..."
536 OCCDoc_ProcessTex $TEXFILES $LATEXDIR $verboseMode
538 if {$verboseMode == "YES"} {
539 puts "Info: Converting SVG images to PNG format..."
542 if { $INKSCAPE_PATH != "" } {
543 OCCDoc_ProcessSvg $LATEXDIR $verboseMode
545 puts "Warning: SVG images will be lost in PDF documents."
548 if {$verboseMode == "YES"} {
549 puts "Info: Generating PDF file from TeX files..."
551 foreach TEX $TEXFILES {
552 # Rewrite existing REFMAN.tex file...
553 set TEX [lindex [split $TEX "."] 0]
555 if {$verboseMode == "YES"} {
556 puts "Info: Generating PDF file from $TEX..."
559 OCCDoc_MakeRefmanTex $TEX $LATEXDIR $verboseMode $available_pdf
561 if {"$::tcl_platform(platform)" == "windows"} {
566 if {$verboseMode == "YES"} {
567 # ...and use it to generate PDF from TeX...
568 if {$is_win == "yes"} {
569 puts "Info: Executing $LATEXDIR/make.bat..."
571 puts "Info: Executing $LATEXDIR/Makefile..."
575 set PDFLOG $OUTDIR/${LOGPREFIX}pdflatex_err.log
576 set PDFOUT $OUTDIR/${LOGPREFIX}pdflatex_out.log
577 file delete -force $PDFLOG
578 file delete -force $PDFOUT
580 if {"$is_win" == "yes"} {
581 set RESULT [catch {eval exec [auto_execok $LATEXDIR/make.bat] >> "$PDFOUT"} LaTeX_ERROR]
583 set RESULT [catch {eval exec "make -f $LATEXDIR/Makefile" >> "$PDFOUT"} LaTeX_ERROR]
585 # Small workaround for *nix stations
588 set RESULT [catch {eval exec "pdflatex refman.tex" >> "$PDFOUT"} LaTeX_ERROR]
593 set NbErrors [regexp -all -line {^\s*[^\s]+} $LaTeX_ERROR]
595 puts "Warning: PDFLaTeX reported $NbErrors messages.\nSee log in $PDFLOG"
596 set LaTeX_ERROR_FILE [open $PDFLOG "a+"]
597 puts $LaTeX_ERROR_FILE "\n===================================================="
598 puts $LaTeX_ERROR_FILE "Logfile of file $TEX:"
599 puts $LaTeX_ERROR_FILE "====================================================\n"
600 puts $LaTeX_ERROR_FILE $LaTeX_ERROR
601 close $LaTeX_ERROR_FILE
605 # ...and place it to the specific folder
606 if {![file exists "$LATEXDIR/refman.pdf"]} {
607 puts "Fatal: PDFLaTeX failed to create output file, stopping!"
611 set destFolder $PDFDIR
612 set parsed_string [split $TEX "_"]
613 if { [OCCDoc_GetProdRootDir] == ""} {
614 if { [lsearch $parsed_string "tutorial"] != -1 } {
615 set TEX [string map [list occt__ occt_] $TEX]
616 set destFolder $PDFDIR
617 } elseif { [lsearch $parsed_string "user"] != -1 } {
618 set TEX [string map [list user_guides__ ""] $TEX]
619 set destFolder $UGDIR
620 } elseif { [lsearch $parsed_string "dev"] != -1 } {
621 set TEX [string map [list dev_guides__ ""] $TEX]
622 set destFolder $DGDIR
625 set destFolder $OUTDIR
628 file rename -force $LATEXDIR/refman.pdf "$destFolder/$TEX.pdf"
629 puts "Generated $destFolder/$TEX.pdf"
631 } elseif { $generatorMode == "CHM_ONLY" } {
632 if { [OCCDoc_GetProdRootDir] == ""} {
633 file rename $OUTDIR/overview.chm $OUTDIR/occt_overview.chm
635 file rename -force $ROOTDIR/doc/overview.chm $OUTDIR/occt_overview.chm
640 if { $generatorMode == "HTML_ONLY" } {
641 puts "HTML documentation is generated in \n$DOCDIR"
642 } elseif { $generatorMode == "CHM_ONLY" } {
643 puts "Generated CHM documentation is in \n$OUTDIR/overview.chm"
647 # Remove temporary Doxygen files
648 set deleteList [glob -nocomplain -type f "*.tmp"]
649 foreach file $deleteList {
656 # Generates Doxygen configuration file for Overview documentation
657 proc OCCDoc_MakeDoxyfile {docType outDir tagFileDir {doxyFileName} {generatorMode ""} {DocFilesList {}} {ModulesList {}} verboseMode searchMode hhcPath mathjaxLocation graphvizPath productsPath} {
658 set inputDir [OCCDoc_GetDoxDir [OCCDoc_GetProdRootDir]]
660 set TEMPLATES_DIR [OCCDoc_GetDoxDir]/resources
661 set occt_version [OCCDoc_DetectCasVersion]
663 # Delete existent doxyfile
664 file delete $doxyFileName
666 # Copy specific template to the target folder
667 if { $docType == "REFMAN" } {
668 file copy "$TEMPLATES_DIR/occt_rm.doxyfile" $doxyFileName
669 } elseif { $docType == "OVERVIEW" } {
670 if { $generatorMode == "HTML_ONLY" || $generatorMode == "CHM_ONLY" } {
671 file copy "$TEMPLATES_DIR/occt_ug_html.doxyfile" $doxyFileName
672 } elseif { $generatorMode == "PDF_ONLY"} {
673 file copy "$TEMPLATES_DIR/occt_ug_pdf.doxyfile" $doxyFileName
675 puts "Error: Unknown generation mode"
679 puts "Error: Cannot generate unknown document type"
683 set doxyFile [open $doxyFileName "a"]
684 # Write specific options
685 if { $docType == "REFMAN" } {
687 # Load lists of modules scripts
688 if { $productsPath == "" } {
689 set modules_scripts [glob -nocomplain -type f -directory "[OCCDoc_GetSourceDir $productsPath]/OS/" *.tcl]
691 set modules_scripts [glob -nocomplain -type f -directory "[OCCDoc_GetSourceDir $productsPath]/VAS/" *.tcl]
693 if { [llength $modules_scripts] != 0} {
694 foreach module_file $modules_scripts {
699 set ALL_MODULES [OCCDoc_GetModulesList $productsPath]
700 if { [llength $ModulesList] == 0 } {
701 # by default take all modules
702 set modules $ALL_MODULES
704 set modules $ModulesList
707 # Detect invalid names of modules
708 foreach module $modules {
709 if { $module == "" } {
712 if {[lsearch $ALL_MODULES $module] == -1 } {
713 puts "Error: No module $module is known. Aborting..."
719 set one_module [expr [llength $modules] == 1]
721 set title "OCCT [$modules:name]"
724 set title "Open CASCADE Technology"
728 # Get list of header files in the specified modules
730 foreach module $modules {
731 if { $module == "" } {
734 foreach tk [$module:toolkits] {
735 foreach pk [split [OCCDoc_GetPackagesList [OCCDoc_Locate $tk $productsPath]]] {
736 if { [llength $pk] != "{}" } {
737 lappend filelist [OCCDoc_GetHeadersList "p" "$pk" "$productsPath"]
743 # Filter out files Handle_*.hxx and *.lxx
745 foreach fileset $filelist {
747 foreach hdr $fileset {
748 if { ! [regexp {Handle_.*[.]hxx} $hdr] && ! [regexp {.*[.]lxx} $hdr] } {
752 lappend hdrlist $hdrset
754 set filelist $hdrlist
756 set doxyFile [open $doxyFileName "a"]
758 puts $doxyFile "PROJECT_NAME = \"$title\""
759 puts $doxyFile "PROJECT_NUMBER = $occt_version"
760 puts $doxyFile "OUTPUT_DIRECTORY = $outDir/."
761 puts $doxyFile "GENERATE_TAGFILE = $outDir/${name}.tag"
763 if { [string tolower $searchMode] == "none" } {
764 puts $doxyFile "SEARCHENGINE = NO"
765 puts $doxyFile "SERVER_BASED_SEARCH = NO"
766 puts $doxyFile "EXTERNAL_SEARCH = NO"
768 puts $doxyFile "SEARCHENGINE = YES"
769 if { [string tolower $searchMode] == "local" } {
770 puts $doxyFile "SERVER_BASED_SEARCH = NO"
771 puts $doxyFile "EXTERNAL_SEARCH = NO"
772 } elseif { [string tolower $searchMode] == "server" } {
773 puts $doxyFile "SERVER_BASED_SEARCH = YES"
774 puts $doxyFile "EXTERNAL_SEARCH = NO"
775 } elseif { [string tolower $searchMode] == "external" } {
776 puts $doxyFile "SERVER_BASED_SEARCH = YES"
777 puts $doxyFile "EXTERNAL_SEARCH = YES"
779 puts "Error: Wrong search engine type: $searchMode."
785 puts $doxyFile "DOTFILE_DIRS = $outDir/html"
786 puts $doxyFile "DOT_PATH = $graphvizPath"
787 puts $doxyFile "INCLUDE_PATH = [OCCDoc_GetSourceDir $productsPath]"
789 # list of files to generate
790 set mainpage [OCCDoc_MakeMainPage $outDir $outDir/$name.dox $modules $productsPath]
792 puts $doxyFile "INPUT = $mainpage \\"
793 foreach header $filelist {
794 puts $doxyFile " $header \\"
797 puts $doxyFile "MATHJAX_FORMAT = HTML-CSS"
798 puts $doxyFile "MATHJAX_RELPATH = ${mathjaxLocation}"
802 } elseif { $docType == "OVERVIEW" } {
804 # Add common options for generation of Overview and User Guides
805 puts $doxyFile "PROJECT_NUMBER = $occt_version"
806 puts $doxyFile "OUTPUT_DIRECTORY = $outDir/."
807 puts $doxyFile "PROJECT_LOGO = [OCCDoc_GetDoxDir]/resources/occ_logo.png"
809 set PARAM_INPUT "INPUT ="
810 set PARAM_IMAGEPATH "IMAGE_PATH = [OCCDoc_GetDoxDir]/resources/ "
811 foreach docFile $DocFilesList {
812 set NEW_IMG_PATH "$inputDir/$docFile"
813 if { [string compare $NEW_IMG_PATH [OCCDoc_GetRootDir $productsPath]] != 0 } {
814 set img_string [file dirname $NEW_IMG_PATH]/images
815 if { [file exists $img_string] } {
816 append PARAM_IMAGEPATH " $img_string"
819 append PARAM_INPUT " " $inputDir/$docFile
821 puts $doxyFile $PARAM_INPUT
822 puts $doxyFile $PARAM_IMAGEPATH
824 # Add document type-specific options
825 if { $generatorMode == "HTML_ONLY"} {
827 puts $doxyFile "GENERATE_TREEVIEW = YES"
829 # Set a reference to a TAGFILE
830 if { $tagFileDir != "" } {
831 if {[file exists $tagFileDir/OCCT.tag] == 1} {
832 #set tagPath [OCCDoc_GetRelPath $tagFileDir $outDir/html]
833 set tagPath $tagFileDir
834 puts $doxyFile "TAGFILES = $tagFileDir/OCCT.tag=../../refman/html"
837 # HTML Search engine options
838 if { [string tolower $searchMode] == "none" } {
839 puts $doxyFile "SEARCHENGINE = NO"
840 puts $doxyFile "SERVER_BASED_SEARCH = NO"
841 puts $doxyFile "EXTERNAL_SEARCH = NO"
843 puts $doxyFile "SEARCHENGINE = YES"
844 if { [string tolower $searchMode] == "local" } {
845 puts $doxyFile "SERVER_BASED_SEARCH = NO"
846 puts $doxyFile "EXTERNAL_SEARCH = NO"
847 } elseif { [string tolower $searchMode] == "server" } {
848 puts $doxyFile "SERVER_BASED_SEARCH = YES"
849 puts $doxyFile "EXTERNAL_SEARCH = NO"
850 } elseif { [string tolower $searchMode] == "external" } {
851 puts $doxyFile "SERVER_BASED_SEARCH = YES"
852 puts $doxyFile "EXTERNAL_SEARCH = YES"
854 puts "Error: Wrong search engine type: $searchMode."
859 } elseif { $generatorMode == "CHM_ONLY"} {
860 # specific options for CHM file generation
861 puts $doxyFile "GENERATE_TREEVIEW = NO"
862 puts $doxyFile "SEARCHENGINE = NO"
863 puts $doxyFile "GENERATE_HTMLHELP = YES"
864 puts $doxyFile "CHM_FILE = ../../overview.chm"
865 puts $doxyFile "HHC_LOCATION = \"$hhcPath\""
866 puts $doxyFile "DISABLE_INDEX = YES"
870 puts $doxyFile "MATHJAX_RELPATH = ${mathjaxLocation}"