1 ###########################################################################
2 # Copyright 2018 Konsulko Group
3 # Copyright 2020 Collabora, Ltd.
5 # Author: Scott Murray <scott.murray@konsulko.com>
6 # Author: Marius Vlad <marius.vlad@collabora.com>
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
19 ###########################################################################
21 set(CMAKE_INCLUDE_CURRENT_DIR ON)
22 set(CMAKE_CXX_STANDARD 14)
23 set(CMAKE_CXX_STANDARD_REQUIRED ON)
25 find_package(PkgConfig REQUIRED)
26 find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
28 PROJECT_TARGET_ADD(camera-gstreamer)
31 OUTPUT agl-shell-desktop-client-protocol.h
32 COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header
33 < ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell-desktop.xml
34 > ${CMAKE_SOURCE_DIR}/app/agl-shell-desktop-client-protocol.h
35 DEPENDS ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell-desktop.xml
40 OUTPUT ${CMAKE_BINARY_DIR}/app/agl-shell-desktop-client-protocol.h
41 COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header
42 < ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell-desktop.xml
43 > ${CMAKE_SOURCE_DIR}/app/agl-shell-desktop-client-protocol.h
44 DEPENDS ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell-desktop.xml
48 OUTPUT agl-shell-desktop-protocol.c
49 COMMAND ${WAYLAND_SCANNER_EXECUTABLE} code
50 < ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell-desktop.xml
51 > ${CMAKE_BINARY_DIR}/app/agl-shell-desktop-protocol.c
52 DEPENDS ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell-desktop.xml
56 pkg_check_modules(GSTREAMER REQUIRED gstreamer-1.0)
57 pkg_check_modules(GSTREAMER_PLUGINS_BASE REQUIRED gstreamer-plugins-base-1.0)
58 pkg_check_modules(GSTREAMER_VIDEO REQUIRED gstreamer-video-1.0)
59 pkg_check_modules(GSTREAMER_PLUGINS_BAD REQUIRED gstreamer-plugins-bad-1.0)
61 pkg_check_modules(WAYLAND_CLIENT REQUIRED wayland-client)
62 pkg_check_modules(WAYLAND_PROTOCOLS REQUIRED wayland-protocols>=1.18)
63 pkg_get_variable(WAYLAND_PROTOCOLS_BASE wayland-protocols pkgdatadir)
66 OUTPUT xdg-shell-client-protocol.h
67 COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header
68 < ${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
69 > ${CMAKE_SOURCE_DIR}/app/xdg-shell-client-protocol.h
70 DEPENDS ${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
75 OUTPUT ${CMAKE_BINARY_DIR}/app/xdg-shell-client-protocol.h
76 COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header
77 < ${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
78 > ${CMAKE_SOURCE_DIR}/app/xdg-shell-client-protocol.h
79 DEPENDS ${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
83 OUTPUT xdg-shell-protocol.c
84 COMMAND ${WAYLAND_SCANNER_EXECUTABLE} code
85 < ${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
86 > ${CMAKE_BINARY_DIR}/app/xdg-shell-protocol.c
87 DEPENDS ${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
90 add_executable(${TARGET_NAME}
94 agl-shell-desktop-protocol.c
95 agl-shell-desktop-client-protocol.h
97 xdg-shell-client-protocol.h
102 "${GSTREAMER_INCLUDE_DIRS}"
103 "${GSTREAMER_PLUGINS_BASE_INCLUDE_DIRS}"
104 "${GSTREAMER_PLUGINS_BAD_INCLUDE_DIRS}"
105 "${GSTREAMER_VIDEO_INCLUDE_DIRS}"
108 set_target_properties(${TARGET_NAME} PROPERTIES
111 COMPILE_FLAGS "${EXTRAS_CFLAGS} -DFOR_AFB_BINDING"
112 LINK_FLAGS "${BINDINGS_LINK_FLAG}"
113 LINK_LIBRARIES "${EXTRAS_LIBRARIES}"
114 OUTPUT_NAME "${TARGET_NAME}"
117 target_link_libraries(${TARGET_NAME}
118 ${GSTREAMER_LIBRARIES}
119 "${GSTREAMER_PLUGINS_BASE_LIBRARIES}"
120 "${GSTREAMER_PLUGINS_BAD_LIBRARIES}"
121 "${GSTREAMER_VIDEO_LIBRARIES}"
122 ${WAYLAND_CLIENT_LIBRARIES}