File: drivers-init.cmake

package info (click to toggle)
plplot 5.15.0%2Bdfsg-19
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 31,312 kB
  • sloc: ansic: 79,707; xml: 28,583; cpp: 20,033; ada: 19,456; tcl: 12,081; f90: 11,431; ml: 7,276; java: 6,863; python: 6,792; sh: 3,274; perl: 828; lisp: 75; makefile: 50; sed: 34; fortran: 5
file content (243 lines) | stat: -rw-r--r-- 9,352 bytes parent folder | download | duplicates (4)
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
237
238
239
240
241
242
243
# cmake/modules/drivers-init.cmake
#
# Start driver initializations
#
# Copyright (C) 2006-2018  Alan W. Irwin
#
# This file is part of PLplot.
#
# PLplot is free software; you can redistribute it and/or modify
# it under the terms of the GNU Library General Public License as published
# by the Free Software Foundation; version 2 of the License.
#
# PLplot 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 Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public License
# along with the file PLplot; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA

# Module to initialize device options.

# Results are contained in the following variables:
# PLD_devicename (ON or OFF): whether each PLplot-related device is enabled
#   or not.  devicename is png, jpeg, etc.
# DRIVERS_DEVICE_LIST: see below for the definition

# We think of a "device" as the output medium.  Could be a machine
# style (Tektronix, X11), or a file format (Postscript).
#
# A "driver" is the PLplot code that produces the output on the
# medium.
#
# Some drivers support multiple devices.  But we we need to make sure
# we compile only the selected drivers.  That is, if a driver supports
# devices not selected, we don't want to compile it at all.  Or if it
# supports multiple selected devices, we only want to compile it
# once.  To support this, we build an association list between devices
# and drivers.  This will be inspected to build up the set of drivers
# to be compiled based on which devices are selected.

option(DEFAULT_ALL_DEVICES
  "Enable all devices by default (ON) or enable devices individually by default (OFF)"
  OFF
  )

option(DEFAULT_NO_DEVICES
  "Disable all devices by default (ON) or enable devices individually by default (OFF)"
  OFF
  )

if(DEFAULT_ALL_DEVICES AND DEFAULT_NO_DEVICES)
  message(STATUS
    "WARNING. DEFAULT_ALL_DEVICES ON supersedes DEFAULT_NO_DEVICES ON.")
  set(DEFAULT_NO_DEVICES OFF
    CACHE BOOL
    "Disable all devices by default (ON) or enable devices individually by default (OFF)"
    FORCE
    )
endif(DEFAULT_ALL_DEVICES AND DEFAULT_NO_DEVICES)

option(DEFAULT_NO_QT_DEVICES
  "Disable all qt devices by default (ON) or enable qt devices individually by default (OFF)"
  OFF
  )

option(DEFAULT_NO_CAIRO_DEVICES
  "Disable all cairo devices by default (ON) or enable cairo devices individually by default (OFF)"
  OFF
  )

if(DEFAULT_ALL_DEVICES)
  if(DEFAULT_NO_QT_DEVICES)
    message(STATUS
      "WARNING. DEFAULT_ALL_DEVICES ON supersedes DEFAULT_NO_QT_DEVICES ON.")
    set(DEFAULT_NO_QT_DEVICES OFF
      CACHE BOOL
      "Disable all qt devices by default (ON) or enable qt devices individually by default (OFF)"
      FORCE
      )
  endif(DEFAULT_NO_QT_DEVICES)

  if(DEFAULT_NO_CAIRO_DEVICES)
    message(STATUS
      "WARNING. DEFAULT_ALL_DEVICES ON supersedes DEFAULT_NO_CAIRO_DEVICES ON.")
    set(DEFAULT_NO_CAIRO_DEVICES OFF
      CACHE BOOL
      "Disable all cairo devices by default (ON) or enable cairo devices individually by default (OFF)"
      FORCE
      )
  endif(DEFAULT_NO_CAIRO_DEVICES)
endif(DEFAULT_ALL_DEVICES)

# The DRIVERS_DEVICE_LIST defined below is a colon-separated list of
# <device>:<driver>:<enable_default>:<kind>:<familied> items.

