File: drivers-finish.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 (170 lines) | stat: -rw-r--r-- 7,260 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
# cmake/modules/drivers-finish.cmake
#
# Finalize 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 finalize device options.

# Results are contained in the following variables:
# DRIVERS_LIST: list of device drivers (e.g., gd for the png and jpeg devices)
# where at least one of the associated devices is enabled.

# DEVICES_LIST: list of devices (e.g. png, jpeg), where device is enabled.

# FILE_DEVICES_LIST: list of colon-separated information for enabled
# file devices.  The information included is
# <devicename>:<drivername>:<familied>, where familied is ON or OFF
# (depending on whether familying is required for multi-page results).

# INTERACTIVE_DEVICES_LIST: list of colon-separated information for
# enabled interactive devices.  The information included is
# <devicename>:<drivername>.

# N.B. DRIVERS_LIST is used below to create data to help test plug-in
# devices.  Also, it is output in the summary.  DEVICES_LIST is used
# to iterate through all enabled devices (notably in the drivers and
# src subdirectories).  Also, it is output in the summary. Both
# FILE_DEVICES_LIST and INTERACTIVE_DEVICES_LIST are used in the
# examples subdirectory to set up testing of file devices and
# interactive devices.
set(DRIVERS_LIST)
set(DEVICES_LIST)
set(FILE_DEVICES_LIST)
set(INTERACTIVE_DEVICES_LIST)

foreach(DRIVERS_DEVICE ${DRIVERS_DEVICE_LIST})
  string(REGEX REPLACE "^(.*):.*:.*:.*:.*$" "\\1" DEVICE ${DRIVERS_DEVICE})
  if(PLD_${DEVICE})
    list(APPEND DEVICES_LIST ${DEVICE})
    string(REGEX REPLACE "^.*:(.*):.*:.*:.*$" "\\1" DRIVER ${DRIVERS_DEVICE})
    string(REGEX REPLACE "^.*:.*:.*:(.*):.*$" "\\1" KIND ${DRIVERS_DEVICE})
    string(REGEX REPLACE "^.*:.*:.*:.*:(.*)$" "\\1" REQUIRE_FAMILYING ${DRIVERS_DEVICE})
    if(KIND STREQUAL "F")
      list(APPEND FILE_DEVICES_LIST "${DEVICE}:${DRIVER}:${REQUIRE_FAMILYING}")
    elseif(KIND STREQUAL "I")
      list(APPEND INTERACTIVE_DEVICES_LIST ${DEVICE}:${DRIVER})
    endif(KIND STREQUAL "F")

    set(APPEND_DRIVER ON)
    foreach(DRIVER_IN_LIST ${DRIVERS_LIST})
      if(DRIVER STREQUAL "${DRIVER_IN_LIST}")
        set(APPEND_DRIVER OFF)
      endif(DRIVER STREQUAL "${DRIVER_IN_LIST}")
    endforeach(DRIVER_IN_LIST ${DRIVERS_LIST})
    if(APPEND_DRIVER)
      if(ENABLE_DYNDRIVERS)
      	set(${DRIVER}_INFO)
	if(EXISTS ${CMAKE_SOURCE_DIR}/drivers/${DRIVER}.driver_info.in)
          file(STRINGS
  	    ${CMAKE_SOURCE_DIR}/drivers/${DRIVER}.driver_info.in
	    ${DRIVER}_INFO
	    )
	endif(EXISTS ${CMAKE_SOURCE_DIR}/drivers/${DRIVER}.driver_info.in)
      endif(ENABLE_DYNDRIVERS)
      list(APPEND DRIVERS_LIST ${DRIVER})

      # Prepend driver's source code in the drivers directory to
      # anything set specially for the driver in question in the
      # various special CMake modules for drivers included by
      # drivers.cmake before this module (drivers-finish.cmake) is
      # included by drivers.cmake.
      if(DRIVER STREQUAL "wxwidgets")
	if(OLD_WXWIDGETS)
          set(${DRIVER}_SOURCE
            ${CMAKE_SOURCE_DIR}/drivers/deprecated_${DRIVER}.cpp
            ${CMAKE_SOURCE_DIR}/drivers/deprecated_${DRIVER}_app.cpp
            ${CMAKE_SOURCE_DIR}/drivers/deprecated_${DRIVER}_dc.cpp
            ${CMAKE_SOURCE_DIR}/drivers/deprecated_${DRIVER}_gc.cpp
            ${${DRIVER}_SOURCE}
	    )
          if(HAVE_AGG)
            set(${DRIVER}_SOURCE
              ${CMAKE_SOURCE_DIR}/drivers/deprecated_${DRIVER}_agg.cpp
              ${${DRIVER}_SOURCE}
              )
          endif(HAVE_AGG)
	else(OLD_WXWIDGETS)
          set(${DRIVER}_SOURCE
            ${CMAKE_SOURCE_DIR}/drivers/${DRIVER}.cpp
	    ${CMAKE_SOURCE_DIR}/drivers/${DRIVER}_comms.cpp
            ${CMAKE_SOURCE_DIR}/drivers/${DRIVER}_dev.cpp
            ${${DRIVER}_SOURCE}
	    )
	endif(OLD_WXWIDGETS)
      elseif(DRIVER STREQUAL "psttf")
        set(${DRIVER}_SOURCE
	        ${CMAKE_SOURCE_DIR}/drivers/${DRIVER}.cc
	        ${${DRIVER}_SOURCE}
	        )
	  elseif(DRIVER STREQUAL "qt")
        set(${DRIVER}_SOURCE
	      ${CMAKE_SOURCE_DIR}/drivers/${DRIVER}.cpp
	      ${${DRIVER}_SOURCE}
	      )
      else(DRIVER STREQUAL "wxwidgets")
        set(${DRIVER}_SOURCE
	      ${CMAKE_SOURCE_DIR}/drivers/${DRIVER}.c
	      ${${DRIVER}_SOURCE}
	      )
      endif(DRIVER STREQUAL "wxwidgets")
    endif(APPEND_DRIVER)
  endif(PLD_${DEVICE})
