]> SALOME platform Git repositories - modules/smesh.git/blob - doc/gui/CMakeLists.txt
Salome HOME
Merge commit '6600bcec782fc8b6c72871fe6e08bd19a34a4e2b'
[modules/smesh.git] / doc / gui / CMakeLists.txt
1 # Copyright (C) 2012-2023  CEA, EDF, OPEN CASCADE
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, or (at your option) any later version.
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 INCLUDE(UseSphinx)
21
22 SALOME_INSTALL_SCRIPTS(collect_mesh_methods.py ${SALOME_INSTALL_BINS})
23
24 #SET(DOC_SMESH_MeshersList StdMeshers)
25 SET(smesh_file "${CMAKE_CURRENT_SOURCE_DIR}/collect_mesh_methods.py")
26 SET(smesh_merge_file "${CMAKE_CURRENT_SOURCE_DIR}/merge_mesh_class.py")
27
28 # Define requared environment variables
29 #SALOME_ACCUMULATE_ENVIRONMENT(SMESH_MeshersList NOCHECK ${DOC_SMESH_MeshersList})
30 #SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_CURRENT_BINARY_DIR}/tmp1)
31 #SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_CURRENT_BINARY_DIR}/tmp2)
32
33 SET(ADD_VAR)
34 LIST(APPEND ADD_VAR SMESH_MeshersList=StdMeshers)
35 LIST(APPEND ADD_VAR PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/tmp1)
36 LIST(APPEND ADD_VAR PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/tmp2)
37
38 # Make configuration file
39 SALOME_CONFIGURE_FILE(conf.py.in conf.py)
40
41 IF(SALOME_SMESH_BUILD_FRENCH_DOC)
42   SET(BUILD_LANGUAGE_SWITCHER "true")
43   SALOME_CONFIGURE_FILE(static/switchers.js.in static/switchers.js)
44   ADD_MULTI_LANG_DOCUMENTATION(TARGET_NAME usr_docs MODULE SMESH LANGUAGES fr ADDITIONAL_ENVIRONMENT ${ADD_VAR})
45 ELSE()
46   SET(BUILD_LANGUAGE_SWITCHER "false")
47   SALOME_CONFIGURE_FILE(static/switchers.js.in static/switchers.js)
48   ADD_MULTI_LANG_DOCUMENTATION(TARGET_NAME usr_docs MODULE SMESH ADDITIONAL_ENVIRONMENT ${ADD_VAR})
49 ENDIF()
50
51 # 1. Options for generating temporary python modules
52 SET(_cmd_tmp_gen_options ${smesh_file} -o tmp1/smeshBuilder_dynamic.py -f sphinx StdMeshers)
53 SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd_tmp_gen env_script "${PYTHON_EXECUTABLE}" "${_cmd_tmp_gen_options}" CONTEXT "SMESH_DOC" ADDITIONAL_VARIABLES ${ADD_VAR})
54
55 # 2. Options for generating final smeshBuilder.py script
56 SET(_cmd_smeshBuilder_gen_options ${smesh_merge_file} -o tmp2/smeshBuilder.py smeshBuilder)
57 SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd_smeshBuilder_gen env_script "${PYTHON_EXECUTABLE}" "${_cmd_smeshBuilder_gen_options}" CONTEXT "SMESH_DOC" ADDITIONAL_VARIABLES ${ADD_VAR})
58
59 ADD_CUSTOM_TARGET(pre_usr_docs
60   # 1. Make temporary directories for python modules
61   COMMAND ${CMAKE_COMMAND} -E make_directory tmp1
62   COMMAND ${CMAKE_COMMAND} -E make_directory tmp2
63
64   # 2. Copy python module to the temporary file
65   COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/smeshBuilder.py ${CMAKE_CURRENT_BINARY_DIR}/tmp1/smeshBuilder_origin.py
66
67   # 3. Copy python modules to be documented into memporary directory
68   COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/StdMeshersBuilder.py ${CMAKE_CURRENT_BINARY_DIR}/tmp2/StdMeshersBuilder.py
69   COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/smesh_algorithm.py ${CMAKE_CURRENT_BINARY_DIR}/tmp2/smesh_algorithm.py
70   COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/SMESH_PY/smeshstudytools.py ${CMAKE_CURRENT_BINARY_DIR}/tmp2/smeshstudytools.py
71
72   # 4. Collect methods from StdMeshers into temporary python module
73   COMMAND ${_cmd_tmp_gen}
74
75   # 5. Generate smeshBuilder.py script
76   COMMAND ${_cmd_smeshBuilder_gen}
77   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
78 )
79
80 ADD_DEPENDENCIES(usr_docs pre_usr_docs)
81
82 INSTALL(CODE "EXECUTE_PROCESS(COMMAND \"${CMAKE_COMMAND}\" --build ${PROJECT_BINARY_DIR} --target usr_docs)")
83 INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/SMESH DESTINATION ${SALOME_INSTALL_DOC}/gui)
84 IF(SALOME_SMESH_BUILD_FRENCH_DOC)
85   INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/SMESH_fr DESTINATION ${SALOME_INSTALL_DOC}/gui)
86 ENDIF()
87
88 SET(make_clean_files tmp1 tmp2)
89 SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${make_clean_files}")