Statistics
| Branch: | Tag: | Revision:

root / host / docs / CMakeLists.txt @ f68a9271

History | View | Annotate | Download (3.78 KB)

1
#
2
# Copyright 2010-2011 Ettus Research LLC
3
#
4
# This program is free software: you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation, either version 3 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
#
17

    
18
########################################################################
19
# List of manual sources
20
########################################################################
21
SET(manual_sources
22
    index.rst
23
    identification.rst
24
    build.rst
25
    calibration.rst
26
    coding.rst
27
    dboards.rst
28
    gpsdo.rst
29
    general.rst
30
    images.rst
31
    stream.rst
32
    sync.rst
33
    transport.rst
34
    usrp1.rst
35
    usrp2.rst
36
    usrp_b1xx.rst
37
    usrp_e1xx.rst
38
)
39

    
40
########################################################################
41
# Setup Manual
42
########################################################################
43
MESSAGE(STATUS "")
44
FIND_PACKAGE(Docutils)
45

    
46
LIBUHD_REGISTER_COMPONENT("Manual" ENABLE_MANUAL ON "DOCUTILS_FOUND" OFF)
47

    
48
IF(ENABLE_MANUAL)
49
    #setup rst2html options
50
    SET(stylesheet ${CMAKE_CURRENT_SOURCE_DIR}/style.css)
51
    SET(rst2html_options
52
        --stylesheet=${stylesheet}
53
        --no-toc-backlinks --date --time
54
    )
55

    
56
    #create generation rule for each source
57
    FOREACH(rstfile ${manual_sources})
58
        #set input and output file names
59
        SET(rstfile ${CMAKE_CURRENT_SOURCE_DIR}/${rstfile})
60
        GET_FILENAME_COMPONENT(rstfile_we ${rstfile} NAME_WE)
61
        SET(htmlfile ${CMAKE_CURRENT_BINARY_DIR}/${rstfile_we}.html)
62

    
63
        #make the html file depend on the rst file
64
        ADD_CUSTOM_COMMAND(
65
            OUTPUT ${htmlfile} DEPENDS ${rstfile} ${stylesheet}
66
            COMMAND ${RST2HTML_EXECUTABLE} ${rstfile} ${htmlfile} ${rst2html_options}
67
            COMMENT "Generating ${htmlfile}"
68
        )
69

    
70
        #make the manual target depend on the html file
71
        LIST(APPEND manual_html_files ${htmlfile})
72
        INSTALL(FILES ${htmlfile} DESTINATION ${PKG_DOC_DIR}/manual/html COMPONENT manual)
73
    ENDFOREACH(rstfile ${manual_sources})
74

    
75
    #make the html manual a build-time dependency
76
    ADD_CUSTOM_TARGET(manual_html ALL DEPENDS ${manual_html_files})
77
ENDIF(ENABLE_MANUAL)
78

    
79
INSTALL(FILES ${manual_sources} DESTINATION ${PKG_DOC_DIR}/manual/rst COMPONENT manual)
80

    
81
########################################################################
82
# Setup Doxygen
83
########################################################################
84
MESSAGE(STATUS "")
85
FIND_PACKAGE(Doxygen)
86

    
87
LIBUHD_REGISTER_COMPONENT("Doxygen" ENABLE_DOXYGEN ON "DOXYGEN_FOUND" OFF)
88

    
89
IF(ENABLE_DOXYGEN)
90
    #generate the doxygen configuration file
91
    SET(CMAKE_CURRENT_BINARY_DIR_DOXYGEN ${CMAKE_CURRENT_BINARY_DIR}/doxygen)
92
    CONFIGURE_FILE(
93
        ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
94
        ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
95
    @ONLY)
96

    
97
    #make doxygen directory depend on the header files
98
    FILE(GLOB_RECURSE header_files ${CMAKE_SOURCE_DIR}/include/*.hpp)
99
    ADD_CUSTOM_COMMAND(
100
        OUTPUT ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN} DEPENDS ${header_files}
101
        COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
102
        COMMENT "Generating documentation with doxygen"
103
    )
104

    
105
    #make the doxygen generation a built-time dependency
106
    ADD_CUSTOM_TARGET(doxygen_docs ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN})
107
    INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN} DESTINATION ${PKG_DOC_DIR} COMPONENT doxygen)
108
ENDIF(ENABLE_DOXYGEN)