~uhh-ssd/+junk/humidity_readout

« back to all changes in this revision

Viewing changes to plplot/plplot-5.9.9/cmake/modules/qt.cmake

  • Committer: Joachim Erfle
  • Date: 2013-07-24 13:53:41 UTC
  • Revision ID: joachim.erfle@desy.de-20130724135341-1qojpp701zsn009p
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# cmake/modules/qt.cmake
 
2
#
 
3
# Copyright (C) 2009 Alan W. Irwin
 
4
#
 
5
# This file is part of PLplot.
 
6
#
 
7
# PLplot is free software; you can redistribute it and/or modify
 
8
# it under the terms of the GNU Library General Public License as published
 
9
# by the Free Software Foundation; version 2 of the License.
 
10
#
 
11
# PLplot is distributed in the hope that it will be useful,
 
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
# GNU Library General Public License for more details.
 
15
#
 
16
# You should have received a copy of the GNU Library General Public License
 
17
# along with the file PLplot; if not, write to the Free Software
 
18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 
19
 
 
20
# Module for determining all configuration variables related to the qt
 
21
# device driver, the plplotqt library, and the plplot_pyqt4 Python extension
 
22
# module.
 
23
# The following variables are set/modified:
 
24
# PLD_bmpqt               - ON means the bmpqt device is enabled.
 
25
# PLD_jpgqt               - ON means the jpgqt device is enabled.
 
26
# PLD_pngqt               - ON means the pngqt device is enabled.
 
27
# PLD_ppmqt               - ON means the ppmqt device is enabled.
 
28
# PLD_tiffqt              - ON means the tiffqt device is enabled.
 
29
# PLD_epsqt               - ON means the epsqt device is enabled.
 
30
# PLD_pdfqt               - ON means the pdfqt device is enabled.
 
31
# PLD_qtwidget            - ON means the qtwidget device is enabled.
 
32
# PLD_svgqt               - ON means the svgqt device is enabled.
 
33
# PLD_extqt               - ON means the extqt device is enabled.
 
34
# PLD_memqt               - ON means the memqt device is enabled.
 
35
# qt_COMPILE_FLAGS        - individual COMPILE_FLAGS required to compile wxwidgets
 
36
#                           device.
 
37
# qt_LINK_FLAGS           - list of full path names of libraries and
 
38
# qt_TARGETS              - list of targets which the qt dynamic device
 
39
#                           depends on.
 
40
#                           linker flags for dynamic wxwidgets device driver.
 
41
# qt_RPATH                - RPATH directory list for qt device driver.
 
42
# DRIVERS_LINK_FLAGS      - list of device LINK_FLAGS for case when
 
43
#                           ENABLE_DYNDRIVERS OFF.  (qt_TARGETS not included
 
44
#                           since source code used instead of this target
 
45
#                           for ENABLE_DYNDRIVERS OFF.)
 
46
# qt_SOURCE               - list of source files to be appended to qt.cpp.
 
47
# ENABLE_qt               - ON means the plplot_qt library is enabled.
 
48
# ENABLE_pyqt4            - ON means the plplot_pyqt4 Python extension module
 
49
#                           is enabled.
 
50
# SIP_EXECUTABLE          - full path for sip
 
51
# PYQT_SIP_DIR            - sip system directory
 
52
# PYQT_SIP_FLAGS          - sip command flags
 
53
 
 
54
# valgrind shows severe memory management problems with qt_example and
 
55
# qt_example either segfaults or hangs when ENABLE_DYNDRIVERS is OFF.
 
56
# I presume this is due to some linking issue for that case, but for
 
57
# now disable PLD_extqt when ENABLE_DYNDRIVERS is OFF until someone can
 
58
# investigate this issue further.
 
59
 
 
60
if(PLD_extqt AND NOT ENABLE_DYNDRIVERS)
 
61
  message(STATUS "WARNING: ENABLE_DYNDRIVERS is OFF so force PLD_extqt to be OFF")
 
62
  set(PLD_extqt OFF CACHE BOOL "Enable Qt ext device" FORCE)
 
63
endif(PLD_extqt AND NOT ENABLE_DYNDRIVERS)
 
64
 
 
65
if(PLD_bmpqt OR PLD_jpgqt OR PLD_pngqt OR PLD_ppmqt OR PLD_tiffqt OR PLD_epsqt OR PLD_pdfqt OR PLD_qtwidget OR PLD_svgqt OR PLD_extqt OR PLD_memqt)
 
66
  set(ANY_QT_DEVICE ON)
 
67
endif(PLD_bmpqt OR PLD_jpgqt OR PLD_pngqt OR PLD_ppmqt OR PLD_tiffqt OR PLD_epsqt OR PLD_pdfqt OR PLD_qtwidget OR PLD_svgqt OR PLD_extqt OR PLD_memqt)
 
