Statistics
| Branch: | Tag: | Revision:

root / host / docs / CMakeLists.txt @ 94c450b3

History | View | Annotate | Download (3.9 kB)

1
#
2
# Copyright 2010 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
    build.rst
24
    coding.rst
25
    dboards.rst
26
    general.rst
27
    images.rst
28
    usrp1.rst
29
    usrp2.rst
30
)
31

    
32
########################################################################
33
# Setup Manual
34
########################################################################
35
MESSAGE(STATUS "Checking for rst2html (docutils)")
36
FIND_PROGRAM(RST2HTML rst2html)
37
IF(${RST2HTML} STREQUAL "RST2HTML-NOTFOUND")
38
    MESSAGE(STATUS "Checking for rst2html (docutils) - not found")
39
    MESSAGE(STATUS "  Disabled generation of HTML manual.")
40
ELSE(${RST2HTML} STREQUAL "RST2HTML-NOTFOUND")
41
    MESSAGE(STATUS "Checking for rst2html (docutils) - found")
42
    MESSAGE(STATUS "  Enabled generation of HTML manual.")
43

    
44
    #setup rst2html options
45
    SET(stylesheet ${CMAKE_CURRENT_SOURCE_DIR}/style.css)
46
    SET(rst2html_options
47
        --stylesheet=${stylesheet}
48
        --no-toc-backlinks --date --time
49
    )
50

    
51
    #create generation rule for each source
52
    FOREACH(rstfile ${manual_sources})
53
        #set input and output file names
54
        SET(rstfile ${CMAKE_CURRENT_SOURCE_DIR}/${rstfile})
55
        GET_FILENAME_COMPONENT(rstfile_we ${rstfile} NAME_WE)
56
        SET(htmlfile ${CMAKE_CURRENT_BINARY_DIR}/${rstfile_we}.html)
57

    
58
        #make the html file depend on the rst file
59
        ADD_CUSTOM_COMMAND(
60
            OUTPUT ${htmlfile} DEPENDS ${rstfile} ${stylesheet}
61
            COMMAND ${RST2HTML} ${rstfile} ${htmlfile} ${rst2html_options}
62
            COMMENT "Generating ${htmlfile}"
63
        )
64

    
65
        #make the manual target depend on the html file
66
        LIST(APPEND manual_html_files ${htmlfile})
67
        INSTALL(FILES ${htmlfile} DESTINATION ${PKG_DOC_DIR}/manual/html)
68
    ENDFOREACH(rstfile ${manual_sources})
69

    
70
    #make the html manual a build-time dependency
71
    ADD_CUSTOM_TARGET(manual_html ALL DEPENDS ${manual_html_files})
72
ENDIF(${RST2HTML} STREQUAL "RST2HTML-NOTFOUND")
73

    
74
INSTALL(FILES ${manual_sources} DESTINATION ${PKG_DOC_DIR}/manual/rst)
75

    
76
########################################################################
77
# Setup Doxygen
78
########################################################################
79
INCLUDE(FindDoxygen)
80

    
81
IF(DOXYGEN_FOUND)
82
    MESSAGE(STATUS "  Enabled generation of Doxygen documentation.")
83

    
84
    #generate the doxygen configuration file
85
    SET(CMAKE_CURRENT_BINARY_DIR_DOXYGEN ${CMAKE_CURRENT_BINARY_DIR}/doxygen)
86
    CONFIGURE_FILE(
87
        ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
88
        ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
89
    @ONLY)
90

    
91
    #make doxygen directory depend on the header files
92
    FILE(GLOB_RECURSE header_files ${CMAKE_SOURCE_DIR}/include/*.hpp)
93
    ADD_CUSTOM_COMMAND(
94
        OUTPUT ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN} DEPENDS ${header_files}
95
        COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
96
        COMMENT "Generating documentation with doxygen"
97
    )
98

    
99
    #make the doxygen generation a built-time dependency
100
    ADD_CUSTOM_TARGET(doxygen_docs ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN})
101
    INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN} DESTINATION ${PKG_DOC_DIR})
102
ELSE(DOXYGEN_FOUND)
103
    MESSAGE(STATUS "  Disabled generation of Doxygen documentation.")
104
ENDIF(DOXYGEN_FOUND)