Salome HOME
+ Field::cellToNode implementation
[tools/medcoupling.git] / doc / doxygen / CMakeLists.txt
1 # Copyright (C) 2012-2013  CEA/DEN, EDF R&D
2 #
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.
7 #
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.
12 #
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
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 SALOME_CONFIGURE_FILE(Doxyfile_med_user.in Doxyfile_med_user)
21 SALOME_CONFIGURE_FILE(static/header.html.in static/header.html)
22
23 FILE(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/medcouplingexamples.in" input)
24 FILE(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/BuildPyExamplesFromCPP.py" pythondocexamplesgenerator)
25 FILE(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}" output)
26
27
28 # :TRICKY: For ease of maintenance, documentation for code examples is
29 # splitted in several files. We here splice to a single file before running
30 # Doxygen.
31
32 SET(EXAMPLE_FILES # files to concatenate: order is important!
33   doxfiles/examples/medcouplingexamplesheader.doxy
34   doxfiles/examples/medcouplingexamplesfields.doxy
35   doxfiles/examples/medcouplingexamplesmeshes.doxy
36   doxfiles/examples/medcouplingexamplesarrays.doxy
37   doxfiles/examples/medcouplingexamplesother.doxy
38   doxfiles/examples/medcouplingexamplesfooter.doxy
39   )
40
41 # This function adds IN_FILE contents to the end of OUT_FILE
42 FUNCTION(concat IN_FILE OUT_FILE)
43   FILE(READ ${IN_FILE} CONTENTS)
44   FILE(APPEND ${OUT_FILE} ${CONTENTS})
45 ENDFUNCTION()
46
47 # Prepare a temporary file to "concat" to:
48 FILE(WRITE medcouplingexamples.in "")
49 # Call the "concat" function for each example file
50 FOREACH(EXAMPLE_FILE ${EXAMPLE_FILES})
51   concat(${EXAMPLE_FILE} medcouplingexamples.in)
52 ENDFOREACH()
53 # Copy the temporary file to the final location
54 #CONFIGURE_FILE(medcouplingexamples.in ${CMAKE_CURRENT_BINARY_DIR}/medcouplingexamples.dox)
55 # Note: The reason for writing to a temporary is so the real target file only
56 # gets updated if its content has changed.
57
58
59 # Here is the "standard" procedure, as if ${input} was hand-written.
60 ADD_CUSTOM_TARGET(usr_docs ALL
61   COMMAND ${PYTHON_EXECUTABLE} ${pythondocexamplesgenerator} ${input} ${output}
62   COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile_med_user
63   VERBATIM
64   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
65   )
66   
67 INSTALL(CODE "EXECUTE_PROCESS(COMMAND \"${CMAKE_COMMAND}\" --build ${PROJECT_BINARY_DIR} --target usr_docs)")
68 INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc_ref_user/html/ DESTINATION ${SALOME_INSTALL_DOC}/gui/MED)
69 INSTALL(FILES images/head.png DESTINATION ${SALOME_INSTALL_DOC}/gui/MED) 
70
71 SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES doc_ref_user)