commit 52e6ed54cbaf05cd1829099e04427d1706ca0da4 Author: Drew DeVault Date: Tue Apr 25 11:32:52 2017 -0400 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..5d4a2eca --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +CMakeCache.txt +CMakeFiles +Makefile +cmake_install.cmake +install_manifest.txt +*.swp +*.o +*.a +bin/ +test/ +build/ +.lvimrc +wayland-*-protocol.* diff --git a/CMake/FindA2X.cmake b/CMake/FindA2X.cmake new file mode 100644 index 00000000..b38f5086 --- /dev/null +++ b/CMake/FindA2X.cmake @@ -0,0 +1,75 @@ +# +# (c)2015 KiCad Developers +# (c)2015 Brian Sidebotham +# +# CMake module to find a2x (part of the asciidoc toolchain). +# +# Variables generated: +# +# A2X_FOUND true when A2X_COMMAND is valid +# A2X_COMMAND The command to run a2x (may be a list including an interpreter) +# A2X_VERSION The a2x version that has been found +# + +# Have a go at finding a a2x executable +find_program( A2X_PROGRAM a2x ) + +# Found something, attempt to try and use it... +if( A2X_PROGRAM ) + execute_process( + COMMAND ${A2X_PROGRAM} --version + OUTPUT_VARIABLE _OUT + ERROR_VARIABLE _ERR + RESULT_VARIABLE _RES + OUTPUT_STRIP_TRAILING_WHITESPACE ) + + # If it worked, set the A2X_COMMAND + if( _RES MATCHES 0 ) + set( A2X_COMMAND "${A2X_PROGRAM}" ) + endif() +endif() + +# If nothing could be found, test to see if we can just find the script file, +# that we'll then run with the python interpreter +if( NOT A2X_COMMAND ) + find_file( A2X_SCRIPT a2x.py ) + + if( A2X_SCRIPT ) + # Find the python interpreter quietly + if( NOT PYTHONINTERP_FOUND ) + find_package( PYTHONINTERP QUIET ) + endif() + + if( NOT PYTHONINTERP_FOUND ) + # Python's not available so can't find a2x... + set( A2X_COMMAND "" ) + else() + # Build the python based command + set( A2X_COMMAND "${PYTHON_EXECUTABLE}" "${A2X_SCRIPT}" ) + + execute_process( + COMMAND ${A2X_COMMAND} --version + OUTPUT_VARIABLE _OUT + ERROR_VARIABLE _ERR + RESULT_VARIABLE _RES + OUTPUT_STRIP_TRAILING_WHITESPACE ) + + # If it still can't be run, then give up + if( NOT _RES MATCHES 0 ) + set( A2X_COMMAND "" ) + endif() + endif() + endif() +endif() + +# If we've found a command that works, check the version +if( A2X_COMMAND ) + string(REGEX REPLACE ".*a2x[^0-9.]*\([0-9.]+\).*" "\\1" A2X_VERSION "${_OUT}") +endif() + +# Generate the *_FOUND as necessary, etc. +include( FindPackageHandleStandardArgs ) +find_package_handle_standard_args( + A2X + REQUIRED_VARS A2X_COMMAND + VERSION_VAR A2X_VERSION ) diff --git a/CMake/FindDRM.cmake b/CMake/FindDRM.cmake new file mode 100644 index 00000000..383647cd --- /dev/null +++ b/CMake/FindDRM.cmake @@ -0,0 +1,40 @@ +#.rst: +# FindDRM +# ------- +# +# Find DRM library +# +# Try to find DRM library on UNIX systems. The following values are defined +# +# :: +# +# DRM_FOUND - True if drm is available +# DRM_INCLUDE_DIRS - Include directories for drm +# DRM_LIBRARIES - List of libraries for drm +# DRM_DEFINITIONS - List of definitions for drm +# +#============================================================================= +# Copyright (c) 2015 Jari Vetoniemi +# +# Distributed under the OSI-approved BSD License (the "License"); +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +include(FeatureSummary) +set_package_properties(DRM PROPERTIES + URL "http://dri.freedesktop.org/" + DESCRIPTION "Kernel module that gives direct hardware access to DRI clients") + +find_package(PkgConfig) +pkg_check_modules(PC_DRM QUIET libdrm) +find_library(DRM_LIBRARIES NAMES drm HINTS ${PC_DRM_LIBRARY_DIRS}) +find_path(DRM_INCLUDE_DIRS NAMES drm.h PATH_SUFFIXES libdrm drm HINTS ${PC_DRM_INCLUDE_DIRS}) + +set(DRM_DEFINITIONS ${PC_DRM_CFLAGS_OTHER}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(DRM DEFAULT_MSG DRM_INCLUDE_DIRS DRM_LIBRARIES) +mark_as_advanced(DRM_INCLUDE_DIRS DRM_LIBRARIES DRM_DEFINITIONS) diff --git a/CMake/FindDbus.cmake b/CMake/FindDbus.cmake new file mode 100644 index 00000000..715e527b --- /dev/null +++ b/CMake/FindDbus.cmake @@ -0,0 +1,42 @@ +#.rst: +# FindDbus +# ----------- +# +# Find Dbus library +# +# Try to find Dbus library on UNIX systems. The following values are defined +# +# :: +# +# DBUS_FOUND - True if dbus is available +# DBUS_INCLUDE_DIRS - Include directories for dbus +# DBUS_LIBRARIES - List of libraries for dbus +# DBUS_DEFINITIONS - List of definitions for dbus +# +#============================================================================= +# Copyright (c) 2015 Jari Vetoniemi +# +# Distributed under the OSI-approved BSD License (the "License"); +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +include(FeatureSummary) +set_package_properties(Dbus PROPERTIES + URL "http://www.freedesktop.org/wiki/Software/dbus/" + DESCRIPTION "Message bus system") + +find_package(PkgConfig) +pkg_check_modules(PC_DBUS QUIET dbus-1) +find_path(DBUS_SYSTEM_INCLUDES dbus/dbus.h PATH_SUFFIXES dbus-1.0) +find_path(DBUS_LIB_INCLUDES dbus/dbus-arch-deps.h HINTS ${PC_DBUS_INCLUDE_DIRS} ${CMAKE_LIBRARY_PATH}/dbus-1.0/include ${CMAKE_SYSTEM_LIBRARY_PATH}/dbus-1.0/include) +find_library(DBUS_LIBRARIES NAMES dbus-1 HINTS ${PC_DBUS_LIBRARY_DIRS}) + +set(DBUS_INCLUDE_DIRS ${DBUS_SYSTEM_INCLUDES} ${DBUS_LIB_INCLUDES}) +set(DBUS_DEFINITIONS ${PC_DBUS_CFLAGS_OTHER}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(DBUS DEFAULT_MSG DBUS_INCLUDE_DIRS DBUS_LIBRARIES) +mark_as_advanced(DBUS_INCLUDE_DIRS DBUS_LIBRARIES DBUS_SYSTEM_INCLUDES DBUS_LIB_INCLUDES DBUS_DEFINITIONS) diff --git a/CMake/FindEGL.cmake b/CMake/FindEGL.cmake new file mode 100644 index 00000000..c044d1ce --- /dev/null +++ b/CMake/FindEGL.cmake @@ -0,0 +1,41 @@ +#.rst: +# FindEGL +# ------- +# +# Find EGL library +# +# Try to find EGL library. The following values are defined +# +# :: +# +# EGL_FOUND - True if egl is available +# EGL_INCLUDE_DIRS - Include directories for egl +# EGL_LIBRARIES - List of libraries for egl +# EGL_DEFINITIONS - List of definitions for egl +# +#============================================================================= +# Copyright (c) 2015 Jari Vetoniemi +# +# Distributed under the OSI-approved BSD License (the "License"); +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +include(FeatureSummary) +set_package_properties(EGL PROPERTIES + URL "http://www.khronos.org/egl/" + DESCRIPTION "Native Platform Interface") + +find_package(PkgConfig) +pkg_check_modules(PC_EGL QUIET egl) +find_library(EGL_LIBRARIES NAMES egl EGL HINTS ${PC_EGL_LIBRARY_DIRS}) +find_path(EGL_INCLUDE_DIRS NAMES EGL/egl.h HINTS ${PC_EGL_INCLUDE_DIRS}) + +set(EGL_DEFINITIONS ${PC_EGL_CFLAGS_OTHER}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(EGL DEFAULT_MSG EGL_LIBRARIES EGL_INCLUDE_DIRS) +mark_as_advanced(EGL_INCLUDE_DIRS EGL_LIBRARIES EGL_DEFINITIONS) + diff --git a/CMake/FindGLESv2.cmake b/CMake/FindGLESv2.cmake new file mode 100644 index 00000000..c2120efa --- /dev/null +++ b/CMake/FindGLESv2.cmake @@ -0,0 +1,41 @@ +#.rst: +# FindGLESv2 +# ------- +# +# Find GLESv2 library +# +# Try to find GLESv2 library. The following values are defined +# +# :: +# +# GLESv2_FOUND - True if glesv2 is available +# GLESv2_INCLUDE_DIRS - Include directories for glesv2 +# GLESv2_LIBRARIES - List of libraries for glesv2 +# GLESv2_DEFINITIONS - List of definitions for glesv2 +# +#============================================================================= +# Copyright (c) 2015 Jari Vetoniemi +# +# Distributed under the OSI-approved BSD License (the "License"); +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +include(FeatureSummary) +set_package_properties(GLESv2 PROPERTIES + URL "https://www.khronos.org/opengles/" + DESCRIPTION "The Standard for Embedded Accelerated 3D Graphics") + +find_package(PkgConfig) +pkg_check_modules(PC_GLES2 QUIET glesv2) +find_library(GLESv2_LIBRARIES NAMES GLESv2 ${PC_GLES2_LIBRARY_DIRS}) +find_path(GLESv2_INCLUDE_DIRS NAMES GLES2/gl2.h HINTS ${PC_GLES2_INCLUDE_DIRS}) + +set(GLESv2_DEFINITIONS ${PC_GLES2_CFLAGS_OTHER}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GLESv2 DEFAULT_MSG GLESv2_LIBRARIES GLESv2_INCLUDE_DIRS) +mark_as_advanced(GLESv2_INCLUDE_DIRS GLESv2_LIBRARIES GLESv2_DEFINITIONS) + diff --git a/CMake/FindLibInput.cmake b/CMake/FindLibInput.cmake new file mode 100644 index 00000000..8e3b222b --- /dev/null +++ b/CMake/FindLibInput.cmake @@ -0,0 +1,72 @@ +#.rst: +# FindLibInput +# ------- +# +# Find LibInput library +# +# Try to find LibInpu library. The following values are defined +# +# :: +# +# LIBINPUT_FOUND - True if libinput is available +# LIBINPUT_INCLUDE_DIRS - Include directories for libinput +# LIBINPUT_LIBRARIES - List of libraries for libinput +# LIBINPUT_DEFINITIONS - List of definitions for libinput +# +# and also the following more fine grained variables +# +# :: +# +# LIBINPUT_VERSION +# LIBINPUT_VERSION_MAJOR +# LIBINPUT_VERSION_MINOR +# LIBINPUT_VERSION_MICRO +# +#============================================================================= +# Copyright (c) 2015 Jari Vetoniemi +# +# Distributed under the OSI-approved BSD License (the "License"); +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +include(FeatureSummary) +set_package_properties(LibInput PROPERTIES + URL "http://freedesktop.org/wiki/Software/libinput/" + DESCRIPTION "Library to handle input devices") + +find_package(PkgConfig) +pkg_check_modules(PC_INPUT QUIET libinput) +find_library(LIBINPUT_LIBRARIES NAMES input HINTS ${PC_INPUT_LIBRARY_DIRS}) +find_path(LIBINPUT_INCLUDE_DIRS libinput.h HINTS ${PC_INPUT_INCLUDE_DIRS}) + +set(LIBINPUT_VERSION ${PC_INPUT_VERSION}) +string(REPLACE "." ";" VERSION_LIST "${PC_INPUT_VERSION}") + +LIST(LENGTH VERSION_LIST n) +if (n EQUAL 3) + list(GET VERSION_LIST 0 LIBINPUT_VERSION_MAJOR) + list(GET VERSION_LIST 1 LIBINPUT_VERSION_MINOR) + list(GET VERSION_LIST 2 LIBINPUT_VERSION_MICRO) +else () + set(LIBINPUT_VERSION "9999.9999.9999") + set(LIBINPUT_VERSION_MAJOR 9999) + set(LIBINPUT_VERSION_MINOR 9999) + set(LIBINPUT_VERSION_MICRO 9999) + message(WARNING "Could not detect libinput version, assuming you have recent one") +endif () + +# This is compatible with libinput-version.h that exists in upstream +# but isn't in distribution (probably forgotten) +set(LIBINPUT_DEFINITIONS ${PC_INPUT_CFLAGS_OTHER} + -DLIBINPUT_VERSION=\"${LIBINPUT_VERSION}\" + -DLIBINPUT_VERSION_MAJOR=${LIBINPUT_VERSION_MAJOR} + -DLIBINPUT_VERSION_MINOR=${LIBINPUT_VERSION_MINOR} + -DLIBINPUT_VERSION_MICRO=${LIBINPUT_VERSION_MICRO}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LIBINPUT DEFAULT_MSG LIBINPUT_INCLUDE_DIRS LIBINPUT_LIBRARIES) +mark_as_advanced(LIBINPUT_INCLUDE_DIRS LIBINPUT_LIBRARIES LIBINPUT_DEFINITIONS + LIBINPUT_VERSION LIBINPUT_VERSION_MAJOR LIBINPUT_VERSION_MICRO LIBINPUT_VERSION_MINOR) diff --git a/CMake/FindUdev.cmake b/CMake/FindUdev.cmake new file mode 100644 index 00000000..dd97d8e0 --- /dev/null +++ b/CMake/FindUdev.cmake @@ -0,0 +1,40 @@ +#.rst: +# FindUdev +# ------- +# +# Find udev library +# +# Try to find udev library on UNIX systems. The following values are defined +# +# :: +# +# UDEV_FOUND - True if udev is available +# UDEV_INCLUDE_DIRS - Include directories for udev +# UDEV_LIBRARIES - List of libraries for udev +# UDEV_DEFINITIONS - List of definitions for udev +# +#============================================================================= +# Copyright (c) 2015 Jari Vetoniemi +# +# Distributed under the OSI-approved BSD License (the "License"); +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +include(FeatureSummary) +set_package_properties(Udev PROPERTIES + URL "https://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/udev.html" + DESCRIPTION "Device manager for the Linux kernel") + +find_package(PkgConfig) +pkg_check_modules(PC_UDEV QUIET libudev) +find_library(UDEV_LIBRARIES NAMES udev HINTS ${PC_UDEV_LIBRARY_DIRS}) +find_path(UDEV_INCLUDE_DIRS libudev.h HINTS ${PC_UDEV_INCLUDE_DIRS}) + +set(UDEV_DEFINITIONS ${PC_UDEV_CFLAGS_OTHER}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(UDEV DEFAULT_MSG UDEV_INCLUDE_DIRS UDEV_LIBRARIES) +mark_as_advanced(UDEV_INCLUDE_DIRS UDEV_LIBRARIES UDEV_DEFINITIONS) diff --git a/CMake/FindWayland.cmake b/CMake/FindWayland.cmake new file mode 100644 index 00000000..465d2665 --- /dev/null +++ b/CMake/FindWayland.cmake @@ -0,0 +1,69 @@ +#.rst: +# FindWayland +# ----------- +# +# Find Wayland installation +# +# Try to find Wayland. The following values are defined +# +# :: +# +# WAYLAND_FOUND - True if Wayland is found +# WAYLAND_LIBRARIES - Link these to use Wayland +# WAYLAND_INCLUDE_DIRS - Include directories for Wayland +# WAYLAND_DEFINITIONS - Compiler flags for using Wayland +# +# and also the following more fine grained variables: +# +# :: +# +# WAYLAND_CLIENT_FOUND, WAYLAND_CLIENT_INCLUDE_DIRS, WAYLAND_CLIENT_LIBRARIES +# WAYLAND_SERVER_FOUND, WAYLAND_SERVER_INCLUDE_DIRS, WAYLAND_SERVER_LIBRARIES +# WAYLAND_EGL_FOUND, WAYLAND_EGL_INCLUDE_DIRS, WAYLAND_EGL_LIBRARIES +# +#============================================================================= +# Copyright (c) 2015 Jari Vetoniemi +# 2013 Martin Gräßlin +# +# Distributed under the OSI-approved BSD License (the "License"); +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +include(FeatureSummary) +set_package_properties(Wayland PROPERTIES + URL "http://wayland.freedesktop.org/" + DESCRIPTION "Protocol for implementing compositors") + +find_package(PkgConfig) +pkg_check_modules(PC_WAYLAND QUIET wayland-client>=1.7 wayland-server>=1.7 wayland-egl) + +find_library(WAYLAND_CLIENT_LIBRARIES NAMES wayland-client HINTS ${PC_WAYLAND_LIBRARY_DIRS}) +find_library(WAYLAND_SERVER_LIBRARIES NAMES wayland-server HINTS ${PC_WAYLAND_LIBRARY_DIRS}) +find_library(WAYLAND_EGL_LIBRARIES NAMES wayland-egl HINTS ${PC_WAYLAND_LIBRARY_DIRS}) + +find_path(WAYLAND_CLIENT_INCLUDE_DIRS NAMES wayland-client.h HINTS ${PC_WAYLAND_INCLUDE_DIRS}) +find_path(WAYLAND_SERVER_INCLUDE_DIRS NAMES wayland-server.h HINTS ${PC_WAYLAND_INCLUDE_DIRS}) +find_path(WAYLAND_EGL_INCLUDE_DIRS NAMES wayland-egl.h HINTS ${PC_WAYLAND_INCLUDE_DIRS}) + +set(WAYLAND_INCLUDE_DIRS ${WAYLAND_CLIENT_INCLUDE_DIRS} ${WAYLAND_SERVER_INCLUDE_DIRS} ${WAYLAND_EGL_INCLUDE_DIRS}) +set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_EGL_LIBRARIES}) +set(WAYLAND_DEFINITIONS ${PC_WAYLAND_CFLAGS}) + +list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIRS) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WAYLAND_CLIENT DEFAULT_MSG WAYLAND_CLIENT_LIBRARIES WAYLAND_CLIENT_INCLUDE_DIRS) +find_package_handle_standard_args(WAYLAND_SERVER DEFAULT_MSG WAYLAND_SERVER_LIBRARIES WAYLAND_SERVER_INCLUDE_DIRS) +find_package_handle_standard_args(WAYLAND_EGL DEFAULT_MSG WAYLAND_EGL_LIBRARIES WAYLAND_EGL_INCLUDE_DIRS) +find_package_handle_standard_args(WAYLAND DEFAULT_MSG WAYLAND_LIBRARIES WAYLAND_INCLUDE_DIRS) + +mark_as_advanced( + WAYLAND_INCLUDE_DIRS WAYLAND_LIBRARIES + WAYLAND_CLIENT_INCLUDE_DIRS WAYLAND_CLIENT_LIBRARIES + WAYLAND_SERVER_INCLUDE_DIRS WAYLAND_SERVER_LIBRARIES + WAYLAND_EGL_INCLUDE_DIRS WAYLAND_EGL_LIBRARIES + WAYLAND_DEFINITIONS + ) diff --git a/CMake/FindWaylandProtocols.cmake b/CMake/FindWaylandProtocols.cmake new file mode 100644 index 00000000..8a8129b5 --- /dev/null +++ b/CMake/FindWaylandProtocols.cmake @@ -0,0 +1,39 @@ +#.rst: +# FindWaylandProtocols +# ------- +# +# Find wayland protocol description files +# +# Try to find wayland protocol files. The following values are defined +# +# :: +# +# WAYLANDPROTOCOLS_FOUND - True if wayland protocol files are available +# WAYLANDPROTOCOLS_PATH - Path to wayland protocol files +# +#============================================================================= +# Copyright (c) 2015 Jari Vetoniemi +# +# Distributed under the OSI-approved BSD License (the "License"); +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +include(FeatureSummary) +set_package_properties(WaylandProtocols PROPERTIES + URL "https://cgit.freedesktop.org/wayland/wayland-protocols" + DESCRIPTION "Wayland protocol development") + +unset(WAYLANDPROTOCOLS_PATH) + +find_package(PkgConfig) +if (PKG_CONFIG_FOUND) + execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols + OUTPUT_VARIABLE WAYLANDPROTOCOLS_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) +endif () + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WaylandProtocols DEFAULT_MSG WAYLANDPROTOCOLS_PATH) +mark_as_advanced(WAYLANDPROTOCOLS_PATH) diff --git a/CMake/Manpage.cmake b/CMake/Manpage.cmake new file mode 100644 index 00000000..d9780bc4 --- /dev/null +++ b/CMake/Manpage.cmake @@ -0,0 +1,31 @@ +find_package(A2X REQUIRED) + +add_custom_target(man ALL) + +function(add_manpage name section) + add_custom_command( + OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section} + COMMAND ${A2X_COMMAND} + --no-xmllint + --doctype manpage + --format manpage + -D ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + ${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt + COMMENT Generating manpage for ${name}.${section} + ) + + add_custom_target(man-${name}.${section} + DEPENDS + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section} + ) + add_dependencies(man + man-${name}.${section} + ) + + install( + FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section} + DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/man/man${section} + COMPONENT documentation + ) +endfunction() diff --git a/CMake/Wayland.cmake b/CMake/Wayland.cmake new file mode 100644 index 00000000..6647c5ee --- /dev/null +++ b/CMake/Wayland.cmake @@ -0,0 +1,77 @@ +#============================================================================= +# Copyright (C) 2012-2013 Pier Luigi Fiorini +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Pier Luigi Fiorini nor the names of his +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner) + +# wayland_add_protocol_client(outfiles inputfile basename) +function(WAYLAND_ADD_PROTOCOL_CLIENT _sources _protocol _basename) + if(NOT WAYLAND_SCANNER_EXECUTABLE) + message(FATAL "The wayland-scanner executable has not been found on your system. You must install it.") + endif() + + get_filename_component(_infile ${_protocol} ABSOLUTE) + set(_client_header "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-client-protocol.h") + set(_code "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-protocol.c") + + add_custom_command(OUTPUT "${_client_header}" + COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header < ${_infile} > ${_client_header} + DEPENDS ${_infile} VERBATIM) + + add_custom_command(OUTPUT "${_code}" + COMMAND ${WAYLAND_SCANNER_EXECUTABLE} code < ${_infile} > ${_code} + DEPENDS ${_infile} VERBATIM) + + list(APPEND ${_sources} "${_client_header}" "${_code}") + set(${_sources} ${${_sources}} PARENT_SCOPE) +endfunction() + +# wayland_add_protocol_server(outfiles inputfile basename) +function(WAYLAND_ADD_PROTOCOL_SERVER _sources _protocol _basename) + if(NOT WAYLAND_SCANNER_EXECUTABLE) + message(FATAL "The wayland-scanner executable has not been found on your system. You must install it.") + endif() + + get_filename_component(_infile ${_protocol} ABSOLUTE) + set(_server_header "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-server-protocol.h") + set(_code "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-protocol.c") + + add_custom_command(OUTPUT "${_server_header}" + COMMAND ${WAYLAND_SCANNER_EXECUTABLE} server-header < ${_infile} > ${_server_header} + DEPENDS ${_infile} VERBATIM) + + add_custom_command(OUTPUT "${_code}" + COMMAND ${WAYLAND_SCANNER_EXECUTABLE} code < ${_infile} > ${_code} + DEPENDS ${_infile} VERBATIM) + + list(APPEND ${_sources} "${_server_header}" "${_code}") + set(${_sources} ${${_sources}} PARENT_SCOPE) +endfunction() diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..19546711 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,60 @@ +cmake_minimum_required(VERSION 3.1.0) + +project(wlroots C) + +if (CMAKE_BUILD_TYPE EQUAL "Debug") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") +endif() +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_EXTENSIONS OFF) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") +if (CMAKE_COMPILER_IS_GNUCC) + if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wimplicit-fallthrough=0") + endif() +endif() + +list(INSERT CMAKE_MODULE_PATH 0 + ${CMAKE_CURRENT_SOURCE_DIR}/CMake +) +if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git) + execute_process( + COMMAND git describe --always --tags + OUTPUT_VARIABLE GIT_COMMIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + execute_process( + COMMAND git rev-parse --abbrev-ref HEAD + OUTPUT_VARIABLE GIT_BRANCH + OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) +endif() + +add_definitions(-DWLR_GIT_VERSION=\"${GIT_COMMIT_HASH}\") +add_definitions(-DWLR_GIT_BRANCH=\"${GIT_BRANCH}\") + +string(TIMESTAMP CURRENT_DATE "%Y-%m-%d" UTC) +add_definitions(-DWLR_VERSION_DATE=\"${CURRENT_DATE}\") + +find_package(Wayland REQUIRED) +find_package(WaylandProtocols REQUIRED) +find_package(EGL REQUIRED) +find_package(GLESv2 REQUIRED) +find_package(DRM REQUIRED) +find_package(LibInput REQUIRED) +find_package(Udev) +find_package(Dbus) + +include(Wayland) +include(Manpage) + +include_directories(include) + +add_subdirectory(backend) diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..da397236 --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2017 Drew DeVault +Copyright (c) 2014 Jari Vetoniemi + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..74a2385e --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# wlroots + +A set of utility libraries for Wayland compositors. + +WIP diff --git a/backend/CMakeLists.txt b/backend/CMakeLists.txt new file mode 100644 index 00000000..d69efdd5 --- /dev/null +++ b/backend/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(wayland) diff --git a/backend/wayland/CMakeLists.txt b/backend/wayland/CMakeLists.txt new file mode 100644 index 00000000..f185245c --- /dev/null +++ b/backend/wayland/CMakeLists.txt @@ -0,0 +1,13 @@ +include_directories( + ${PROTOCOLS_INCLUDE_DIRS} + ${WAYLAND_INCLUDE_DIR} + . +) + +add_library(wlr-backend-wayland + backend.c +) + +target_link_libraries(wlr-backend-wayland + ${WAYLAND_LIBRARIES} +) diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c new file mode 100644 index 00000000..3564fc12 --- /dev/null +++ b/backend/wayland/backend.c @@ -0,0 +1,13 @@ +#include +#include +#include +#include "backend/wayland.h" + +struct wlr_wayland_backend *wayland_backend_init(struct wl_display *display, + size_t outputs) { + struct wlr_wayland_backend *backend = calloc( + sizeof(struct wlr_wayland_backend), 1); + backend->local_display = display; + // TODO: obtain reference to remote display + return backend; +} diff --git a/include/backend/wayland.h b/include/backend/wayland.h new file mode 100644 index 00000000..9a445af9 --- /dev/null +++ b/include/backend/wayland.h @@ -0,0 +1,9 @@ +#ifndef _WLR_BACKEND_WAYLAND_INTERNAL_H +#define _WLR_BACKEND_WAYLAND_INTERNAL_H + +struct wlr_wayland_backend { + struct wl_display *local_display; + struct wl_display *remote_display; +}; + +#endif