68
 
 
69
if(ANY_QT_DEVICE)
 
70
  if(NOT CMAKE_CXX_COMPILER_WORKS)
 
71
    message(STATUS "WARNING: no working C++ compiler so "
 
72
      "disabling all qt devices."
 
73
      )
 
74
    set(ANY_QT_DEVICE OFF)
 
75
  endif(NOT CMAKE_CXX_COMPILER_WORKS)
 
76
endif(ANY_QT_DEVICE)
 
77
 
 
78
if(ANY_QT_DEVICE)
 
79
  find_package(Qt4)
 
80
  if(QT4_FOUND)
 
81
    if(PLD_svgqt AND ${QT_VERSION_MINOR} GREATER 2)
 
82
      set(QT_USE_QTSVG 1)
 
83
    endif(PLD_svgqt AND ${QT_VERSION_MINOR} GREATER 2)
 
84
    # Do not include(${QT_USE_FILE}) here because it contaminates ALL 
 
85
    # build environments with Qt flags from the top-level directory on
 
86
    # down.  Instead include(${QT_USE_FILE}) only in certain subdirectories
 
87
    # where it is necessary.
 
88
    set(qt_COMPILE_FLAGS)
 
89
    foreach(DIR ${QT_INCLUDES})
 
90
      set(qt_COMPILE_FLAGS "${qt_COMPILE_FLAGS} -I${DIR}")
 
91
    endforeach(DIR ${QT_INCLUDES})
 
92
    
 
93
    set(qt_LINK_FLAGS)
 
94
    set(qt_RPATH ${QT_LIBRARY_DIR})
 
95
    filter_rpath(qt_RPATH)
 
96
    #message("qt_LIBRARY_DIR = ${qt_LIBRARY_DIR}")
 
97
  else(QT4_FOUND)
 
98
    message(STATUS "WARNING: Qt4 development environment not found so "
 
99
      "disabling all qt devices."
 
100
      )
 
101
    set(ANY_QT_DEVICE OFF)
 
102
  endif(QT4_FOUND)
 
103
endif(ANY_QT_DEVICE)
 
104
 
 
105
if(NOT ANY_QT_DEVICE)
 
106
    set(PLD_bmpqt OFF CACHE BOOL "Enable Qt Windows bmp device" FORCE)
 
107
    set(PLD_jpgqt OFF CACHE BOOL "Enable Qt jpg device" FORCE)
 
108
    set(PLD_pngqt OFF CACHE BOOL "Enable Qt png device" FORCE)
 
109
    set(PLD_ppmqt OFF CACHE BOOL "Enable Qt ppm device" FORCE)
 
110
    set(PLD_tiffqt OFF CACHE BOOL "Enable Qt tiff device" FORCE)
 
111
    set(PLD_epsqt OFF CACHE BOOL "Enable Qt EPS device" FORCE)
 
112
    set(PLD_pdfqt OFF CACHE BOOL "Enable Qt PDF device" FORCE)
 
113
    set(PLD_qtwidget OFF CACHE BOOL "Enable Qt interactive device" FORCE)
 
114
    set(PLD_svgqt OFF CACHE BOOL "Enable Qt SVG device" FORCE)
 
115
    set(PLD_extqt OFF CACHE BOOL "Enable Qt ext device" FORCE)
 
116
    set(PLD_memqt OFF CACHE BOOL "Enable Qt mem device" FORCE)
 
117
endif(NOT ANY_QT_DEVICE)
 
118
 
 
119
if(DEFAULT_NO_BINDINGS)
 
120
  option(ENABLE_qt "Enable Qt bindings" OFF)
 
121
  option(ENABLE_pyqt4 "Enable pyqt4 Python extension module" OFF)
 
122
else(DEFAULT_NO_BINDINGS)
 
123
  option(ENABLE_qt "Enable Qt bindings" ON)
 
124
  option(ENABLE_pyqt4 "Enable pyqt4 Python extension module" ON)
 
125
endif(DEFAULT_NO_BINDINGS)
 
126
 
 
127
if(ENABLE_qt AND NOT PLD_extqt)
 
128
  message(STATUS
 
129
    "WARNING: PLD_extqt is OFF so "
 
130
    "setting ENABLE_qt to OFF."
 
131
    )
 
132
  set(ENABLE_qt OFF CACHE BOOL "Enable Qt bindings" FORCE)
 
133
endif(ENABLE_qt AND NOT PLD_extqt)
 
134
 
 
135
if(ENABLE_pyqt4 AND NOT ENABLE_python)
 
136
  message(STATUS
 
137
    "WARNING: ENABLE_python is OFF so "
 
138
    "setting ENABLE_pyqt4 to OFF."
 
139
    )
 
140
  set(ENABLE_pyqt4 OFF CACHE BOOL "Enable pyqt4 Python extension module " FORCE)
 
