1# cmake/modules/drivers.cmake 2# 3# Start driver initializations 4# 5# Copyright (C) 2006-2015 Alan W. Irwin 6# 7# This file is part of PLplot. 8# 9# PLplot is free software; you can redistribute it and/or modify 10# it under the terms of the GNU Library General Public License as published 11# by the Free Software Foundation; version 2 of the License. 12# 13# PLplot is distributed in the hope that it will be useful, 14# but WITHOUT ANY WARRANTY; without even the implied warranty of 15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16# GNU Library General Public License for more details. 17# 18# You should have received a copy of the GNU Library General Public License 19# along with the file PLplot; if not, write to the Free Software 20# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 22# Module for configuring all device-related variables. 23 24# Results are contained in the following variables: 25# ENABLE_DYNDRIVERS (ON or OFF): whether to dynamically load device drivers. 26# PLD_devicename (ON or OFF): whether each PLplot-related device is enabled 27# or not. devicename is png, jpeg, etc. 28# devicename_COMPILE_FLAGS: compile (e.g., -I) options for each individual 29# device. 30# devicename_LINK_FLAGS: link options (e.g., -L and -l) for each 31# individual device. 32# DRIVERS_LINK_FLAGS: concatenated link options for all devices. 33# DEVICES_LIST: list of devices (e.g. png, jpeg),where PLD_devicename is ON 34# DRIVERS_LIST: list of device drivers (e.g., gd for the png and jpeg devices) 35# where at least one of the associated devices is enabled. 36 37set(DRIVERS_LINK_FLAGS) 38option(ENABLE_DYNDRIVERS "Enable dynamic loading of device drivers" ON) 39if(ENABLE_DYNDRIVERS AND NOT BUILD_SHARED_LIBS) 40 message(STATUS 41 "WARNING: Shared libraries not built. Setting ENABLE_DYNDRIVERS OFF." 42 ) 43 set(ENABLE_DYNDRIVERS OFF CACHE BOOL 44 "Enable dynamic loading of device drivers" FORCE) 45endif(ENABLE_DYNDRIVERS AND NOT BUILD_SHARED_LIBS) 46if(ENABLE_DYNDRIVERS AND WIN32_OR_CYGWIN) 47 if(NOT CYGWIN) 48 set(LTDL_WIN32 ON) 49 set(LTDL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include) 50 endif(NOT CYGWIN) 51endif(ENABLE_DYNDRIVERS AND WIN32_OR_CYGWIN) 52if(ENABLE_DYNDRIVERS AND NOT LTDL_WIN32) 53 find_package(LTDL) 54 if(LTDL_FOUND) 55 set(LTDL_LIBRARY_RPATH ${LTDL_LIBRARY_DIR}) 56 filter_rpath(LTDL_LIBRARY_RPATH) 57 message(STATUS "LTDL_INCLUDE_DIR = ${LTDL_INCLUDE_DIR}") 58 message(STATUS "LTDL_LIBRARY_DIR = ${LTDL_LIBRARY_DIR}") 59 message(STATUS "LTDL_LIBRARIES = ${LTDL_LIBRARIES}") 60 else(LTDL_FOUND) 61 message(STATUS 62 "WARNING: libltdl library not found. Setting ENABLE_DYNDRIVERS OFF.\n" 63 " Please install that library and/or set the environment variables\n" 64 " CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH appropriately." 65 ) 66 set(ENABLE_DYNDRIVERS OFF CACHE BOOL 67 "Enable dynamic loading of device drivers" FORCE) 68 endif(LTDL_FOUND) 69endif(ENABLE_DYNDRIVERS AND NOT LTDL_WIN32) 70 71# Needed to configure traditional build system for installed examples. 72if(ENABLE_DYNDRIVERS) 73 set(enable_dyndrivers_true "") 74 set(enable_dyndrivers_false "#") 75else(ENABLE_DYNDRIVERS) 76 set(enable_dyndrivers_true "#") 77 set(enable_dyndrivers_false "") 78endif(ENABLE_DYNDRIVERS) 79 80# Decide whether to enable each device or not and find special resources 81# when required. 82 83# Initialize device options (e.g., PLD_png is set to ON or OFF). 84include(drivers-init) 85 86# Find *_COMPILE_FLAGS and *_LINK_FLAGS resources for device drivers that need them, 87# and set appropriate PLD_devicename to OFF if the required resources are 88# not available. 89include(cairo) 90include(cgm) 91include(gd) 92include(xwin) 93include(tk) 94include(pstex) 95include(psttf) 96include(qt) 97include(wingcc) 98include(aqt) 99include(wxwidgets) 100include(pdf) 101include(wingdi) 102 103# Finalize device options. 104include(drivers-finish) 105