Statistics
| Branch: | Tag: | Revision:

root / host / docs / CMakeLists.txt @ 8740197d

History | View | Annotate | Download (3.93 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
    usrp2.rst
29
)
30

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

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

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

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

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

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

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

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

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

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

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

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