|
1 | | -# Copyright (C) 2008-2023 LAAS-CNRS, JRL AIST-CNRS, INRIA. |
| 1 | +# Copyright (C) 2008-2025 LAAS-CNRS, JRL AIST-CNRS, INRIA. |
2 | 2 | # |
3 | 3 | # This program is free software: you can redistribute it and/or modify it under |
4 | 4 | # the terms of the GNU General Public License as published by the Free Software |
@@ -254,6 +254,7 @@ macro(_SETUP_DOXYGEN_CONFIG_FILE configfile) |
254 | 254 | MATHJAX_RELPATH |
255 | 255 | MATHJAX_EXTENSIONS |
256 | 256 | MATHJAX_CODEFILE |
| 257 | + MATHJAX_VERSION |
257 | 258 | SEARCHENGINE |
258 | 259 | SERVER_BASED_SEARCH |
259 | 260 | EXTERNAL_SEARCH |
@@ -397,6 +398,39 @@ macro(_set_if_undefined variable) |
397 | 398 | endif() |
398 | 399 | endmacro() |
399 | 400 |
|
| 401 | +# _SETUP_MATHJAX_DEFAULTS |
| 402 | +# ---------------------------- |
| 403 | +# |
| 404 | +# Set MathJax defaults depending on the current version of Doxygen and whether |
| 405 | +# some flags were already set. |
| 406 | +# |
| 407 | +# If the Doxygen version is less than 1.9.2, the DOXYGEN_MATHJAX_VERSION option will be unset. |
| 408 | +# If a path to MathJax is not provided, we will either: |
| 409 | +# - point to our local vendored version of MathJax 3 |
| 410 | +# - unset the MathJax path; the Doxygen HTML header will point to the MathJax 2 CDN. |
| 411 | +macro(_SETUP_MATHJAX_DEFAULTS) |
| 412 | + if(DOXYGEN_VERSION VERSION_GREATER_EQUAL 1.9.2) |
| 413 | + _set_if_undefined(DOXYGEN_MATHJAX_VERSION MathJax_3) |
| 414 | + else() |
| 415 | + # remove unsupported option |
| 416 | + unset(DOXYGEN_MATHJAX_VERSION) |
| 417 | + message( |
| 418 | + STATUS |
| 419 | + "Doxygen version inferior to 1.9.2. If MathJax is enabled, v2.7 will be used." |
| 420 | + ) |
| 421 | + # set to empty string to use the MathJax CDN |
| 422 | + endif() |
| 423 | + if("${DOXYGEN_MATHJAX_VERSION}" STREQUAL "MathJax_3") |
| 424 | + # If using MathJax 3, use our vendored version by default. |
| 425 | + _set_if_undefined( |
| 426 | + DOXYGEN_MATHJAX_RELPATH |
| 427 | + ${PROJECT_JRL_CMAKE_MODULE_DIR}/doxygen/MathJax |
| 428 | + ) |
| 429 | + else() |
| 430 | + _set_if_undefined(DOXYGEN_MATHJAX_RELPATH) |
| 431 | + endif() |
| 432 | +endmacro(_SETUP_MATHJAX_DEFAULTS) |
| 433 | + |
400 | 434 | # _SETUP_DOXYGEN_DEFAULT_OPTIONS |
401 | 435 | # ---------------------------- |
402 | 436 | # |
@@ -442,6 +476,7 @@ macro(_SETUP_DOXYGEN_DEFAULT_OPTIONS) |
442 | 476 | # --------------------------------------------------------------------------- |
443 | 477 | _set_if_undefined(DOXYGEN_HTML_OUTPUT doxygen-html) |
444 | 478 | _set_if_undefined(DOXYGEN_GENERATE_TREEVIEW YES) |
| 479 | + _SETUP_MATHJAX_DEFAULTS() |
445 | 480 | # --------------------------------------------------------------------------- |
446 | 481 | # Configuration options related to the LaTeX output |
447 | 482 | # --------------------------------------------------------------------------- |
@@ -591,6 +626,15 @@ macro(_SETUP_PROJECT_DOCUMENTATION) |
591 | 626 | COPY ${PROJECT_JRL_CMAKE_MODULE_DIR}/doxygen/MathJax |
592 | 627 | DESTINATION ${PROJECT_BINARY_DIR}/doc/doxygen-html |
593 | 628 | ) |
| 629 | + # the variable is unset if Doxygen version < 1.9.2 |
| 630 | + # otherwise, MathJax_3 is the default. |
| 631 | + if(DOXYGEN_MATHJAX_VERSION STREQUAL "MathJax_3") |
| 632 | + message( |
| 633 | + STATUS |
| 634 | + "MathJax version 3 will be used. If MATHJAX_RELPATH is unset we will use the vendored MathJax. " |
| 635 | + "If you have set it, check that it's pointing at a MathJax 3 distribution." |
| 636 | + ) |
| 637 | + endif() |
594 | 638 | endif() |
595 | 639 |
|
596 | 640 | # Install generated files. |
|
0 commit comments