aboutsummaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2015-11-12 08:17:52 -0500
committerDrew DeVault <sir@cmpwn.com>2015-11-12 08:17:52 -0500
commitaadcba4b7cfa9ce3096fd166a046b151fd5ba8fa (patch)
tree62968b4f9a22d275965605cba155afbb69892ee0 /CMake
parent250097d32b7503b5a3fbb14b4582534ae3957035 (diff)
Add new dependencies for wayland clients
Cairo for rendering shit, Pango for text rendering, and wayland client stuff. Thanks @Cloudef, blatantly ripping off his cmake files for this
Diffstat (limited to 'CMake')
-rw-r--r--CMake/FindCairo.cmake47
-rw-r--r--CMake/FindPango.cmake47
-rw-r--r--CMake/FindWayland.cmake62
-rw-r--r--CMake/Wayland.cmake77
4 files changed, 233 insertions, 0 deletions
diff --git a/CMake/FindCairo.cmake b/CMake/FindCairo.cmake
new file mode 100644
index 00000000..36c28095
--- /dev/null
+++ b/CMake/FindCairo.cmake
@@ -0,0 +1,47 @@
+# - Try to find the cairo library
+# Once done this will define
+#
+# CAIRO_FOUND - system has cairo
+# CAIRO_INCLUDE_DIRS - the cairo include directory
+# CAIRO_LIBRARIES - Link these to use cairo
+#
+# Define CAIRO_MIN_VERSION for which version desired.
+#
+
+INCLUDE(FindPkgConfig)
+
+IF(Cairo_FIND_REQUIRED)
+ SET(_pkgconfig_REQUIRED "REQUIRED")
+ELSE(Cairo_FIND_REQUIRED)
+ SET(_pkgconfig_REQUIRED "")
+ENDIF(Cairo_FIND_REQUIRED)
+
+IF(CAIRO_MIN_VERSION)
+ PKG_SEARCH_MODULE(CAIRO ${_pkgconfig_REQUIRED} cairo>=${CAIRO_MIN_VERSION})
+ELSE(CAIRO_MIN_VERSION)
+ PKG_SEARCH_MODULE(CAIRO ${_pkgconfig_REQUIRED} cairo)
+ENDIF(CAIRO_MIN_VERSION)
+
+IF(NOT CAIRO_FOUND AND NOT PKG_CONFIG_FOUND)
+ FIND_PATH(CAIRO_INCLUDE_DIRS cairo.h)
+ FIND_LIBRARY(CAIRO_LIBRARIES cairo)
+
+ # Report results
+ IF(CAIRO_LIBRARIES AND CAIRO_INCLUDE_DIRS)
+ SET(CAIRO_FOUND 1)
+ IF(NOT Cairo_FIND_QUIETLY)
+ MESSAGE(STATUS "Found Cairo: ${CAIRO_LIBRARIES}")
+ ENDIF(NOT Cairo_FIND_QUIETLY)
+ ELSE(CAIRO_LIBRARIES AND CAIRO_INCLUDE_DIRS)
+ IF(Cairo_FIND_REQUIRED)
+ MESSAGE(SEND_ERROR "Could not find Cairo")
+ ELSE(Cairo_FIND_REQUIRED)
+ IF(NOT Cairo_FIND_QUIETLY)
+ MESSAGE(STATUS "Could not find Cairo")
+ ENDIF(NOT Cairo_FIND_QUIETLY)
+ ENDIF(Cairo_FIND_REQUIRED)
+ ENDIF(CAIRO_LIBRARIES AND CAIRO_INCLUDE_DIRS)
+ENDIF(NOT CAIRO_FOUND AND NOT PKG_CONFIG_FOUND)
+
+# Hide advanced variables from CMake GUIs
+MARK_AS_ADVANCED(CAIRO_LIBRARIES CAIRO_INCLUDE_DIRS)
diff --git a/CMake/FindPango.cmake b/CMake/FindPango.cmake
new file mode 100644
index 00000000..64bf9ac4
--- /dev/null
+++ b/CMake/FindPango.cmake
@@ -0,0 +1,47 @@
+# - Try to find the pango library
+# Once done this will define
+#
+# PANGO_FOUND - system has pango
+# PANGO_INCLUDE_DIRS - the pango include directory
+# PANGO_LIBRARIES - Link these to use pango
+#
+# Define PANGO_MIN_VERSION for which version desired.
+#
+
+INCLUDE(FindPkgConfig)
+
+IF(Pango_FIND_REQUIRED)
+ SET(_pkgconfig_REQUIRED "REQUIRED")
+ELSE(Pango_FIND_REQUIRED)
+ SET(_pkgconfig_REQUIRED "")
+ENDIF(Pango_FIND_REQUIRED)
+
+IF(PANGO_MIN_VERSION)
+ PKG_SEARCH_MODULE(PANGO ${_pkgconfig_REQUIRED} "pango>=${PANGO_MIN_VERSION} pangocairo>=${PANGO_MIN_VERSION}")
+ELSE(PANGO_MIN_VERSION)
+ PKG_SEARCH_MODULE(PANGO ${_pkgconfig_REQUIRED} "pango pangocairo")
+ENDIF(PANGO_MIN_VERSION)
+
+IF(NOT PANGO_FOUND AND NOT PKG_CONFIG_FOUND)
+ FIND_PATH(PANGO_INCLUDE_DIRS pango.h)
+ FIND_LIBRARY(PANGO_LIBRARIES pango pangocairo)
+
+ # Report results
+ IF(PANGO_LIBRARIES AND PANGO_INCLUDE_DIRS)
+ SET(PANGO_FOUND 1)
+ IF(NOT Pango_FIND_QUIETLY)
+ MESSAGE(STATUS "Found Pango: ${PANGO_LIBRARIES}")
+ ENDIF(NOT Pango_FIND_QUIETLY)
+ ELSE(PANGO_LIBRARIES AND PANGO_INCLUDE_DIRS)
+ IF(Pango_FIND_REQUIRED)
+ MESSAGE(SEND_ERROR "Could not find Pango")
+ ELSE(Pango_FIND_REQUIRED)
+ IF(NOT Pango_FIND_QUIETLY)
+ MESSAGE(STATUS "Could not find Pango")
+ ENDIF(NOT Pango_FIND_QUIETLY)
+ ENDIF(Pango_FIND_REQUIRED)
+ ENDIF(PANGO_LIBRARIES AND PANGO_INCLUDE_DIRS)
+ENDIF(NOT PANGO_FOUND AND NOT PKG_CONFIG_FOUND)
+
+# Hide advanced variables from CMake GUIs
+MARK_AS_ADVANCED(PANGO_LIBRARIES PANGO_INCLUDE_DIRS)
diff --git a/CMake/FindWayland.cmake b/CMake/FindWayland.cmake
new file mode 100644
index 00000000..00c17a3c
--- /dev/null
+++ b/CMake/FindWayland.cmake
@@ -0,0 +1,62 @@
+# Try to find Wayland on a Unix system
+#
+# This will define:
+#
+# WAYLAND_FOUND - True if Wayland is found
+# WAYLAND_LIBRARIES - Link these to use Wayland
+# WAYLAND_INCLUDE_DIR - Include directory for Wayland
+# WAYLAND_DEFINITIONS - Compiler flags for using Wayland
+#
+# In addition the following more fine grained variables will be defined:
+#
+# WAYLAND_CLIENT_FOUND WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES
+# WAYLAND_SERVER_FOUND WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES
+# WAYLAND_EGL_FOUND WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES
+#
+# Copyright (c) 2013 Martin Gräßlin <mgraesslin@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+IF (NOT WIN32)
+ IF (WAYLAND_INCLUDE_DIR AND WAYLAND_LIBRARIES)
+ # In the cache already
+ SET(WAYLAND_FIND_QUIETLY TRUE)
+ ENDIF ()
+
+ # Use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ FIND_PACKAGE(PkgConfig)
+ PKG_CHECK_MODULES(PKG_WAYLAND QUIET wayland-client wayland-server wayland-egl)
+
+ SET(WAYLAND_DEFINITIONS ${PKG_WAYLAND_CFLAGS})
+
+ FIND_PATH(WAYLAND_CLIENT_INCLUDE_DIR NAMES wayland-client.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
+ FIND_PATH(WAYLAND_SERVER_INCLUDE_DIR NAMES wayland-server.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
+ FIND_PATH(WAYLAND_EGL_INCLUDE_DIR NAMES wayland-egl.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
+
+ FIND_LIBRARY(WAYLAND_CLIENT_LIBRARIES NAMES wayland-client HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
+ FIND_LIBRARY(WAYLAND_SERVER_LIBRARIES NAMES wayland-server HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
+ FIND_LIBRARY(WAYLAND_EGL_LIBRARIES NAMES wayland-egl HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
+
+ set(WAYLAND_INCLUDE_DIR ${WAYLAND_CLIENT_INCLUDE_DIR} ${WAYLAND_SERVER_INCLUDE_DIR} ${WAYLAND_EGL_INCLUDE_DIR})
+
+ set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_EGL_LIBRARIES})
+
+ list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIR)
+
+ include(FindPackageHandleStandardArgs)
+
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CLIENT DEFAULT_MSG WAYLAND_CLIENT_LIBRARIES WAYLAND_CLIENT_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_SERVER DEFAULT_MSG WAYLAND_SERVER_LIBRARIES WAYLAND_SERVER_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_EGL DEFAULT_MSG WAYLAND_EGL_LIBRARIES WAYLAND_EGL_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND DEFAULT_MSG WAYLAND_LIBRARIES WAYLAND_INCLUDE_DIR)
+
+ MARK_AS_ADVANCED(
+ WAYLAND_INCLUDE_DIR WAYLAND_LIBRARIES
+ WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES
+ WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES
+ WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES
+ )
+
+ENDIF ()
diff --git a/CMake/Wayland.cmake b/CMake/Wayland.cmake
new file mode 100644
index 00000000..42f97b3b
--- /dev/null
+++ b/CMake/Wayland.cmake
@@ -0,0 +1,77 @@
+#=============================================================================
+# Copyright (C) 2012-2013 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Pier Luigi Fiorini nor the names of his
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#=============================================================================
+
+find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
+
+# wayland_add_protocol_client(outfiles inputfile basename)
+function(WAYLAND_ADD_PROTOCOL_CLIENT _sources _protocol _basename)
+ if(NOT WAYLAND_SCANNER_EXECUTABLE)
+ message(FATAL "The wayland-scanner executable has nto been found on your system. You must install it.")
+ endif()
+
+ get_filename_component(_infile ${_protocol} ABSOLUTE)
+ set(_client_header "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-client-protocol.h")
+ set(_code "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-protocol.c")
+
+ add_custom_command(OUTPUT "${_client_header}"
+ COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header < ${_infile} > ${_client_header}
+ DEPENDS ${_infile} VERBATIM)
+
+ add_custom_command(OUTPUT "${_code}"
+ COMMAND ${WAYLAND_SCANNER_EXECUTABLE} code < ${_infile} > ${_code}
+ DEPENDS ${_infile} VERBATIM)
+
+ list(APPEND ${_sources} "${_client_header}" "${_code}")
+ set(${_sources} ${${_sources}} PARENT_SCOPE)
+endfunction()
+
+# wayland_add_protocol_server(outfiles inputfile basename)
+function(WAYLAND_ADD_PROTOCOL_SERVER _sources _protocol _basename)
+ if(NOT WAYLAND_SCANNER_EXECUTABLE)
+ message(FATAL "The wayland-scanner executable has nto been found on your system. You must install it.")
+ endif()
+
+ get_filename_component(_infile ${_protocol} ABSOLUTE)
+ set(_server_header "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-server-protocol.h")
+ set(_code "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-protocol.c")
+
+ add_custom_command(OUTPUT "${_server_header}"
+ COMMAND ${WAYLAND_SCANNER_EXECUTABLE} server-header < ${_infile} > ${_server_header}
+ DEPENDS ${_infile} VERBATIM)
+
+ add_custom_command(OUTPUT "${_code}"
+ COMMAND ${WAYLAND_SCANNER_EXECUTABLE} code < ${_infile} > ${_code}
+ DEPENDS ${_infile} VERBATIM)
+
+ list(APPEND ${_sources} "${_server_header}" "${_code}")
+ set(${_sources} ${${_sources}} PARENT_SCOPE)
+endfunction()