File: xwin.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 (61 lines) | stat: -rw-r--r-- 2,712 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
# cmake/modules/xwin.cmake
#
# Copyright (C) 2006  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 for determining all configuration variables related to the xwin
# device driver.
# The following variables are set/modified:
# PLD_xwin		  - ON means the xwin device is enabled.
# xwin_COMPILE_FLAGS	  - individual COMPILE_FLAGS required to compile xwin
# 			    device.
# xwin_LINK_FLAGS	  - individual LINK_FLAGS for dynamic xwin device.
# DRIVERS_LINK_FLAGS	  - list of LINK_FLAGS for all static devices.
# HAVE_PTHREAD		  - ON means use pthreads with xwin driver.
# PLPLOT_MUTEX_RECURSIVE  - Portable definition for PTHREAD_MUTEX_RECURSIVE
if(PLD_xwin)
  if(X11_FOUND)
    set(xwin_COMPILE_FLAGS "${X11_COMPILE_FLAGS}")
    # N.B. X11_LIBRARY_DIR is used internally by FindX11.cmake but not
    # documented for external use so we may have to replace this
    # some day by the appropriate 
    # "GET_FILENAME_COMPONENT(X11_LIBRARY_DIR ??? PATH)" logic.
    # But this works for now....
    set(xwin_LINK_FLAGS "-L${X11_LIBRARY_DIR} ${X11_LIBRARIES}")
    option(HAVE_PTHREAD "Use pthreads with the xwin driver" OFF)
    if(HAVE_PTHREAD)
      find_package(Threads)
      if(CMAKE_USE_PTHREADS_INIT)
        set(xwin_LINK_FLAGS ${xwin_LINK_FLAGS} ${CMAKE_THREAD_LIBS_INIT})
	if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
	  set(PLPLOT_MUTEX_RECURSIVE "PTHREAD_MUTEX_RECURSIVE_NP")
	else(CMAKE_SYSTEM_NAME STREQUAL "Linux")
	  set(PLPLOT_MUTEX_RECURSIVE "PTHREAD_MUTEX_RECURSIVE")
	endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
      else(CMAKE_USE_PTHREADS_INIT)
        # I am being super-careful here to follow the autotools model.  In
        # fact, it is possible other thread systems will work as well as
	# pthreads.  So something to investigate for later.
        set(HAVE_PTHREAD OFF)
      endif(CMAKE_USE_PTHREADS_INIT)
    endif(HAVE_PTHREAD)
    set(DRIVERS_LINK_FLAGS ${DRIVERS_LINK_FLAGS} ${xwin_LINK_FLAGS})
  else(X11_FOUND)
    set(PLD_xwin OFF CACHE BOOL "Enable xwin device" FORCE)
  endif(X11_FOUND)
endif(PLD_xwin)