File: cairo.cmake

package info (click to toggle)
plplot 5.9.5-4
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 32,964 kB
  • ctags: 11,898
  • sloc: ansic: 71,866; xml: 25,294; cpp: 13,070; tcl: 10,310; f90: 5,963; perl: 5,661; python: 5,068; java: 4,944; ml: 4,057; sh: 1,754; php: 267; makefile: 198; lisp: 75; fortran: 64; sed: 5
file content (165 lines) | stat: -rw-r--r-- 6,055 bytes parent folder | download
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
# cmake/modules/cairo.cmake
#
# Copyright (C) 2007  Hazen Babcock
#
# 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

# Configuration for the cairo device driver (supporting the memcairo,
# pdfcairo, pngcairo, pscairo, svgcairo and xcairo devices).
#
# The following variables are set / modified
#
# PLD_extcairo            - ON means the extcairo device is enabled.
# PLD_memcairo            - ON means the memcairo device is enabled.
# PLD_pdfcairo		  - ON means the pdfcairo device is enabled.
# PLD_pngcairo		  - ON means the pngcairo device is enabled.
# PLD_pscairo		  - ON means the pscairo device is enabled.
# PLD_svgcairo		  - ON means the svgcairo device is enabled.
# PLD_xcairo		  - ON means the xcairo device is enabled.
# cairo_COMPILE_FLAGS	  - Blank-delimited COMPILE_FLAGS required to
# 			    compile cairo device drivers.
# cairo_LINK_FLAGS	  - list of full path names of libraries and
# 			    linker flags for dynamic cairo device driver.
# cairo_RPATH	       	  - RPATH directory list for cairo device driver.
# 			    current assumption is the list only has one 
#			    element corresponding to the pkg-config libdir
#			    variable for pangocairo.
# DRIVERS_LINK_FLAGS	  - list of device LINK_FLAGS for case
# 			    when ENABLE_DYNDRIVERS OFF.

# Include file searches use FindPath. To add extra search directories
# set the environment variable CMAKE_INCLUDE_PATH.
# Library searches use FindLibrary. To add extra search directories
# set the environment variable CMAKE_LIBRARY_PATH.
# See cmake documentation for further details.

# Look for cairo headers and libraries with pkg-config
if(
   PLD_memcairo
OR PLD_pdfcairo
OR PLD_pngcairo
OR PLD_pscairo
OR PLD_svgcairo 
OR PLD_xcairo
OR PLD_extcairo
)
  if(NOT PKG_CONFIG_EXECUTABLE)
    message(STATUS 
    "WARNING: pkg-config not found. Setting cairo drivers to OFF."
    )
    set(PLD_memcairo OFF CACHE BOOL "Enable memcairo device" FORCE)
    set(PLD_pdfcairo OFF CACHE BOOL "Enable pdfcairo device" FORCE)
    set(PLD_pngcairo OFF CACHE BOOL "Enable pngcairo device" FORCE)
    set(PLD_pscairo OFF CACHE BOOL "Enable pscairo device" FORCE)
    set(PLD_svgcairo OFF CACHE BOOL "Enable svgcairo device" FORCE)
    set(PLD_xcairo OFF CACHE BOOL "Enable xcairo device" FORCE)
    set(PLD_extcairo OFF CACHE BOOL "Enable extcairo device" FORCE)
  endif(NOT PKG_CONFIG_EXECUTABLE)
endif(
   PLD_memcairo
OR PLD_pdfcairo
OR PLD_pngcairo
OR PLD_pscairo
OR PLD_svgcairo 
OR PLD_xcairo
OR PLD_extcairo
)

if(
   PLD_memcairo
OR PLD_pdfcairo
OR PLD_pngcairo
OR PLD_pscairo
OR PLD_svgcairo 
OR PLD_xcairo
OR PLD_extcairo
)
  pkg_check_pkgconfig(
  pangocairo
  includedir
  linkdir
  linkflags 
  cflags
  version
  _CAIRO
  )
  if(linkflags)
    # Check that the pangocairo library version is recent 
    # enough to efficiently handle text clipping.
    # If it is not then we print a warning.
    transform_version(NUMERICAL_PANGOCAIRO_MINIMUM_VERSION "1.20.5")
    transform_version(NUMERICAL_PANGOCAIRO_VERSION "${version}")
    if(NUMERICAL_PANGOCAIRO_VERSION LESS "${NUMERICAL_PANGOCAIRO_MINIMUM_VERSION}")
      message("Pango Cairo version (${version}) < 1.20.5, if text rendering is slow recommend turning off text clipping")
    endif(NUMERICAL_PANGOCAIRO_VERSION LESS "${NUMERICAL_PANGOCAIRO_MINIMUM_VERSION}")
    set(cairo_RPATH ${linkdir})
    if(PLD_xcairo AND X11_COMPILE_FLAGS)
      # Blank-delimited required.
      string(REGEX REPLACE ";" " " 
      cairo_COMPILE_FLAGS "${cflags} ${X11_COMPILE_FLAGS}"
      )
      set(cairo_LINK_FLAGS ${linkflags} ${X11_LIBRARIES})
    else(PLD_xcairo AND X11_COMPILE_FLAGS)
      message(STATUS 
       "WARNING: X windows not found. Setting xcairo driver to OFF."
      )
      # Blank-delimited required.
      set(PLD_xcairo OFF CACHE BOOL "Enable xcairo device" FORCE)
      # now deal with remaining cairo devices.
      string(REGEX REPLACE ";" " " cairo_COMPILE_FLAGS "${cflags}")
      set(cairo_LINK_FLAGS ${linkflags})
    endif(PLD_xcairo AND X11_COMPILE_FLAGS)
    
    #message("cairo_COMPILE_FLAGS = ${cairo_COMPILE_FLAGS}")
    #message("cairo_LINK_FLAGS = ${cairo_LINK_FLAGS}")

    list(APPEND DRIVERS_LINK_FLAGS ${cairo_LINK_FLAGS})
  else(linkflags)
    message("includedir = ${includedir}")
    message("libdir = ${libdir}")
    message("linkflags = ${linkflags}")
    message("cflags = ${cflags}")
    message(STATUS
       "WARNING: pango and/or cairo not found with pkg-config.\n"
    "   Disabling cairo drivers.  To enable these drivers you must install\n"
    "   development versions of pango and cairo and/or set\n"
    "   the environment variable PKG_CONFIG_PATH appropriately."
    )
    set(PLD_memcairo OFF CACHE BOOL "Enable memcairo device" FORCE)
    set(PLD_pdfcairo OFF CACHE BOOL "Enable pdfcairo device" FORCE)
    set(PLD_pngcairo OFF CACHE BOOL "Enable pngcairo device" FORCE)
    set(PLD_pscairo OFF CACHE BOOL "Enable pscairo device" FORCE)
    set(PLD_svgcairo OFF CACHE BOOL "Enable svgcairo device" FORCE)
    set(PLD_xcairo OFF CACHE BOOL "Enable xcairo device" FORCE)
    set(PLD_extcairo OFF CACHE BOOL "Enable extcairo device" FORCE)
  endif(linkflags)
endif(
   PLD_memcairo
OR PLD_pdfcairo
OR PLD_pngcairo
OR PLD_pscairo
OR PLD_svgcairo 
OR PLD_xcairo
OR PLD_extcairo
)

if(NOT PLD_xcairo)
  set(extXdrawable_true "#")
endif(NOT PLD_xcairo)

if(NOT PLD_extcairo)
  set(extcairo_true "#")
endif(NOT PLD_extcairo)