File: CMakeLists.txt

package info (click to toggle)
libm2k 0.9.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 95,580 kB
  • sloc: xml: 1,611,497; cpp: 16,278; python: 4,181; cs: 516; sh: 471; ansic: 403; makefile: 35
file content (100 lines) | stat: -rw-r--r-- 3,435 bytes parent folder | download | duplicates (2)
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
#
# Copyright (c) 2024 Analog Devices Inc.
#
# This file is part of libm2k
# (see http://www.github.com/analogdevicesinc/libm2k).
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 2.1 of the License, or
# (at your option) any later version.
#
# This program 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 Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

cmake_minimum_required(VERSION 3.1.3)
project(doc)

find_program(DOXYGEN_PATH doxygen)
if (NOT DOXYGEN_PATH)
    message(FATAL_ERROR "Doxygen not found!")
endif()


set(SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../include/libm2k)
set(DOXY_WORKING_DIR ${CMAKE_CURRENT_BINARY_DIR}/doxygen_doc)


set(PROJECT_NAME "libm2k")
set(DOCUMENTED_FILES "${SOURCES_DIR}/m2k.hpp \\
                      ${SOURCES_DIR}/contextbuilder.hpp \\
                      ${SOURCES_DIR}/context.hpp \\
                      ${SOURCES_DIR}/digital/m2kdigital.hpp \\
                      ${SOURCES_DIR}/digital/enums.hpp \\
                      ${SOURCES_DIR}/analog/m2kanalogin.hpp \\
                      ${SOURCES_DIR}/analog/m2kanalogout.hpp \\
                      ${SOURCES_DIR}/analog/m2kpowersupply.hpp \\
                      ${SOURCES_DIR}/analog/dmm.hpp \\
                      ${SOURCES_DIR}/analog/enums.hpp \\
                      ${SOURCES_DIR}/digital/enums.hpp \\
                      ${SOURCES_DIR}/enums.hpp \\
		       ${SOURCES_DIR}/m2khardwaretrigger.hpp \\
		       ${SOURCES_DIR}/enums.hpp \\
                     ${CMAKE_CURRENT_SOURCE_DIR}/mainpage.dox
                      "
)


configure_file(
    Doxyfile_API.in
    ${DOXY_WORKING_DIR}/Doxyfile.doxy
)


if(ENABLE_PYTHON)
	find_package(Sphinx REQUIRED)

	if (NOT SPHINX_EXECUTABLE)
	    message(FATAL_ERROR "Sphinx not found!")
	endif()

	set(BINARY_SPHINX_DIR "${DOXY_WORKING_DIR}/python/html/sphinx")
	# configured documentation tools and intermediate build results
	set(BINARY_BUILD_DIR "${BINARY_SPHINX_DIR}/build")
	# Sphinx cache with pickled ReST documents
	set(SPHINX_CACHE_DIR "${BINARY_SPHINX_DIR}/build/doctrees")
	# HTML output directory
	set(SPHINX_HTML_DIR "${BINARY_SPHINX_DIR}/build/html")

	configure_file(
		"${CMAKE_CURRENT_SOURCE_DIR}/sphinx/source/conf.py.in"
		"${BINARY_SPHINX_DIR}/build/conf.py"
		@ONLY)
	add_custom_target(libm2k_sphinx_doc
		${SPHINX_EXECUTABLE}
		-q -b html
		-c "${BINARY_BUILD_DIR}"
		-d "${SPHINX_CACHE_DIR}"
		"${CMAKE_CURRENT_SOURCE_DIR}/sphinx/source"
		"${SPHINX_HTML_DIR}"
		COMMENT "---Building HTML documentation with Sphinx for Python Bindings")

endif()

add_custom_target(doc
    COMMAND ${DOXYGEN_PATH} Doxyfile.doxy
    COMMAND ${CMAKE_COMMAND} -E make_directory ${DOXY_WORKING_DIR}/html
    COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/img ${DOXY_WORKING_DIR}/html/img
    COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/sphinx ${DOXY_WORKING_DIR}/html/sphinx
    WORKING_DIRECTORY ${DOXY_WORKING_DIR}
)

if(ENABLE_PYTHON)
	add_dependencies(doc libm2k_sphinx_doc)
endif()