# <device> is the name of the device (e.g., epsqt).

# <driver> is the name of the device driver (e.g., qt).

# <enable_default> should be ON or OFF and this will reflect in
# inclusion/exclusion by default (as shown by ccmake).

# <kind> should be one of F (file), I (interactive), M (memory), E
# (external), or N (null, i.e., valid prototype drive that produces
# no results.)

# <familed> should be either ON or OFF depending on whether familying is
# a necessity for this device to generate multipage plots.

# <device>, <driver>, and <enable_default> are fundamental data that
# help to determine the list of enabled drivers, DRIVERS_LIST (used in
# the summary), and list of enabled devices, DEVICES_LIST (used in the
# summary and also when iterating over enabled devices in the build
# system).  <kind> is used (in drivers-finish.cmake) to determine
# which enabled devices are included in the FILE_DEVICES_LIST (which
# also includes <familied> information), and <kind> is used to
# determine (again in drivers-finish.cmake) which enabled devices are
# included in the INTERACTIVE_DEVICES_LIST.  Both FILE_DEVICES_LIST
# and INTERACTIVE_DEVICES_LIST are used in the examples subdirectory
# to set up testing of file devices and interactive devices.

# Ordered alphabetically by second in each pair (the driver) and then
# alphabetically by device (the first in each pair) for human
# consumption, but this is not necessary.

set(DRIVERS_DEVICE_LIST
  "aqt:aqt:ON:I:OFF"
  "memcairo:cairo:ON:M:OFF"
  "extcairo:cairo:ON:E:OFF"
  "pdfcairo:cairo:ON:F:OFF"
  "pngcairo:cairo:ON:F:ON"
  "pscairo:cairo:ON:F:OFF"
  "epscairo:cairo:ON:F:ON"
  "svgcairo:cairo:ON:F:ON"
  "xcairo:cairo:ON:I:OFF"
  "wincairo:cairo:ON:I:OFF"
  # new example 16 shows severe valgrind issues with this device.
  "cgm:cgm:OFF:F:OFF"
  "epsqt:qt:ON:F:ON"
  "pdfqt:qt:ON:F:ON"
  "qtwidget:qt:ON:I:OFF"
  "bmpqt:qt:ON:F:ON"
  "jpgqt:qt:ON:F:ON"
  "pngqt:qt:ON:F:ON"
  "ppmqt:qt:ON:F:ON"
  "tiffqt:qt:ON:F:ON"
  "extqt:qt:ON:E:OFF"
  "memqt:qt:ON:M:OFF"
  # Currently does not validate at http://validator.w3.org/, but that appears
  # to be a result of the validator being unfamiliar with SVG-1.2 (a draft
  # SVG standard that has not been finalized yet) which is produced
  # by Qt4.  The validation errors
  # referred to the version number (1.2) and one attribute (vector-effect)
  # which is clearly documented in the 1.2 draft.  Also, text offset issues
  # which were in SVG results produced by QT-4.4.3 are gone for QT-4.5.0.
  # Therefore, the conclusion is to enable svgqt by default.
  "svgqt:qt:ON:F:ON"
  # gd related devices are not maintained.
  "gif:gd:OFF:F:ON"
  "jpeg:gd:OFF:F:ON"
  "png:gd:OFF:F:ON"
  "mem:mem:ON:M:OFF"
  "ntk:ntk:ON:I:OFF"
  "null:null:ON:N:OFF"
  "pdf:pdf:ON:F:OFF"
  # (2007-09-01) As discussed on list, don't enable plmeta until we sort
  # out the known issues (e.g., strings, aspect ratio, and TrueType fonts).
  # This is going to take time/energy for some volunteer who has not volunteered
  # yet.... :-)
  "plmeta:plmeta:OFF:F:OFF"
  "ps:ps:ON:F:OFF"
  "psc:ps:ON:F:OFF"
  # No longer segfaults, but still default OFF because cleaner/better ways
  # (psttf and pscairo) to get modern fonts for postscript results.
  "pstex:pstex:OFF:F:OFF"
  "psttf:psttf:ON:F:OFF"
  "psttfc:psttf:ON:F:OFF"
  "svg:svg:ON:F:ON"
  "tk:tk:ON:I:OFF"
  "tkwin:tkwin:ON:E:OFF"
  "wingcc:wingcc:ON:I:OFF"
  "wxwidgets:wxwidgets:ON:I:OFF"
  # Retire this unmaintained/broken device.
  #"wxpng:wxwidgets:OFF:F:ON"
  "xfig:xfig:ON:F:ON"
  "xwin:xwin:ON:I:OFF"
  "wingdi:wingdi:OFF:I:OFF"
  )

