1 ###########################################################################
2 # Copyright 2018,2022 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 project(camera-gstreamer)
23 if(CMAKE_VERSION VERSION_LESS "3.7.0")
24 set(CMAKE_INCLUDE_CURRENT_DIR ON)
27 set(CMAKE_CXX_STANDARD 14)
28 set(CMAKE_CXX_STANDARD_REQUIRED ON)
30 find_package(PkgConfig REQUIRED)
31 find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
34 OUTPUT agl-shell-desktop-client-protocol.h
35 COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header
36 < ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell-desktop.xml
37 > ${CMAKE_SOURCE_DIR}/app/agl-shell-desktop-client-protocol.h
38 DEPENDS ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell-desktop.xml
42 OUTPUT ${CMAKE_BINARY_DIR}/app/agl-shell-desktop-client-protocol.h
43 COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header
44 < ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell-desktop.xml
45 > ${CMAKE_SOURCE_DIR}/app/agl-shell-desktop-client-protocol.h
46 DEPENDS ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell-desktop.xml
50 OUTPUT agl-shell-desktop-protocol.c
51 COMMAND ${WAYLAND_SCANNER_EXECUTABLE} code
52 < ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell-desktop.xml
53 > ${CMAKE_BINARY_DIR}/app/agl-shell-desktop-protocol.c
54 DEPENDS ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell-desktop.xml
57 pkg_check_modules(GSTREAMER REQUIRED gstreamer-1.0)
58 pkg_check_modules(GSTREAMER_PLUGINS_BASE REQUIRED gstreamer-plugins-base-1.0)
59 pkg_check_modules(GSTREAMER_VIDEO REQUIRED gstreamer-video-1.0)
60 pkg_check_modules(GSTREAMER_PLUGINS_BAD REQUIRED gstreamer-plugins-bad-1.0)
62 pkg_check_modules(WAYLAND_CLIENT REQUIRED wayland-client)
63 pkg_check_modules(WAYLAND_PROTOCOLS REQUIRED wayland-protocols>=1.18)
64 pkg_get_variable(WAYLAND_PROTOCOLS_BASE wayland-protocols pkgdatadir)
67 OUTPUT xdg-shell-client-protocol.h
68 COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header
69 < ${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
70 > ${CMAKE_SOURCE_DIR}/app/xdg-shell-client-protocol.h
71 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(${PROJECT_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 target_link_libraries(${PROJECT_NAME}
109 ${GSTREAMER_LIBRARIES}
110 "${GSTREAMER_PLUGINS_BASE_LIBRARIES}"
111 "${GSTREAMER_PLUGINS_BAD_LIBRARIES}"
112 "${GSTREAMER_VIDEO_LIBRARIES}"
113 ${WAYLAND_CLIENT_LIBRARIES}
117 install(TARGETS ${PROJECT_NAME} DESTINATION bin)
118 include(GNUInstallDirs)
119 install(FILES ${PROJECT_NAME}.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)