File: CMakeLists.txt

package info (click to toggle)
allegro4.4 2%3A4.4.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 20,744 kB
  • sloc: ansic: 164,458; asm: 17,620; cpp: 3,848; javascript: 3,053; objc: 1,687; sh: 1,107; python: 676; pascal: 179; makefile: 57; perl: 29; lisp: 1
file content (236 lines) | stat: -rw-r--r-- 6,988 bytes parent folder | download | duplicates (5)
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
#-----------------------------------------------------------------------------#
#
# Documentation
#

option(WANT_DOCS "Generate documentation" on)
if(NOT WANT_DOCS OR CMAKE_CROSSCOMPILING)
    return()
endif()

set(DOCDIR "doc" CACHE STRING "Install docs into $DOCDIR/allegro-$VERSION")
set(ACTUAL_DOC_DIR "${DOCDIR}/allegro-${ALLEGRO_VERSION}")

add_executable(makedoc
    src/makedoc/makedoc.c
    src/makedoc/makehtml.c
    src/makedoc/makemisc.c
    src/makedoc/maketxt.c
    src/makedoc/makertf.c
    src/makedoc/maketexi.c
    src/makedoc/makeman.c
    src/makedoc/makechm.c
    src/makedoc/makedevh.c
    src/makedoc/makesci.c
    )

file(MAKE_DIRECTORY
    ${CMAKE_CURRENT_BINARY_DIR}/build
    ${CMAKE_CURRENT_BINARY_DIR}/txt
    ${CMAKE_CURRENT_BINARY_DIR}/html
    ${CMAKE_CURRENT_BINARY_DIR}/rtf
    ${CMAKE_CURRENT_BINARY_DIR}/scite
    ${CMAKE_CURRENT_BINARY_DIR}/texi
    ${CMAKE_CURRENT_BINARY_DIR}/info
    ${CMAKE_CURRENT_BINARY_DIR}/man
    )

set(DOC_SRCS
    src/abi._tx
    src/addons._tx
    src/ahack._tx
    src/allegro._tx
    src/api._tx
    src/changes._tx
    src/const._tx
    src/dat2c._tx
    src/dat2s._tx
    src/datafile._tx
    src/dat._tx
    src/faq._tx
    src/grabber._tx
    src/help._tx
    src/index._tx
    src/license._tx
    src/makedoc._tx
    src/mistakes._tx
    src/packfile._tx
    src/readme._tx
    src/thanks._tx

    src/build/cmake._tx
    src/build/linux._tx
    src/build/macosx._tx
    src/build/mingw32._tx
    src/build/msvc._tx
    src/build/unix._tx
    )

set(all_docs)
foreach(page ${DOC_SRCS})
    string(REGEX MATCH "[^/]*._tx" basename ${page})
    string(REPLACE "._tx" "" basename ${basename})

    set(page ${CMAKE_CURRENT_SOURCE_DIR}/${page})
    if(${page} MATCHES "/src/build/")
        set(txt_out ${CMAKE_CURRENT_BINARY_DIR}/build/${basename}.txt)
        set(html_out ${CMAKE_CURRENT_BINARY_DIR}/build/${basename}.html)
    else()
        set(txt_out ${CMAKE_CURRENT_BINARY_DIR}/txt/${basename}.txt)
        set(html_out ${CMAKE_CURRENT_BINARY_DIR}/html/${basename}.html)
    endif()

    add_custom_command(
        OUTPUT ${txt_out}
        DEPENDS makedoc ${page}
        COMMAND makedoc -ascii ${txt_out} ${page}
        )

    add_custom_command(
        OUTPUT ${html_out}
        DEPENDS makedoc ${page}
        COMMAND makedoc -html ${html_out} ${page}
        )

    list(APPEND all_docs ${txt_out} ${html_out})
endforeach()

macro(ascii_file out src)
    # You'll have to ask Shawn why it was like this...
    add_custom_command(
        OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${out}
        DEPENDS makedoc ${CMAKE_CURRENT_SOURCE_DIR}/${src}
        COMMAND makedoc ${ARGN}
                -ascii ${CMAKE_CURRENT_BINARY_DIR}/${out}
                ${CMAKE_CURRENT_SOURCE_DIR}/${src}
        )
    list(APPEND all_docs ${CMAKE_CURRENT_BINARY_DIR}/${out})
endmacro()

# Files in the root directory.
ascii_file(AUTHORS src/thanks._tx -part)
ascii_file(THANKS src/thanks._tx -part)
ascii_file(CHANGES src/changes._tx)
ascii_file(readme.txt src/readme._tx)