endforeach(DRIVERS_DEVICE)

# Calculate driver information and store it in
# ${CMAKE_BINARY_DIR}/drivers/${DRIVER}.driver_info for each driver to be compared
# at run-time with the same information obtained from the actual
# driver plug-in by test-drv-info as a check of the validity of
# that plug-in (and consistency of the driver code with DRIVERS_DEVICE_LIST
# maintained in drivers-init.cmake).
foreach(DRIVERS_DEVICE ${DRIVERS_DEVICE_LIST})
  string(REGEX REPLACE "^(.*):.*:.*:.*:.*$" "\\1" DEVICE ${DRIVERS_DEVICE})
  string(REGEX REPLACE "^.*:(.*):.*:.*:.*$" "\\1" DRIVER ${DRIVERS_DEVICE})
  if(${DRIVER}_INFO)
    if(NOT PLD_${DEVICE})
      set(DEVICE_INFO_MATCHED)
      # Must remove corresponding data from ${DRIVER}_INFO
      #message("DEVICE = ${DEVICE}")
      foreach(DEVICE_INFO ${${DRIVER}_INFO})
        string(REGEX REPLACE "^(.*):.*:.*:.*:.*:.*$" "\\1" DEVICE_INFO_NAME ${DEVICE_INFO})
        #message(STATUS "DEBUG: DEVICE_INFO_NAME = ${DEVICE_INFO_NAME}")
	if(DEVICE STREQUAL "${DEVICE_INFO_NAME}")
	  #There should one and only one match.
	  set(DEVICE_INFO_MATCHED ${DEVICE_INFO})
	endif(DEVICE STREQUAL "${DEVICE_INFO_NAME}")
      endforeach(DEVICE_INFO ${${DRIVER}_INFO})
      if(DEVICE_INFO_MATCHED)
        list(REMOVE_ITEM ${DRIVER}_INFO ${DEVICE_INFO_MATCHED})
      else(DEVICE_INFO_MATCHED)
        message(FATAL_ERROR "${CMAKE_SOURCE_DIR}/drivers/${DRIVER}.driver_info.in not consistent with ${CMAKE_SOURCE_DIR}/cmake/modules/drivers-init.cmake")
      endif(DEVICE_INFO_MATCHED)
    endif(NOT PLD_${DEVICE})
  endif(${DRIVER}_INFO)
endforeach(DRIVERS_DEVICE)

foreach(DRIVERS_DEVICE ${DRIVERS_DEVICE_LIST})
  string(REGEX REPLACE "^.*:(.*):.*:.*:.*$" "\\1" DRIVER ${DRIVERS_DEVICE})
  if(${DRIVER}_INFO)
    file(WRITE ${CMAKE_BINARY_DIR}/drivers/${DRIVER}.driver_info "")
    foreach(DEVICE_INFO ${${DRIVER}_INFO})
      string(REGEX REPLACE "^(.*:.*:.*:)(.*:)(.*:.*)$" "\\1${WRITEABLE_TARGET}\\2\\3" MODIFIED_DEVICE_INFO "${DEVICE_INFO}")
      file(APPEND ${CMAKE_BINARY_DIR}/drivers/${DRIVER}.driver_info "${MODIFIED_DEVICE_INFO}\n")
    endforeach(DEVICE_INFO ${${DRIVER}_INFO})
  endif(${DRIVER}_INFO)
endforeach(DRIVERS_DEVICE ${DRIVERS_DEVICE_LIST})