# PRESET_DEFAULT keeps track of whether the DEFAULT value has been
# preset.

if(DEFAULT_ALL_DEVICES)
  set(DEFAULT ON)
  set(PRESET_DEFAULT ON)
elseif(DEFAULT_NO_DEVICES)
  set(DEFAULT OFF)
  set(PRESET_DEFAULT ON)
else(DEFAULT_ALL_DEVICES)
  set(PRESET_DEFAULT OFF)
endif(DEFAULT_ALL_DEVICES)

foreach(DRIVERS_DEVICE ${DRIVERS_DEVICE_LIST})
  string(REGEX REPLACE "^(.*):.*:.*:.*:.*$" "\\1" DEVICE ${DRIVERS_DEVICE})
  string(REGEX REPLACE "^.*:.*:.*:(.*):.*$" "\\1" KIND ${DRIVERS_DEVICE})
  string(REGEX REPLACE "^.*:.*:.*:.*:(.*)$" "\\1" REQUIRE_FAMILYING ${DRIVERS_DEVICE})
  # Check that you don't have the invalid combination of a non-file device
  # that requires familying.
  if(REQUIRE_FAMILYING AND NOT KIND STREQUAL "F")
    message(FATAL_ERROR "Invalid combination of REQUIRE_FAMILYING = ${REQUIRE_FAMILYING} AND KIND = ${KIND} for DEVICE = ${DEVICE}")
  endif(REQUIRE_FAMILYING AND NOT KIND STREQUAL "F")

  # DRIVERS_DEVICE only used in one case below:
  set(USED_DRIVERS_DEVICE OFF)
  if(NOT PRESET_DEFAULT)
    # must set DEFAULT value since it hasn't been preset.
    if(DEFAULT_NO_QT_DEVICES AND DEVICE MATCHES ".*qt.*" AND NOT DEVICE STREQUAL "aqt")
      set(DEFAULT OFF)
    elseif(DEFAULT_NO_CAIRO_DEVICES AND DEVICE MATCHES ".*cairo.*")
      set(DEFAULT OFF)
    else(DEFAULT_NO_QT_DEVICES AND DEVICE MATCHES ".*qt.*" AND NOT DEVICE STREQUAL "aqt")
      string(REGEX REPLACE "^.*:.*:(.*):.*:.*$" "\\1" DEFAULT ${DRIVERS_DEVICE})
      set(USED_DRIVERS_DEVICE ON)
    endif(DEFAULT_NO_QT_DEVICES AND DEVICE MATCHES ".*qt.*" AND NOT DEVICE STREQUAL "aqt")
  endif(NOT PRESET_DEFAULT)
  #message(STATUS "DEBUG: DEVICE = ${DEVICE}")
  #message(STATUS "DEBUG: DEFAULT= ${DEFAULT}")
  option(PLD_${DEVICE} "Enable ${DEVICE} device" ${DEFAULT})
  if(PLD_${DEVICE} AND USED_DRIVERS_DEVICE AND NOT ${DEFAULT})
    message(STATUS
      "WARNING: You have enabled the PLD_${DEVICE} device which is disabled by "
      "default either because it is deprecated or because there are know issues "
      "with it. Please check the documentation / release notes for details.")
  endif(PLD_${DEVICE} AND USED_DRIVERS_DEVICE AND NOT ${DEFAULT})
endforeach(DRIVERS_DEVICE)

if(PLD_plmeta)
  set(ENABLE_plrender ON)
else(PLD_plmeta)
  set(ENABLE_plrender OFF)
endif(PLD_plmeta)