141
endif(ENABLE_pyqt4 AND NOT ENABLE_python)
 
142
 
 
143
if(ENABLE_pyqt4 AND NOT ENABLE_qt)
 
144
  message(STATUS
 
145
    "WARNING: ENABLE_qt is OFF so "
 
146
    "setting ENABLE_pyqt4 to OFF."
 
147
    )
 
148
  set(ENABLE_pyqt4 OFF CACHE BOOL "Enable pyqt4 Python extension module " FORCE)
 
149
endif(ENABLE_pyqt4 AND NOT ENABLE_qt)
 
150
 
 
151
if(ENABLE_qt)
 
152
  set(qt_gui_true "")
 
153
else(ENABLE_qt)
 
154
  set(qt_gui_true "#")
 
155
endif(ENABLE_qt)
 
156
 
 
157
if(ANY_QT_DEVICE)
 
158
  if(ENABLE_DYNDRIVERS)
 
159
    if(ENABLE_qt)
 
160
      set(qt_SOURCE)
 
161
      set(qt_TARGETS plplotqt${LIB_TAG})
 
162
    else(ENABLE_qt)
 
163
      # if qt disabled, then must include full source and forget
 
164
      # qt_TARGETS for this dynamic device.
 
165
      set(qt_SOURCE ${CMAKE_SOURCE_DIR}/bindings/qt_gui/plqt.cpp)
 
166
    endif(ENABLE_qt)
 
167
  else(ENABLE_DYNDRIVERS)
 
168
    # N.B. no qt_TARGETS here since use appropriate source code (see below)
 
169
    # instead to break circular linking.
 
170
    set(DRIVERS_LINK_FLAGS ${DRIVERS_LINK_FLAGS} ${qt_LINK_FLAGS})
 
171
    set(qt_SOURCE ${CMAKE_SOURCE_DIR}/bindings/qt_gui/plqt.cpp)
 
172
  endif(ENABLE_DYNDRIVERS)
 
173
endif(ANY_QT_DEVICE)
 
174
 
 
175
if(ENABLE_pyqt4)
 
176
  find_program(SIP_EXECUTABLE sip)
 
177
  if(NOT SIP_EXECUTABLE)
 
178
    message(STATUS
 
179
      "WARNING: sip not found so setting ENABLE_pyqt4 to OFF."
 
180
      )
 
181
    set(ENABLE_pyqt4 OFF CACHE BOOL "Enable pyqt4 Python extension module " FORCE)
 
182
  endif(NOT SIP_EXECUTABLE)
 
183
endif(ENABLE_pyqt4)
 
184
 
 
185
if(ENABLE_pyqt4)
 
186
  execute_process(
 
187
    COMMAND ${PYTHON_EXECUTABLE} -c "from PyQt4 import pyqtconfig; print pyqtconfig.Configuration().pyqt_sip_dir"
 
188
    OUTPUT_VARIABLE PYQT_SIP_DIR
 
189
    RESULT_VARIABLE PYQT_SIP_DIR_ERR
 
190
    OUTPUT_STRIP_TRAILING_WHITESPACE
 
191
    )
 
192
  if(PYQT_SIP_DIR_ERR)
 
193
    message(STATUS
 
194
      "WARNING: could not find sip directory so setting ENABLE_pyqt4 to OFF."
 
195
      )
 
196
    set(ENABLE_pyqt4 OFF CACHE BOOL "Enable pyqt4 Python extension module " FORCE)
 
197
  endif(PYQT_SIP_DIR_ERR)
 
198
endif(ENABLE_pyqt4)
 
199
 
 
200
if(ENABLE_pyqt4)
 
201
  execute_process(
 
202
    COMMAND ${PYTHON_EXECUTABLE} -c "from PyQt4 import pyqtconfig; print pyqtconfig.Configuration().pyqt_sip_flags"
 
203
    OUTPUT_VARIABLE PYQT_SIP_FLAGS
 
204
    RESULT_VARIABLE PYQT_SIP_FLAGS_ERR
 
205
    OUTPUT_STRIP_TRAILING_WHITESPACE
 
206
    )
 
207
  if(PYQT_SIP_FLAGS_ERR)
 
208
    message(STATUS
 
209
      "WARNING: could not find sip flags so setting ENABLE_pyqt4 to OFF."
 
210
      )
 
211
    set(ENABLE_pyqt4 OFF CACHE BOOL "Enable pyqt4 Python extension module " FORCE)
 
212
  endif(PYQT_SIP_FLAGS_ERR)
 
213
  # Must change from blank-delimited string to CMake list so that sip
 
214
  # COMMAND will work properly with these flags later on.
 
215
  string(REGEX REPLACE " " ";"PYQT_SIP_FLAGS "${PYQT_SIP_FLAGS}") 
 
216
endif(ENABLE_pyqt4)