aboutsummaryrefslogtreecommitdiffstats
path: root/CMake/Wayland.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'CMake/Wayland.cmake')
-rw-r--r--CMake/Wayland.cmake77
1 files changed, 0 insertions, 77 deletions
diff --git a/CMake/Wayland.cmake b/CMake/Wayland.cmake
deleted file mode 100644
index f9349667..00000000
--- a/CMake/Wayland.cmake
+++ /dev/null
@@ -1,77 +0,0 @@
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
33find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
34
35# wayland_add_protocol_client(outfiles inputfile basename)
36function(WAYLAND_ADD_PROTOCOL_CLIENT _sources _protocol _basename)
37 if(NOT WAYLAND_SCANNER_EXECUTABLE)
38 message(FATAL "The wayland-scanner executable has not 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}-client-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)
55endfunction()
56
57# wayland_add_protocol_server(outfiles inputfile basename)
58function(WAYLAND_ADD_PROTOCOL_SERVER _sources _protocol _basename)
59 if(NOT WAYLAND_SCANNER_EXECUTABLE)
60 message(FATAL "The wayland-scanner executable has not 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}-server-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)
77endfunction()