if(UNIX)
    set(TEXT_FILES_TO_INSTALL
        ${CMAKE_CURRENT_BINARY_DIR}/AUTHORS
        ${CMAKE_CURRENT_BINARY_DIR}/THANKS
        ${CMAKE_CURRENT_BINARY_DIR}/CHANGES
        ${CMAKE_CURRENT_BINARY_DIR}/readme.txt
        ${CMAKE_CURRENT_BINARY_DIR}/txt/abi.txt
        ${CMAKE_CURRENT_BINARY_DIR}/txt/addons.txt
        ${CMAKE_CURRENT_BINARY_DIR}/txt/ahack.txt
        ${CMAKE_CURRENT_BINARY_DIR}/txt/allegro.txt
        ${CMAKE_CURRENT_BINARY_DIR}/txt/api.txt
        ${CMAKE_CURRENT_BINARY_DIR}/txt/const.txt
        ${CMAKE_CURRENT_BINARY_DIR}/txt/dat.txt
        ${CMAKE_CURRENT_BINARY_DIR}/txt/dat2c.txt
        ${CMAKE_CURRENT_BINARY_DIR}/txt/dat2s.txt
        ${CMAKE_CURRENT_BINARY_DIR}/txt/datafile.txt
        ${CMAKE_CURRENT_BINARY_DIR}/txt/faq.txt
        ${CMAKE_CURRENT_BINARY_DIR}/txt/grabber.txt
        ${CMAKE_CURRENT_BINARY_DIR}/txt/help.txt
        ${CMAKE_CURRENT_BINARY_DIR}/txt/license.txt
        ${CMAKE_CURRENT_BINARY_DIR}/txt/makedoc.txt
        ${CMAKE_CURRENT_BINARY_DIR}/txt/mistakes.txt
        ${CMAKE_CURRENT_BINARY_DIR}/txt/packfile.txt
        )
    install(FILES ${TEXT_FILES_TO_INSTALL}
            DESTINATION ${ACTUAL_DOC_DIR}
            )

    file(GLOB HTML_DOCS
            ${CMAKE_CURRENT_BINARY_DIR}/html/*.html
            ${CMAKE_CURRENT_BINARY_DIR}/html/*.css
            )
    install(FILES ${HTML_DOCS}
            DESTINATION ${ACTUAL_DOC_DIR}/html
            )
endif(UNIX)

#-----------------------------------------------------------------------------#
#
# Man pages
#

option(WANT_DOCS_MAN "Generate man pages" on)
set(MANDIR "man" CACHE STRING "Install man pages into this directory")

if(WANT_DOCS_MAN)
    set(man_out ${CMAKE_CURRENT_BINARY_DIR}/man/allegro_init.3alleg4)
    set(man_src ${CMAKE_CURRENT_SOURCE_DIR}/src/allegro._tx)

    add_custom_command(
        OUTPUT ${man_out}
        DEPENDS makedoc ${man_src}
        COMMAND makedoc -man ${man_out} ${man_src}
        )
    list(APPEND all_docs ${man_out})

    # I'm assuming only Unix users want man pages installed, but djgpp supports
    # man pages to so this might need to change.
    if(UNIX)
        file(GLOB MAN_PAGES ${CMAKE_CURRENT_BINARY_DIR}/man/*.3alleg4)
        install(FILES ${MAN_PAGES}
                DESTINATION ${MANDIR}/man3
                )
    endif(UNIX)
endif(WANT_DOCS_MAN)

#-----------------------------------------------------------------------------#
#
# Info
#

option(WANT_DOCS_INFO "Generate Info document" on)
find_program(MAKEINFO NAMES makeinfo)
mark_as_advanced(MAKEINFO)
set(INFODIR "info" CACHE STRING "Install Info docs into this directory")

if(WANT_DOCS_INFO AND MAKEINFO)
    set(texi_out ${CMAKE_CURRENT_BINARY_DIR}/texi/allegro.texi)
    set(info_out ${CMAKE_CURRENT_BINARY_DIR}/info/allegro.info)
    set(info_src ${CMAKE_CURRENT_SOURCE_DIR}/src/allegro._tx)

    add_custom_command(
        OUTPUT ${texi_out}
        DEPENDS makedoc ${info_src}
        COMMAND makedoc -texi ${texi_out} ${info_src}
        )
    add_custom_command(
        OUTPUT ${info_out}
        DEPENDS ${texi_out}
        COMMAND ${MAKEINFO} --no-split -o ${info_out} ${texi_out}
        )
    list(APPEND all_docs ${info_out})

    if(UNIX)
        install(FILES ${info_out}
                DESTINATION ${INFODIR}
                )
    endif(UNIX)
endif(WANT_DOCS_INFO AND MAKEINFO)

#-----------------------------------------------------------------------------#
#
# Scite
#

set(scite_out ${CMAKE_CURRENT_BINARY_DIR}/scite/allegro.api)
set(scite_src ${CMAKE_CURRENT_SOURCE_DIR}/src/allegro._tx)

add_custom_command(
    OUTPUT ${scite_out}
    DEPENDS makedoc ${page}
    COMMAND makedoc -scite ${scite_out} ${scite_src}
    )
list(APPEND all_docs ${scite_out})

#-----------------------------------------------------------------------------#

add_custom_target(docs ALL DEPENDS ${all_docs})

#-----------------------------------------------------------------------------#
# vim: set sts=4 sw=4 et: