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_med_dev
23 IF(MEDCOUPLING_SERVER_BASED_SEARCH)
24 SET(MEDCOUPLING_SERVER_BASED_SEARCH "YES")
26 SET(MEDCOUPLING_SERVER_BASED_SEARCH "NO")
29 SALOME_CONFIGURE_FILE(Doxyfile_med_dev.in Doxyfile_med_dev)
30 SALOME_CONFIGURE_FILE(static/header.html.in static/header.html)
33 IF(MEDCOUPLING_ENABLE_PYTHON)
34 INCLUDE(doxy2swig/doxy2swig.cmake)
36 FILE(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/tmp/medcouplingexamples.in" input)
37 FILE(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/BuildPyExamplesFromCPP.py" pythondocexamplesgenerator)
38 FILE(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}" output)
40 # :TRICKY: For ease of maintenance, documentation for code examples is
41 # splitted in several files. We here splice to a single file before running
44 SET(EXAMPLE_FILES # files to concatenate: order is important!
45 doxfiles/examples/medcouplingexamplesheader.doxy
46 doxfiles/examples/medcouplingexamplesfields.doxy
47 doxfiles/examples/medcouplingexamplesmeshes.doxy
48 doxfiles/examples/medcouplingexamplesarrays.doxy
49 doxfiles/examples/medcouplingexamplesother.doxy
50 doxfiles/examples/medcouplingexamplesfooter.doxy
53 # This function adds IN_FILE contents to the end of OUT_FILE
54 FUNCTION(concat IN_FILE OUT_FILE)
55 FILE(READ ${IN_FILE} CONTENTS)
56 FILE(APPEND ${OUT_FILE} ${CONTENTS})
59 # Prepare a temporary file to "concat" to:
60 FILE(WRITE ${input} "")
61 # Call the "concat" function for each example file
62 FOREACH(EXAMPLE_FILE ${EXAMPLE_FILES})
63 concat(${EXAMPLE_FILE} ${input})
65 # Note: The reason for writing to a temporary is so the real target file only
66 # gets updated if its content has changed.
68 # Here is the "standard" procedure, as if ${input} was hand-written.
69 ADD_CUSTOM_TARGET(dev_docs ALL
70 COMMAND ${PYTHON_EXECUTABLE} ${pythondocexamplesgenerator} ${input} ${output}
71 COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile_med_dev
73 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
76 # Create dummy target gathering the generation of all .i files:
77 ADD_CUSTOM_TARGET(swig_ready)
78 ADD_DEPENDENCIES(swig_ready dev_docs)
80 MEDCOUPLING_SWIG_DOCSTRING_CONFIGURE(dev_docs swig_ready MEDCoupling)
81 MEDCOUPLING_SWIG_DOCSTRING_CONFIGURE(dev_docs swig_ready MEDLoader)
83 SET(doxyfile_med_dev ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_med_dev)
84 FILE(STRINGS ${doxyfile_med_dev} enabled_sections REGEX "ENABLED_SECTIONS")
86 FILE(READ ${doxyfile_med_dev} doxy_file)
87 STRING(REPLACE ${enabled_sections} "${enabled_sections} ENABLE_EXAMPLES" new_doxy_file ${doxy_file})
88 FILE(WRITE ${doxyfile_med_dev} ${new_doxy_file})
90 FILE(APPEND ${doxyfile_med_dev}
91 "#Temporary variable to enable python documentation sections\nENABLED_SECTIONS = ENABLE_EXAMPLES")
94 # Swig generation to have docstrings correctly populated:
95 INCLUDE(doxy2swig/doxy2swig.cmake)
98 ADD_CUSTOM_TARGET(dev_docs ALL
99 COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile_med_dev
101 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
105 #INSTALL(CODE "EXECUTE_PROCESS(COMMAND \"${CMAKE_COMMAND}\" --build ${PROJECT_BINARY_DIR} --target dev_docs)")
106 INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc_ref_dev/html/ DESTINATION ${MEDCOUPLING_INSTALL_DOC}/developer)
107 #INSTALL(FILES images/head.png DESTINATION ${MEDCOUPLING_INSTALL_DOC}/developer)
109 SET(MAKE_CLEAN_FILES doc_ref_dev tmp)
110 SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${MAKE_CLEAN_FILES}")