diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-11-12 08:17:52 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-11-12 08:17:52 -0500 |
commit | aadcba4b7cfa9ce3096fd166a046b151fd5ba8fa (patch) | |
tree | 62968b4f9a22d275965605cba155afbb69892ee0 /CMake | |
parent | Fix gaps for views being incorrect (diff) | |
download | sway-aadcba4b7cfa9ce3096fd166a046b151fd5ba8fa.tar.gz sway-aadcba4b7cfa9ce3096fd166a046b151fd5ba8fa.tar.zst sway-aadcba4b7cfa9ce3096fd166a046b151fd5ba8fa.zip |
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.cmake | 47 | ||||
-rw-r--r-- | CMake/FindPango.cmake | 47 | ||||
-rw-r--r-- | CMake/FindWayland.cmake | 62 | ||||
-rw-r--r-- | CMake/Wayland.cmake | 77 |
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 @@ | |||
1 | # - Try to find the cairo library | ||
2 | # Once done this will define | ||
3 | # | ||
4 | # CAIRO_FOUND - system has cairo | ||
5 | # CAIRO_INCLUDE_DIRS - the cairo include directory | ||
6 | # CAIRO_LIBRARIES - Link these to use cairo | ||
7 | # | ||
8 | # Define CAIRO_MIN_VERSION for which version desired. | ||
9 | # | ||
10 | |||
11 | INCLUDE(FindPkgConfig) | ||
12 | |||
13 | IF(Cairo_FIND_REQUIRED) | ||
14 | SET(_pkgconfig_REQUIRED "REQUIRED") | ||
15 | ELSE(Cairo_FIND_REQUIRED) | ||
16 | SET(_pkgconfig_REQUIRED "") | ||
17 | ENDIF(Cairo_FIND_REQUIRED) | ||
18 | |||
19 | IF(CAIRO_MIN_VERSION) | ||
20 | PKG_SEARCH_MODULE(CAIRO ${_pkgconfig_REQUIRED} cairo>=${CAIRO_MIN_VERSION}) | ||
21 | ELSE(CAIRO_MIN_VERSION) | ||
22 | PKG_SEARCH_MODULE(CAIRO ${_pkgconfig_REQUIRED} cairo) | ||
23 | ENDIF(CAIRO_MIN_VERSION) | ||
24 | |||
25 | IF(NOT CAIRO_FOUND AND NOT PKG_CONFIG_FOUND) | ||
26 | FIND_PATH(CAIRO_INCLUDE_DIRS cairo.h) | ||
27 | FIND_LIBRARY(CAIRO_LIBRARIES cairo) | ||
28 | |||
29 | # Report results | ||
30 | IF(CAIRO_LIBRARIES AND CAIRO_INCLUDE_DIRS) | ||
31 | SET(CAIRO_FOUND 1) | ||
32 | IF(NOT Cairo_FIND_QUIETLY) | ||
33 | MESSAGE(STATUS "Found Cairo: ${CAIRO_LIBRARIES}") | ||
34 | ENDIF(NOT Cairo_FIND_QUIETLY) | ||
35 | ELSE(CAIRO_LIBRARIES AND CAIRO_INCLUDE_DIRS) | ||
36 | IF(Cairo_FIND_REQUIRED) | ||
37 | MESSAGE(SEND_ERROR "Could not find Cairo") | ||
38 | ELSE(Cairo_FIND_REQUIRED) | ||
39 | IF(NOT Cairo_FIND_QUIETLY) | ||
40 | MESSAGE(STATUS "Could not find Cairo") | ||
41 | ENDIF(NOT Cairo_FIND_QUIETLY) | ||
42 | ENDIF(Cairo_FIND_REQUIRED) | ||
43 | ENDIF(CAIRO_LIBRARIES AND CAIRO_INCLUDE_DIRS) | ||
44 | ENDIF(NOT CAIRO_FOUND AND NOT PKG_CONFIG_FOUND) | ||
45 | |||
46 | # Hide advanced variables from CMake GUIs | ||
47 | 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 @@ | |||
1 | # - Try to find the pango library | ||
2 | # Once done this will define | ||
3 | # | ||
4 | # PANGO_FOUND - system has pango | ||
5 | # PANGO_INCLUDE_DIRS - the pango include directory | ||
6 | # PANGO_LIBRARIES - Link these to use pango | ||
7 | # | ||
8 | # Define PANGO_MIN_VERSION for which version desired. | ||
9 | # | ||
10 | |||
11 | INCLUDE(FindPkgConfig) | ||
12 | |||
13 | IF(Pango_FIND_REQUIRED) | ||
14 | SET(_pkgconfig_REQUIRED "REQUIRED") | ||
15 | ELSE(Pango_FIND_REQUIRED) | ||
16 | SET(_pkgconfig_REQUIRED "") | ||
17 | ENDIF(Pango_FIND_REQUIRED) | ||
18 | |||
19 | IF(PANGO_MIN_VERSION) | ||
20 | PKG_SEARCH_MODULE(PANGO ${_pkgconfig_REQUIRED} "pango>=${PANGO_MIN_VERSION} pangocairo>=${PANGO_MIN_VERSION}") | ||
21 | ELSE(PANGO_MIN_VERSION) | ||
22 | PKG_SEARCH_MODULE(PANGO ${_pkgconfig_REQUIRED} "pango pangocairo") | ||
23 | ENDIF(PANGO_MIN_VERSION) | ||
24 | |||
25 | IF(NOT PANGO_FOUND AND NOT PKG_CONFIG_FOUND) | ||
26 | FIND_PATH(PANGO_INCLUDE_DIRS pango.h) | ||
27 | FIND_LIBRARY(PANGO_LIBRARIES pango pangocairo) | ||
28 | |||
29 | # Report results | ||
30 | IF(PANGO_LIBRARIES AND PANGO_INCLUDE_DIRS) | ||
31 | SET(PANGO_FOUND 1) | ||
32 | IF(NOT Pango_FIND_QUIETLY) | ||
33 | MESSAGE(STATUS "Found Pango: ${PANGO_LIBRARIES}") | ||
34 | ENDIF(NOT Pango_FIND_QUIETLY) | ||
35 | ELSE(PANGO_LIBRARIES AND PANGO_INCLUDE_DIRS) | ||
36 | IF(Pango_FIND_REQUIRED) | ||
37 | MESSAGE(SEND_ERROR "Could not find Pango") | ||
38 | ELSE(Pango_FIND_REQUIRED) | ||
39 | IF(NOT Pango_FIND_QUIETLY) | ||
40 | MESSAGE(STATUS "Could not find Pango") | ||
41 | ENDIF(NOT Pango_FIND_QUIETLY) | ||
42 | ENDIF(Pango_FIND_REQUIRED) | ||
43 | ENDIF(PANGO_LIBRARIES AND PANGO_INCLUDE_DIRS) | ||
44 | ENDIF(NOT PANGO_FOUND AND NOT PKG_CONFIG_FOUND) | ||
45 | |||
46 | # Hide advanced variables from CMake GUIs | ||
47 | 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 @@ | |||
1 | # Try to find Wayland on a Unix system | ||
2 | # | ||
3 | # This will define: | ||
4 | # | ||
5 | # WAYLAND_FOUND - True if Wayland is found | ||
6 | # WAYLAND_LIBRARIES - Link these to use Wayland | ||
7 | # WAYLAND_INCLUDE_DIR - Include directory for Wayland | ||
8 | # WAYLAND_DEFINITIONS - Compiler flags for using Wayland | ||
9 | # | ||
10 | # In addition the following more fine grained variables will be defined: | ||
11 | # | ||
12 | # WAYLAND_CLIENT_FOUND WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES | ||
13 | # WAYLAND_SERVER_FOUND WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES | ||
14 | # WAYLAND_EGL_FOUND WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES | ||
15 | # | ||
16 | # Copyright (c) 2013 Martin Gräßlin <mgraesslin@kde.org> | ||
17 | # | ||
18 | # Redistribution and use is allowed according to the terms of the BSD license. | ||
19 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. | ||
20 | |||
21 | IF (NOT WIN32) | ||
22 | IF (WAYLAND_INCLUDE_DIR AND WAYLAND_LIBRARIES) | ||
23 | # In the cache already | ||
24 | SET(WAYLAND_FIND_QUIETLY TRUE) | ||
25 | ENDIF () | ||
26 | |||
27 | # Use pkg-config to get the directories and then use these values | ||
28 | # in the FIND_PATH() and FIND_LIBRARY() calls | ||
29 | FIND_PACKAGE(PkgConfig) | ||
30 | PKG_CHECK_MODULES(PKG_WAYLAND QUIET wayland-client wayland-server wayland-egl) | ||
31 | |||
32 | SET(WAYLAND_DEFINITIONS ${PKG_WAYLAND_CFLAGS}) | ||
33 | |||
34 | FIND_PATH(WAYLAND_CLIENT_INCLUDE_DIR NAMES wayland-client.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS}) | ||
35 | FIND_PATH(WAYLAND_SERVER_INCLUDE_DIR NAMES wayland-server.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS}) | ||
36 | FIND_PATH(WAYLAND_EGL_INCLUDE_DIR NAMES wayland-egl.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS}) | ||
37 | |||
38 | FIND_LIBRARY(WAYLAND_CLIENT_LIBRARIES NAMES wayland-client HINTS ${PKG_WAYLAND_LIBRARY_DIRS}) | ||
39 | FIND_LIBRARY(WAYLAND_SERVER_LIBRARIES NAMES wayland-server HINTS ${PKG_WAYLAND_LIBRARY_DIRS}) | ||
40 | FIND_LIBRARY(WAYLAND_EGL_LIBRARIES NAMES wayland-egl HINTS ${PKG_WAYLAND_LIBRARY_DIRS}) | ||
41 | |||
42 | set(WAYLAND_INCLUDE_DIR ${WAYLAND_CLIENT_INCLUDE_DIR} ${WAYLAND_SERVER_INCLUDE_DIR} ${WAYLAND_EGL_INCLUDE_DIR}) | ||
43 | |||
44 | set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_EGL_LIBRARIES}) | ||
45 | |||
46 | list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIR) | ||
47 | |||
48 | include(FindPackageHandleStandardArgs) | ||
49 | |||
50 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CLIENT DEFAULT_MSG WAYLAND_CLIENT_LIBRARIES WAYLAND_CLIENT_INCLUDE_DIR) | ||
51 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_SERVER DEFAULT_MSG WAYLAND_SERVER_LIBRARIES WAYLAND_SERVER_INCLUDE_DIR) | ||
52 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_EGL DEFAULT_MSG WAYLAND_EGL_LIBRARIES WAYLAND_EGL_INCLUDE_DIR) | ||
53 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND DEFAULT_MSG WAYLAND_LIBRARIES WAYLAND_INCLUDE_DIR) | ||
54 | |||
55 | MARK_AS_ADVANCED( | ||
56 | WAYLAND_INCLUDE_DIR WAYLAND_LIBRARIES | ||
57 | WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES | ||
58 | WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES | ||
59 | WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES | ||
60 | ) | ||
61 | |||
62 | 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 @@ | |||
1 | #============================================================================= | ||
2 | # Copyright (C) 2012-2013 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> | ||
3 | # All rights reserved. | ||
4 | # | ||
5 | # Redistribution and use in source and binary forms, with or without | ||
6 | # modification, are permitted provided that the following conditions | ||
7 | # are met: | ||
8 | # | ||
9 | # * Redistributions of source code must retain the above copyright | ||
10 | # notice, this list of conditions and the following disclaimer. | ||
11 | # | ||
12 | # * Redistributions in binary form must reproduce the above copyright | ||
13 | # notice, this list of conditions and the following disclaimer in the | ||
14 | # documentation and/or other materials provided with the distribution. | ||
15 | # | ||
16 | # * Neither the name of Pier Luigi Fiorini nor the names of his | ||
17 | # contributors may be used to endorse or promote products derived | ||
18 | # from this software without specific prior written permission. | ||
19 | # | ||
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
24 | # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
31 | #============================================================================= | ||
32 | |||
33 | find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner) | ||
34 | |||
35 | # wayland_add_protocol_client(outfiles inputfile basename) | ||
36 | function(WAYLAND_ADD_PROTOCOL_CLIENT _sources _protocol _basename) | ||
37 | if(NOT WAYLAND_SCANNER_EXECUTABLE) | ||
38 | message(FATAL "The wayland-scanner executable has nto been found on your system. You must install it.") | ||
39 | endif() | ||
40 | |||
41 | get_filename_component(_infile ${_protocol} ABSOLUTE) | ||
42 | set(_client_header "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-client-protocol.h") | ||
43 | set(_code "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-protocol.c") | ||
44 | |||
45 | add_custom_command(OUTPUT "${_client_header}" | ||
46 | COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header < ${_infile} > ${_client_header} | ||
47 | DEPENDS ${_infile} VERBATIM) | ||
48 | |||
49 | add_custom_command(OUTPUT "${_code}" | ||
50 | COMMAND ${WAYLAND_SCANNER_EXECUTABLE} code < ${_infile} > ${_code} | ||
51 | DEPENDS ${_infile} VERBATIM) | ||
52 | |||
53 | list(APPEND ${_sources} "${_client_header}" "${_code}") | ||
54 | set(${_sources} ${${_sources}} PARENT_SCOPE) | ||
55 | endfunction() | ||
56 | |||
57 | # wayland_add_protocol_server(outfiles inputfile basename) | ||
58 | function(WAYLAND_ADD_PROTOCOL_SERVER _sources _protocol _basename) | ||
59 | if(NOT WAYLAND_SCANNER_EXECUTABLE) | ||
60 | message(FATAL "The wayland-scanner executable has nto been found on your system. You must install it.") | ||
61 | endif() | ||
62 | |||
63 | get_filename_component(_infile ${_protocol} ABSOLUTE) | ||
64 | set(_server_header "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-server-protocol.h") | ||
65 | set(_code "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-protocol.c") | ||
66 | |||
67 | add_custom_command(OUTPUT "${_server_header}" | ||
68 | COMMAND ${WAYLAND_SCANNER_EXECUTABLE} server-header < ${_infile} > ${_server_header} | ||
69 | DEPENDS ${_infile} VERBATIM) | ||
70 | |||
71 | add_custom_command(OUTPUT "${_code}" | ||
72 | COMMAND ${WAYLAND_SCANNER_EXECUTABLE} code < ${_infile} > ${_code} | ||
73 | DEPENDS ${_infile} VERBATIM) | ||
74 | |||
75 | list(APPEND ${_sources} "${_server_header}" "${_code}") | ||
76 | set(${_sources} ${${_sources}} PARENT_SCOPE) | ||
77 | endfunction() | ||