summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2020-10-20 14:30:32 +0300
committerMarius Vlad <marius.vlad@collabora.com>2020-12-01 13:07:57 +0200
commit694ec412b5ae13b84229e5c65f2e3dce2babee34 (patch)
treee25a0f1a94e025ad729b37d5f35ec4494aff8b0d
parente6ad86a86fe3ed73cac6478e07eb1220399ace1f (diff)
build: Added AGL specific build directory for widget building
Adds also a cmake as we don't have meson alternative as of yet. Bug-AGL: SPEC-3605 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I43cc98294d7bb5d887370c8ce2db854cbd9055d7
-rw-r--r--CMakeLists.txt3
-rwxr-xr-xautobuild/agl/autobuild128
-rwxr-xr-xautobuild/linux/autobuild128
-rw-r--r--conf.d/cmake/config.cmake206
-rw-r--r--conf.d/wgt/config.xml.in13
-rw-r--r--src/CMakeLists.txt137
-rw-r--r--src/wth-receiver-gst-shm.c3
7 files changed, 617 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..c540472
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,3 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 3.3)
+project(waltham-receiver)
+include(${CMAKE_CURRENT_SOURCE_DIR}/conf.d/cmake/config.cmake)
diff --git a/autobuild/agl/autobuild b/autobuild/agl/autobuild
new file mode 100755
index 0000000..16181b8
--- /dev/null
+++ b/autobuild/agl/autobuild
@@ -0,0 +1,128 @@
+#!/usr/bin/make -f
+# Copyright (C) 2015 - 2018 "IoT.bzh"
+# Copyright (C) 2020 Konsulko Group
+# Author "Romain Forlot" <romain.forlot@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+THISFILE := $(lastword $(MAKEFILE_LIST))
+ROOT_DIR := $(abspath $(dir $(THISFILE))/../..)
+
+# Build directories
+# Note that the debug/test/coverage directories are defined in relation
+# to the release directory (BUILD_DIR), this needs to be kept in mind
+# if over-riding it and building those widget types, the specific widget
+# type variable (e.g. BUILD_DIR_DEBUG) may also need to be specified
+# to yield the desired output hierarchy.
+BUILD_DIR = $(ROOT_DIR)/build
+BUILD_DIR_DEBUG = $(abspath $(BUILD_DIR)/../build-debug)
+BUILD_DIR_TEST = $(abspath $(BUILD_DIR)/../build-test)
+BUILD_DIR_COVERAGE = $(abspath $(BUILD_DIR)/../build-coverage)
+
+# Output directory variable for use in pattern rules.
+# This is intended for internal use only, hence the explicit override
+# definition.
+override OUTPUT_DIR = $(BUILD_DIR)
+
+# Final install directory for widgets
+DEST = $(OUTPUT_DIR)
+
+# Default build type for release/test builds
+BUILD_TYPE = RELEASE
+
+.PHONY: all help update install distclean
+.PHONY: clean clean-release clean-debug clean-test clean-coverage clean-all
+.PHONY: configure configure-release configure-debug configure-test configure-coverage
+.PHONY: build build-release build-debug build-test build-coverage build-all
+.PHONY: package package-release package-debug package-test package-coverage package-all
+
+help:
+ @echo "List of targets available:"
+ @echo ""
+ @echo "- all"
+ @echo "- help"
+ @echo "- clean"
+ @echo "- distclean"
+ @echo "- configure"
+ @echo "- build: compilation, link and prepare files for package into a widget"
+ @echo "- package: output a widget file '*.wgt'"
+ @echo "- install: install in your $(CMAKE_INSTALL_DIR) directory"
+ @echo ""
+ @echo "Usage: ./autobuild/agl/autobuild package DEST=${HOME}/opt"
+ @echo "Don't use your build dir as DEST as wgt file is generated at this location"
+
+all: package-all
+
+# Target specific variable over-rides so static pattern rules can be
+# used for the various type-specific targets.
+
+configure-test build-test package-test clean-test: OUTPUT_DIR = $(BUILD_DIR_TEST)
+
+configure-coverage build-coverage package-coverage clean-coverage: OUTPUT_DIR = $(BUILD_DIR_COVERAGE)
+configure-coverage build-coverage package-coverage: BUILD_TYPE = COVERAGE
+
+configure-debug build-debug package-debug clean-debug: OUTPUT_DIR = $(BUILD_DIR_DEBUG)
+configure-debug build-debug package-debug: BUILD_TYPE = DEBUG
+
+clean-release clean-test clean-debug clean-coverage:
+ @if [ -d $(OUTPUT_DIR) ]; then \
+ $(MAKE) -C $(OUTPUT_DIR) $(CLEAN_ARGS) clean; \
+ else \
+ echo Nothing to clean; \
+ fi
+
+clean: clean-release
+
+clean-all: clean-release clean-test clean-debug clean-coverage
+
+distclean: clean-all
+
+configure-release configure-test configure-debug configure-coverage:
+ @mkdir -p $(OUTPUT_DIR)
+ @if [ ! -f $(OUTPUT_DIR)/Makefile ]; then \
+ (cd $(OUTPUT_DIR) && cmake -S $(ROOT_DIR) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) $(CONFIGURE_ARGS)); \
+ fi
+
+configure: configure-release
+
+build-release build-debug build-coverage: build-%: configure-%
+ @cmake --build $(OUTPUT_DIR) $(BUILD_ARGS) --target all
+
+# Kept for consistency, empty to avoid building everything for test widget
+build-test: configure-test
+
+build: build-release
+
+build-all: build-release build-debug build-test build-coverage
+
+package-release package-debug package-coverage: package-%: build-%
+ @cmake --build $(OUTPUT_DIR) $(PACKAGE_ARGS) --target widget
+ @if [ "$(abspath $(DEST))" != "$(abspath $(OUTPUT_DIR))" ]; then \
+ mkdir -p $(DEST) && cp $(OUTPUT_DIR)/*.wgt $(DEST); \
+ fi
+
+package-test: build-test
+ @cmake --build $(OUTPUT_DIR) $(PACKAGE_ARGS) --target test_widget
+ @if [ "$(abspath $(DEST))" != "$(abspath $(OUTPUT_DIR))" ]; then \
+ mkdir -p $(DEST) && cp $(OUTPUT_DIR)/*.wgt $(DEST); \
+ fi
+
+package: package-release
+
+package-all: package-release package-test package-coverage package-debug
+
+update: configure
+ @cmake --build $(BUILD_DIR) --target autobuild
+
+install: build
+ @cmake --build $(BUILD_DIR) $(INSTALL_ARGS) --target install
diff --git a/autobuild/linux/autobuild b/autobuild/linux/autobuild
new file mode 100755
index 0000000..16181b8
--- /dev/null
+++ b/autobuild/linux/autobuild
@@ -0,0 +1,128 @@
+#!/usr/bin/make -f
+# Copyright (C) 2015 - 2018 "IoT.bzh"
+# Copyright (C) 2020 Konsulko Group
+# Author "Romain Forlot" <romain.forlot@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+THISFILE := $(lastword $(MAKEFILE_LIST))
+ROOT_DIR := $(abspath $(dir $(THISFILE))/../..)
+
+# Build directories
+# Note that the debug/test/coverage directories are defined in relation
+# to the release directory (BUILD_DIR), this needs to be kept in mind
+# if over-riding it and building those widget types, the specific widget
+# type variable (e.g. BUILD_DIR_DEBUG) may also need to be specified
+# to yield the desired output hierarchy.
+BUILD_DIR = $(ROOT_DIR)/build
+BUILD_DIR_DEBUG = $(abspath $(BUILD_DIR)/../build-debug)
+BUILD_DIR_TEST = $(abspath $(BUILD_DIR)/../build-test)
+BUILD_DIR_COVERAGE = $(abspath $(BUILD_DIR)/../build-coverage)
+
+# Output directory variable for use in pattern rules.
+# This is intended for internal use only, hence the explicit override
+# definition.
+override OUTPUT_DIR = $(BUILD_DIR)
+
+# Final install directory for widgets
+DEST = $(OUTPUT_DIR)
+
+# Default build type for release/test builds
+BUILD_TYPE = RELEASE
+
+.PHONY: all help update install distclean
+.PHONY: clean clean-release clean-debug clean-test clean-coverage clean-all
+.PHONY: configure configure-release configure-debug configure-test configure-coverage
+.PHONY: build build-release build-debug build-test build-coverage build-all
+.PHONY: package package-release package-debug package-test package-coverage package-all
+
+help:
+ @echo "List of targets available:"
+ @echo ""
+ @echo "- all"
+ @echo "- help"
+ @echo "- clean"
+ @echo "- distclean"
+ @echo "- configure"
+ @echo "- build: compilation, link and prepare files for package into a widget"
+ @echo "- package: output a widget file '*.wgt'"
+ @echo "- install: install in your $(CMAKE_INSTALL_DIR) directory"
+ @echo ""
+ @echo "Usage: ./autobuild/agl/autobuild package DEST=${HOME}/opt"
+ @echo "Don't use your build dir as DEST as wgt file is generated at this location"
+
+all: package-all
+
+# Target specific variable over-rides so static pattern rules can be
+# used for the various type-specific targets.
+
+configure-test build-test package-test clean-test: OUTPUT_DIR = $(BUILD_DIR_TEST)
+
+configure-coverage build-coverage package-coverage clean-coverage: OUTPUT_DIR = $(BUILD_DIR_COVERAGE)
+configure-coverage build-coverage package-coverage: BUILD_TYPE = COVERAGE
+
+configure-debug build-debug package-debug clean-debug: OUTPUT_DIR = $(BUILD_DIR_DEBUG)
+configure-debug build-debug package-debug: BUILD_TYPE = DEBUG
+
+clean-release clean-test clean-debug clean-coverage:
+ @if [ -d $(OUTPUT_DIR) ]; then \
+ $(MAKE) -C $(OUTPUT_DIR) $(CLEAN_ARGS) clean; \
+ else \
+ echo Nothing to clean; \
+ fi
+
+clean: clean-release
+
+clean-all: clean-release clean-test clean-debug clean-coverage
+
+distclean: clean-all
+
+configure-release configure-test configure-debug configure-coverage:
+ @mkdir -p $(OUTPUT_DIR)
+ @if [ ! -f $(OUTPUT_DIR)/Makefile ]; then \
+ (cd $(OUTPUT_DIR) && cmake -S $(ROOT_DIR) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) $(CONFIGURE_ARGS)); \
+ fi
+
+configure: configure-release
+
+build-release build-debug build-coverage: build-%: configure-%
+ @cmake --build $(OUTPUT_DIR) $(BUILD_ARGS) --target all
+
+# Kept for consistency, empty to avoid building everything for test widget
+build-test: configure-test
+
+build: build-release
+
+build-all: build-release build-debug build-test build-coverage
+
+package-release package-debug package-coverage: package-%: build-%
+ @cmake --build $(OUTPUT_DIR) $(PACKAGE_ARGS) --target widget
+ @if [ "$(abspath $(DEST))" != "$(abspath $(OUTPUT_DIR))" ]; then \
+ mkdir -p $(DEST) && cp $(OUTPUT_DIR)/*.wgt $(DEST); \
+ fi
+
+package-test: build-test
+ @cmake --build $(OUTPUT_DIR) $(PACKAGE_ARGS) --target test_widget
+ @if [ "$(abspath $(DEST))" != "$(abspath $(OUTPUT_DIR))" ]; then \
+ mkdir -p $(DEST) && cp $(OUTPUT_DIR)/*.wgt $(DEST); \
+ fi
+
+package: package-release
+
+package-all: package-release package-test package-coverage package-debug
+
+update: configure
+ @cmake --build $(BUILD_DIR) --target autobuild
+
+install: build
+ @cmake --build $(BUILD_DIR) $(INSTALL_ARGS) --target install
diff --git a/conf.d/cmake/config.cmake b/conf.d/cmake/config.cmake
new file mode 100644
index 0000000..45d35e4
--- /dev/null
+++ b/conf.d/cmake/config.cmake
@@ -0,0 +1,206 @@
+###########################################################################
+# Copyright 2015-2018 IoT.bzh
+# Copyright 2018,2019 Konsulko Group
+# Copyright 2020 Collabora Ltd.
+#
+# author: Fulup Ar Foll <fulup@iot.bzh>
+# cluster-receiver: Scott Murray <scott.murray@konsulko.com>
+# xdg-cluster-receiver: Marius Vlad <marius.vlad@collabora.com>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+# Project Info
+# ------------------
+set(PROJECT_NAME waltham-receiver)
+set(PROJECT_PRETTY_NAME "Waltham-receiver")
+set(PROJECT_DESCRIPTION "Waltham-receiver demo application")
+set(PROJECT_URL "https://https://gerrit.automotivelinux.org/gerrit/apps/waltham-receiver.git")
+set(PROJECT_VERSION "1.0")
+set(PROJECT_ICON "icon.png")
+set(PROJECT_AUTHOR "Marius Vlad")
+set(PROJECT_AUTHOR_MAIL "marius.vlad@collabora.com")
+set(PROJECT_LICENSE "MIT")
+set(PROJECT_LANGUAGES "CXX")
+
+# Where are stored the project configuration files
+# relative to the root project directory
+set(PROJECT_CMAKE_CONF_DIR "conf.d")
+
+# Where are stored your external libraries for your project. This is 3rd party library that you don't maintain
+# but used and must be built and linked.
+# set(PROJECT_LIBDIR "libs")
+
+# Which directories inspect to find CMakeLists.txt target files
+# set(PROJECT_SRC_DIR_PATTERN "*")
+
+# Compilation Mode (DEBUG, RELEASE)
+# ----------------------------------
+#set(CMAKE_BUILD_TYPE "DEBUG")
+set(USE_EFENCE 1)
+
+# Kernel selection if needed. You can choose between a
+# mandatory version to impose a minimal version.
+# Or check Kernel minimal version and just print a Warning
+# about missing features and define a preprocessor variable
+# to be used as preprocessor condition in code to disable
+# incompatibles features. Preprocessor define is named
+# KERNEL_MINIMAL_VERSION_OK.
+#
+# NOTE*** FOR NOW IT CHECKS KERNEL Yocto environment and
+# Yocto SDK Kernel version.
+# -----------------------------------------------
+#set (kernel_mandatory_version 4.8)
+#set (kernel_minimal_version 4.8)
+
+# Compiler selection if needed. Impose a minimal version.
+# -----------------------------------------------
+set (gcc_minimal_version 4.9)
+
+# PKG_CONFIG required packages
+# -----------------------------
+set (PKG_REQUIRED_LIST
+ json-c
+ afb-daemon
+)
+
+# Prefix path where will be installed the files
+# Default: /usr/local (need root permission to write in)
+# ------------------------------------------------------
+#set(CMAKE_INSTALL_PREFIX $ENV{HOME}/opt)
+
+# Customize link option
+# -----------------------------
+#list(APPEND link_libraries -an-option)
+
+# Compilation options definition
+# Use CMake generator expressions to specify only for a specific language
+# Values are prefilled with default options that is currently used.
+# Either separate options with ";", or each options must be quoted separately
+# DO NOT PUT ALL OPTION QUOTED AT ONCE , COMPILATION COULD FAILED !
+# ----------------------------------------------------------------------------
+#set(COMPILE_OPTIONS
+# -Wall
+# -Wextra
+# -Wconversion
+# -Wno-unused-parameter
+# -Wno-sign-compare
+# -Wno-sign-conversion
+# -Werror=maybe-uninitialized
+# -Werror=implicit-function-declaration
+# -ffunction-sections
+# -fdata-sections
+# -fPIC
+# CACHE STRING "Compilation flags")
+#set(C_COMPILE_OPTIONS "" CACHE STRING "Compilation flags for C language.")
+#set(CXX_COMPILE_OPTIONS "" CACHE STRING "Compilation flags for C++ language.")
+#set(PROFILING_COMPILE_OPTIONS
+# -g
+# -O0
+# -pg
+# -Wp,-U_FORTIFY_SOURCE
+# CACHE STRING "Compilation flags for PROFILING build type.")
+#set(DEBUG_COMPILE_OPTIONS
+# -g
+# -ggdb
+# -Wp,-U_FORTIFY_SOURCE
+# CACHE STRING "Compilation flags for DEBUG build type.")
+#set(CCOV_COMPILE_OPTIONS
+# -g
+# -O2
+# --coverage
+# CACHE STRING "Compilation flags for CCOV build type.")
+#set(RELEASE_COMPILE_OPTIONS
+# -g
+# -O2
+# CACHE STRING "Compilation flags for RELEASE build type.")
+
+# (BUG!!!) as PKG_CONFIG_PATH does not work [should be an env variable]
+# ---------------------------------------------------------------------
+set(CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}/lib64/pkgconfig ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
+set(LD_LIBRARY_PATH ${CMAKE_INSTALL_PREFIX}/lib64 ${CMAKE_INSTALL_PREFIX}/lib)
+
+# Optional location for config.xml.in
+# -----------------------------------
+#set(WIDGET_ICON "\"conf.d/wgt/${PROJECT_ICON}\"" CACHE PATH "Path to the widget icon")
+set(WIDGET_CONFIG_TEMPLATE "${CMAKE_CURRENT_SOURCE_DIR}/conf.d/wgt/config.xml.in" CACHE PATH "Path to widget config file template (config.xml.in)")
+
+# Mandatory widget Mimetype specification of the main unit
+# --------------------------------------------------------------------------
+# Choose between :
+#- text/html : HTML application,
+# content.src designates the home page of the application
+#
+#- application/vnd.agl.native : AGL compatible native,
+# content.src designates the relative path of the binary.
+#
+# - application/vnd.agl.service: AGL service, content.src is not used.
+#
+#- ***application/x-executable***: Native application,
+# content.src designates the relative path of the binary.
+# For such application, only security setup is made.
+#
+set(WIDGET_TYPE application/vnd.agl.native)
+
+# Mandatory Widget entry point file of the main unit
+# --------------------------------------------------------------
+# This is the file that will be executed, loaded,
+# at launch time by the application framework.
+#
+set(WIDGET_ENTRY_POINT bin/waltham-receiver)
+
+# Optional dependencies order
+# ---------------------------
+#set(EXTRA_DEPENDENCIES_ORDER)
+
+# Optional Extra global include path
+# -----------------------------------
+#set(EXTRA_INCLUDE_DIRS)
+
+# Optional extra libraries
+# -------------------------
+#set(EXTRA_LINK_LIBRARIES)
+
+# Optional force binding Linking flag
+# ------------------------------------
+# set(BINDINGS_LINK_FLAG LinkOptions )
+
+# Optional force package prefix generation, like widget
+# -----------------------------------------------------
+# set(PKG_PREFIX DestinationPath)
+
+# Optional Application Framework security token
+# and port use for remote debugging.
+#------------------------------------------------------------
+set(AFB_TOKEN "" CACHE PATH "Default binder security token")
+set(AFB_REMPORT "1234" CACHE PATH "Default binder listening port")
+
+# Print a helper message when every thing is finished
+# ----------------------------------------------------
+set(CLOSING_MESSAGE "Typical binding launch: afb-daemon --port=${AFB_REMPORT} --workdir=${CMAKE_BINARY_DIR}/package --ldpaths=lib --roothttp=htdocs --token=\"${AFB_TOKEN}\" --tracereq=common --verbose")
+set(PACKAGE_MESSAGE "Install widget file using in the target : afm-util install ${PROJECT_NAME}.wgt")
+
+# Optional schema validator about now only XML, LUA and JSON
+# are supported
+#------------------------------------------------------------
+#set(LUA_CHECKER "luac" "-p" CACHE STRING "LUA compiler")
+#set(XML_CHECKER "xmllint" CACHE STRING "XML linter")
+#set(JSON_CHECKER "json_verify" CACHE STRING "JSON linter")
+
+# This include is mandatory and MUST happens at the end
+# of this file, else you expose you to unexpected behavior
+#
+# This CMake module could be found at the following url:
+# https://gerrit.automotivelinux.org/gerrit/#/admin/projects/src/cmake-apps-module
+# -----------------------------------------------------------
+include(CMakeAfbTemplates)
diff --git a/conf.d/wgt/config.xml.in b/conf.d/wgt/config.xml.in
new file mode 100644
index 0000000..9550cb5
--- /dev/null
+++ b/conf.d/wgt/config.xml.in
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" id="@PROJECT_NAME@" version="@PROJECT_VERSION@">
+ <name>@PROJECT_NAME@</name>
+ <icon src="@PROJECT_ICON@"/>
+ <content src="@WIDGET_ENTRY_POINT@" type="@WIDGET_TYPE@"/>
+ <description>@PROJECT_DESCRIPTION@</description>
+ <author>@PROJECT_AUTHOR@ &lt;@PROJECT_AUTHOR_MAIL@&gt;</author>
+ <license>@PROJECT_LICENSE@</license>
+ <feature name="urn:AGL:widget:required-permission">
+ <param name="urn:AGL:permission::public:display" value="required" />
+ <param name="urn:AGL:permission::public:no-htdocs" value="required" />
+ </feature>
+</widget>
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..fb61c40
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,137 @@
+###########################################################################
+# Copyright 2018 Konsulko Group
+# Copyright 2020 Collabora, Ltd.
+#
+# Author: Scott Murray <scott.murray@konsulko.com>
+# Author: Marius Vlad <marius.vlad@collabora.com>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+#set(CMAKE_CXX_STANDARD 14)
+#set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+find_package(PkgConfig REQUIRED)
+find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
+
+PROJECT_TARGET_ADD(waltham-receiver)
+
+# added just in case need additional windowing functionality
+#add_custom_command(
+# OUTPUT agl-shell-desktop-client-protocol.h
+# COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header
+# < ${CMAKE_SOURCE_DIR}/src/protocol/agl-shell-desktop.xml
+# > ${CMAKE_SOURCE_DIR}/src/agl-shell-desktop-client-protocol.h
+# DEPENDS ${CMAKE_SOURCE_DIR}/src/agl-shell-desktop.xml
+#)
+#
+#add_custom_command(
+# OUTPUT ${CMAKE_BINARY_DIR}/src/agl-shell-desktop-client-protocol.h
+# COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header
+# < ${CMAKE_SOURCE_DIR}/src/protocol/agl-shell-desktop.xml
+# > ${CMAKE_SOURCE_DIR}/src/agl-shell-desktop-client-protocol.h
+# DEPENDS ${CMAKE_SOURCE_DIR}/src/protocol/agl-shell-desktop.xml
+#)
+#
+#add_custom_command(
+# OUTPUT agl-shell-desktop-protocol.c
+# COMMAND ${WAYLAND_SCANNER_EXECUTABLE} code
+# < ${CMAKE_SOURCE_DIR}/src/protocol/agl-shell-desktop.xml
+# > ${CMAKE_BINARY_DIR}/src/agl-shell-desktop-protocol.c
+# DEPENDS ${CMAKE_SOURCE_DIR}/src/protocol/agl-shell-desktop.xml
+#)
+#
+
+pkg_check_modules(GSTREAMER REQUIRED gstreamer-1.0)
+pkg_check_modules(GSTREAMER_PLUGINS_BASE REQUIRED gstreamer-plugins-base-1.0)
+pkg_check_modules(GSTREAMER_VIDEO REQUIRED gstreamer-video-1.0)
+pkg_check_modules(GSTREAMER_PLUGINS_BAD REQUIRED gstreamer-plugins-bad-1.0)
+pkg_check_modules(WALTHAM REQUIRED waltham)
+
+pkg_check_modules(GLES2 REQUIRED glesv2)
+pkg_check_modules(EGL REQUIRED egl)
+pkg_check_modules(WAYLAND_EGL REQUIRED wayland-egl)
+
+pkg_check_modules(WAYLAND_CLIENT REQUIRED wayland-client)
+pkg_check_modules(WAYLAND_PROTOCOLS REQUIRED wayland-protocols>=1.18)
+pkg_get_variable(WAYLAND_PROTOCOLS_BASE wayland-protocols pkgdatadir)
+
+add_custom_command(
+ OUTPUT xdg-shell-client-protocol.h
+ COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header
+ < ${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
+ > ${CMAKE_SOURCE_DIR}/src/xdg-shell-client-protocol.h
+ DEPENDS ${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
+)
+
+add_custom_command(
+ OUTPUT ${CMAKE_BINARY_DIR}/src/xdg-shell-client-protocol.h
+ COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header
+ < ${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
+ > ${CMAKE_SOURCE_DIR}/src/xdg-shell-client-protocol.h
+ DEPENDS ${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
+)
+
+add_custom_command(
+ OUTPUT xdg-shell-protocol.c
+ COMMAND ${WAYLAND_SCANNER_EXECUTABLE} code
+ < ${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
+ > ${CMAKE_BINARY_DIR}/src/xdg-shell-protocol.c
+ DEPENDS ${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
+)
+
+add_executable(${TARGET_NAME}
+ bitmap.c
+ os-compatibility.c
+ wth-receiver-comm.c
+ wth-receiver-buffer.c
+ wth-receiver-surface.c
+ wth-receiver-seat.c
+ wth-receiver-gst-shm.c
+ wth-receiver-main.c
+ xdg-shell-protocol.c
+ xdg-shell-client-protocol.h
+ ${RESOURCES}
+)
+
+include_directories(
+ "../include"
+ "${GSTREAMER_INCLUDE_DIRS}"
+ "${WALTHAM_INCLUDE_DIRS}"
+ "${GSTREAMER_PLUGINS_BASE_INCLUDE_DIRS}"
+ "${GSTREAMER_PLUGINS_BAD_INCLUDE_DIRS}"
+ "${GSTREAMER_VIDEO_INCLUDE_DIRS}"
+)
+
+set_target_properties(${TARGET_NAME} PROPERTIES
+ LABELS "EXECUTABLE"
+ PREFIX ""
+ COMPILE_FLAGS "${EXTRAS_CFLAGS} -DFOR_AFB_BINDING"
+ LINK_FLAGS "${BINDINGS_LINK_FLAG}"
+ LINK_LIBRARIES "${EXTRAS_LIBRARIES}"
+ OUTPUT_NAME "${TARGET_NAME}"
+)
+
+target_link_libraries(${TARGET_NAME}
+ ${GSTREAMER_LIBRARIES}
+ ${WALTHAM_LIBRARIES}
+ "${GSTREAMER_PLUGINS_BASE_LIBRARIES}"
+ "${GSTREAMER_PLUGINS_BAD_LIBRARIES}"
+ "${GSTREAMER_VIDEO_LIBRARIES}"
+ ${WAYLAND_CLIENT_LIBRARIES}
+ ${WAYLAND_EGL_LIBRARIES}
+ ${EGL_LIBRARIES}
+ ${GLES2_LIBRARIES}
+ -lgstwayland-1.0
+)
diff --git a/src/wth-receiver-gst-shm.c b/src/wth-receiver-gst-shm.c
index 54950ef..2228d4f 100644
--- a/src/wth-receiver-gst-shm.c
+++ b/src/wth-receiver-gst-shm.c
@@ -836,11 +836,12 @@ wth_receiver_weston_main(struct window *window, const char *app_id, int port)
while (running && ret != -1)
ret = wl_display_dispatch(gstctx.display->display);
+
gst_element_set_state(gstctx.pipeline, GST_STATE_NULL);
+ gst_object_unref(gstctx.pipeline);
destroy_window(window);
destroy_display(gstctx.display);
- gst_object_unref(gstctx.pipeline);
free(gargv);
return 0;