File: cairo.cmake

package info (click to toggle)
plplot 5.9.0-8
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 26,256 kB
  • ctags: 9,353
  • sloc: ansic: 64,079; xml: 22,799; cpp: 8,562; tcl: 8,314; perl: 4,872; python: 4,462; f90: 4,310; java: 4,090; sh: 1,481; makefile: 261; php: 102; fortran: 59; sed: 5
file content (147 lines) | stat: -rw-r--r-- 5,296 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
# 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, memcairo, and xcairo devices).
#
# The following variables are set / modified
#
# 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
)
  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)
  endif(NOT PKG_CONFIG_EXECUTABLE)
endif(
   PLD_memcairo
OR PLD_pdfcairo
OR PLD_pngcairo
OR PLD_pscairo
OR PLD_svgcairo 
OR PLD_xcairo
)

if(
   PLD_memcairo
OR PLD_pdfcairo
OR PLD_pngcairo
OR PLD_pscairo
OR PLD_svgcairo 
OR PLD_xcairo
)
  pkg_check_pkgconfig(
  pangocairo
  includedir
  linkdir
  linkflags 
  cflags
  _CAIRO
  )
  if(linkflags)
    set(cairo_RPATH ${linkdir})
    if(PLD_xcairo AND X11_COMPILE_FLAGS)
      # Blank-delimited required.
      string(REGEX REPLACE ";" " " 
      cairo_COMPILE_FLAGS "${cflags} ${X11_COMPILE_FLAGS}"
      )
      # Convert X linker information to preferred CMake form before appending
      # it to already converted ${linkflags}
      cmake_link_flags(
      cairo_X_LINK_FLAGS
      "-L${X11_LIBRARY_DIR};${X11_LIBRARIES}"
      )
      set(cairo_LINK_FLAGS ${linkflags} ${cairo_X_LINK_FLAGS})
    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)
  endif(linkflags)
endif(
   PLD_memcairo
OR PLD_pdfcairo
OR PLD_pngcairo
OR PLD_pscairo
OR PLD_svgcairo 
OR PLD_xcairo
)