1 # Copyright (C) 2012-2024 CEA, EDF
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 # Set MEDCOUPLING_SERVER_BASED_SEARCH=ON when building docs for putting on www.salome-platform.org
21 # MEDCOUPLING_SERVER_BASED_SEARCH is used in Doxyfile
23 IF(MEDCOUPLING_SERVER_BASED_SEARCH)
24 SET(MEDCOUPLING_SERVER_BASED_SEARCH "YES")
26 SET(MEDCOUPLING_SERVER_BASED_SEARCH "NO")
29 configure_file(Doxyfile.in Doxyfile @ONLY)
30 configure_file(static/header.html.in static/header.html @ONLY)
33 IF(NOT MEDCOUPLING_ENABLE_PYTHON)
34 ADD_CUSTOM_TARGET(doxygen_documentation
35 COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
37 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
40 INCLUDE(doxy2swig/doxy2swig.cmake)
43 # For ease of maintenance, documentation for code examples is splitted in
44 # several files. We here splice to a single file before running Doxygen.
46 SET(EXAMPLE_FILES # files to concatenate: order is important!
47 doxfiles/examples/medcouplingexamplesheader.doxy
48 doxfiles/examples/medcouplingexamplesfields.doxy
49 doxfiles/examples/medcouplingexamplesmeshes.doxy
50 doxfiles/examples/medcouplingexamplesarrays.doxy
51 doxfiles/examples/medcouplingexamplesother.doxy
52 doxfiles/examples/medcouplingexamplesfooter.doxy
55 # This function adds IN_FILE contents to the end of OUT_FILE
56 FUNCTION(concat IN_FILE OUT_FILE)
57 FILE(READ ${IN_FILE} CONTENTS)
58 FILE(APPEND ${OUT_FILE} ${CONTENTS})
61 FILE(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/tmp/medcouplingexamples.in" input)
62 FILE(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/BuildPyExamplesFromCPP.py" pythondocexamplesgenerator)
63 FILE(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}" output)
65 # Prepare a temporary file to "concat" to:
66 FILE(WRITE ${input} "")
67 # Call the "concat" function for each example file
68 FOREACH(EXAMPLE_FILE ${EXAMPLE_FILES})
69 concat(${EXAMPLE_FILE} ${input})
71 # Note: The reason for writing to a temporary is so the real target file only
72 # gets updated if its content has changed.
75 ADD_CUSTOM_TARGET(doxygen_documentation
76 COMMAND ${PYTHON_EXECUTABLE} ${pythondocexamplesgenerator} ${input} ${output}
77 COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
79 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
82 # Create dummy target gathering the generation of all .i files:
83 ADD_CUSTOM_TARGET(swig_ready)
84 ADD_DEPENDENCIES(swig_ready doxygen_documentation)
86 MEDCOUPLING_SWIG_DOCSTRING_CONFIGURE(doxygen_documentation swig_ready MEDCoupling)
87 MEDCOUPLING_SWIG_DOCSTRING_CONFIGURE(doxygen_documentation swig_ready MEDLoader)
89 SET(doxyfile_path ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
90 FILE(STRINGS ${doxyfile_path} enabled_sections REGEX "ENABLED_SECTIONS")
92 FILE(READ ${doxyfile_path} doxyfile_content)
93 STRING(REPLACE ${enabled_sections} "${enabled_sections} ENABLE_EXAMPLES" new_doxyfile ${doxyfile_content})
94 FILE(WRITE ${doxyfile_path} ${new_doxyfile})
96 FILE(APPEND ${doxyfile_path}
97 "#Temporary variable to enable python documentation sections\nENABLED_SECTIONS = ENABLE_EXAMPLES")
100 # Swig generation to have docstrings correctly populated:
101 INCLUDE(doxy2swig/doxy2swig.cmake)
104 INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc_ref_dev/html/ DESTINATION ${MEDCOUPLING_INSTALL_DOC}/developer)
106 SET(MAKE_CLEAN_FILES doc_ref_dev tmp)
107 SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${MAKE_CLEAN_FILES}")