forked from nest/nest-simulator
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
111 lines (96 loc) · 3.87 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# doc/CMakeLists.txt
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# NEST is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with NEST. If not, see <http://www.gnu.org/licenses/>.
install( DIRECTORY slihelp_generator
DESTINATION ${CMAKE_INSTALL_DATADIR}
)
if ( NOT CMAKE_CROSSCOMPILING )
# Python is needed to generate the help. If Python does not exist,
# there are problems with the following.
# See https://github.com/nest/nest-simulator/issues/678.
find_package( PythonInterp )
if ( Python_FOUND )
# Extract help from all source files in the source code, put
# them in doc/help and generate a local help index in the
# build directory containing links to the help files.
install( CODE
"execute_process(
COMMAND ${Python_EXECUTABLE} -B generate_help.py \"${PROJECT_SOURCE_DIR}\" \"${PROJECT_BINARY_DIR}\"
WORKING_DIRECTORY \"${PROJECT_SOURCE_DIR}/doc/slihelp_generator\"
)"
)
# Copy the local doc/help directory to the global installation
# directory for documentation.
install( DIRECTORY "${PROJECT_BINARY_DIR}/doc/help"
DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DOCDIR}"
OPTIONAL
)
# Update the global help index to include all help files in
# the global installation directory for documentation.
install( CODE
"execute_process(
COMMAND ${Python_EXECUTABLE} -B generate_helpindex.py \"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DOCDIR}\"
WORKING_DIRECTORY \"${PROJECT_SOURCE_DIR}/doc/slihelp_generator\"
)"
)
endif ()
endif ()
if ( DOXYGEN_FOUND )
add_custom_target( doc
COMMAND ${DOXYGEN_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/normaldoc.conf"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)
if ( DOXYGEN_DOT_FOUND )
add_custom_target( fulldoc
COMMAND ${DOXYGEN_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/fulldoc.conf"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)
else ()
add_custom_target( fulldoc
COMMAND ${CMAKE_COMMAND} -E echo "dot command is not found on your system. Cannot build full documentation."
)
endif ()
else ()
add_custom_target( doc
COMMAND ${CMAKE_COMMAND} -E echo "Doxygen is not found on your system. Cannot build documentation."
)
add_custom_target( fulldoc
COMMAND ${CMAKE_COMMAND} -E echo "Doxygen is not found on your system. Cannot build full documentation."
)
endif ()
if ( "${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}" )
set( OUT_OF_TREE_BUILD "False" )
else ()
set( OUT_OF_TREE_BUILD "True" )
endif ()
set( DOC_BUILD_DIR "${PROJECT_BINARY_DIR}/doc/htmldoc" )
set( DOC_SOURCE_DIR "${PROJECT_SOURCE_DIR}/doc/htmldoc" )
add_custom_target( html
COMMAND [ "${OUT_OF_TREE_BUILD}" = "True" ] && rm -rf "${DOC_BUILD_DIR}" || true
COMMAND [ "${OUT_OF_TREE_BUILD}" = "True" ] && cp -r "${DOC_SOURCE_DIR}" "${DOC_BUILD_DIR}" || true
COMMAND NESTSRCDIR=${PROJECT_SOURCE_DIR} sphinx-build -b html "${DOC_BUILD_DIR}" "${DOC_BUILD_DIR}/html"
COMMAND cp "${DOC_BUILD_DIR}/models/*.rst" "${DOC_BUILD_DIR}/html/models"
COMMAND ${PYTHON_EXECUTABLE} "${DOC_BUILD_DIR}/resolve_includes.py" "${DOC_BUILD_DIR}/html/models"
)
install( DIRECTORY "${DOC_BUILD_DIR}/html"
DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DOCDIR}"
OPTIONAL
)
install( DIRECTORY logos
DESTINATION ${CMAKE_INSTALL_DOCDIR}
)