From 924bf0f669cde20b414cd9f12e72750ca5fdbbaf Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Tue, 11 Jul 2017 00:20:31 +1200 Subject: [PATCH 1/3] Changed build system to meson --- .gitignore | 3 - CMake/FindA2X.cmake | 75 ---------------- CMake/FindDRM.cmake | 40 --------- CMake/FindDbus.cmake | 42 --------- CMake/FindEGL.cmake | 41 --------- CMake/FindGBM.cmake | 39 --------- CMake/FindGLESv2.cmake | 41 --------- CMake/FindLibInput.cmake | 72 ---------------- CMake/FindLibcap.cmake | 56 ------------ CMake/FindSystemd.cmake | 40 --------- CMake/FindUdev.cmake | 40 --------- CMake/FindWayland.cmake | 69 --------------- CMake/FindWaylandProtocols.cmake | 39 --------- CMake/FindXKBCommon.cmake | 19 ----- CMake/Manpage.cmake | 33 -------- CMake/Wayland.cmake | 77 ----------------- CMakeLists.txt | 67 --------------- README.md | 8 +- backend/CMakeLists.txt | 42 --------- examples/CMakeLists.txt | 81 ------------------ examples/compositor/main.c | 4 +- examples/compositor/wl_compositor.c | 2 +- examples/compositor/wl_shell.c | 2 +- meson.build | 127 ++++++++++++++++++++++++++++ render/CMakeLists.txt | 10 --- session/CMakeLists.txt | 35 -------- types/CMakeLists.txt | 20 ----- util/CMakeLists.txt | 6 -- 28 files changed, 134 insertions(+), 996 deletions(-) delete mode 100644 CMake/FindA2X.cmake delete mode 100644 CMake/FindDRM.cmake delete mode 100644 CMake/FindDbus.cmake delete mode 100644 CMake/FindEGL.cmake delete mode 100644 CMake/FindGBM.cmake delete mode 100644 CMake/FindGLESv2.cmake delete mode 100644 CMake/FindLibInput.cmake delete mode 100644 CMake/FindLibcap.cmake delete mode 100644 CMake/FindSystemd.cmake delete mode 100644 CMake/FindUdev.cmake delete mode 100644 CMake/FindWayland.cmake delete mode 100644 CMake/FindWaylandProtocols.cmake delete mode 100644 CMake/FindXKBCommon.cmake delete mode 100644 CMake/Manpage.cmake delete mode 100644 CMake/Wayland.cmake delete mode 100644 CMakeLists.txt delete mode 100644 backend/CMakeLists.txt delete mode 100644 examples/CMakeLists.txt create mode 100644 meson.build delete mode 100644 render/CMakeLists.txt delete mode 100644 session/CMakeLists.txt delete mode 100644 types/CMakeLists.txt delete mode 100644 util/CMakeLists.txt diff --git a/.gitignore b/.gitignore index ce85118c..45f31436 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,4 @@ -CMakeCache.txt -CMakeFiles Makefile -cmake_install.cmake install_manifest.txt .clang_complete *.swp diff --git a/CMake/FindA2X.cmake b/CMake/FindA2X.cmake deleted file mode 100644 index b38f5086..00000000 --- a/CMake/FindA2X.cmake +++ /dev/null @@ -1,75 +0,0 @@ -# -# (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 deleted file mode 100644 index 383647cd..00000000 --- a/CMake/FindDRM.cmake +++ /dev/null @@ -1,40 +0,0 @@ -#.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 deleted file mode 100644 index 715e527b..00000000 --- a/CMake/FindDbus.cmake +++ /dev/null @@ -1,42 +0,0 @@ -#.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 deleted file mode 100644 index c044d1ce..00000000 --- a/CMake/FindEGL.cmake +++ /dev/null @@ -1,41 +0,0 @@ -#.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/FindGBM.cmake b/CMake/FindGBM.cmake deleted file mode 100644 index 85df1f7c..00000000 --- a/CMake/FindGBM.cmake +++ /dev/null @@ -1,39 +0,0 @@ -#.rst: -# FindGBM -# ------- -# -# Find GBM library -# -# Try to find GBM library on UNIX systems. The following values are defined -# -# :: -# -# GBM_FOUND - True if gbm is available -# GBM_INCLUDE_DIRS - Include directories for gbm -# GBM_LIBRARIES - List of libraries for gbm -# GBM_DEFINITIONS - List of definitions for gbm -# -#============================================================================= -# 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. -#============================================================================= - -set_package_properties(GBM PROPERTIES - URL "http://www.mesa3d.org/" - DESCRIPTION "Generic buffer manager") - -find_package(PkgConfig) -pkg_check_modules(PC_GBM QUIET gbm) -find_library(GBM_LIBRARIES NAMES gbm HINTS ${PC_GBM_LIBRARY_DIRS}) -find_path(GBM_INCLUDE_DIRS gbm.h HINTS ${PC_GBM_INCLUDE_DIRS}) - -set(GBM_DEFINITIONS ${PC_GBM_CFLAGS_OTHER}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(GBM DEFAULT_MSG GBM_INCLUDE_DIRS GBM_LIBRARIES) -mark_as_advanced(GBM_INCLUDE_DIRS GBM_LIBRARIES GBM_DEFINITIONS) diff --git a/CMake/FindGLESv2.cmake b/CMake/FindGLESv2.cmake deleted file mode 100644 index c2120efa..00000000 --- a/CMake/FindGLESv2.cmake +++ /dev/null @@ -1,41 +0,0 @@ -#.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 deleted file mode 100644 index 8e3b222b..00000000 --- a/CMake/FindLibInput.cmake +++ /dev/null @@ -1,72 +0,0 @@ -#.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/FindLibcap.cmake b/CMake/FindLibcap.cmake deleted file mode 100644 index b34e5e37..00000000 --- a/CMake/FindLibcap.cmake +++ /dev/null @@ -1,56 +0,0 @@ -#.rst: -# FindLibcap -# ------- -# -# Find Libcap library -# -# Try to find Libcap library. The following values are defined -# -# :: -# -# Libcap_FOUND - True if Libcap is available -# Libcap_INCLUDE_DIRS - Include directories for Libcap -# Libcap_LIBRARIES - List of libraries for Libcap -# Libcap_DEFINITIONS - List of definitions for Libcap -# -# and also the following more fine grained variables -# -# :: -# -# Libcap_VERSION -# Libcap_VERSION_MAJOR -# Libcap_VERSION_MINOR -# -#============================================================================= -# Copyright (c) 2017 Jerzi Kaminsky -# -# 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(Libcap PROPERTIES - URL "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2" - DESCRIPTION "Library for getting and setting POSIX.1e capabilities") - -find_package(PkgConfig) -pkg_check_modules(PC_CAP QUIET Libcap) -find_library(Libcap_LIBRARIES NAMES cap HINTS ${PC_CAP_LIBRARY_DIRS}) -find_path(Libcap_INCLUDE_DIRS sys/capability.h HINTS ${PC_CAP_INCLUDE_DIRS}) - -set(Libcap_VERSION ${PC_CAP_VERSION}) -string(REPLACE "." ";" VERSION_LIST "${PC_CAP_VERSION}") - -LIST(LENGTH VERSION_LIST n) -if (n EQUAL 2) - list(GET VERSION_LIST 0 Libcap_VERSION_MAJOR) - list(GET VERSION_LIST 1 Libcap_VERSION_MINOR) -endif () - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Libcap DEFAULT_MSG Libcap_INCLUDE_DIRS Libcap_LIBRARIES) -mark_as_advanced(Libcap_INCLUDE_DIRS Libcap_LIBRARIES Libcap_DEFINITIONS - Libcap_VERSION Libcap_VERSION_MAJOR Libcap_VERSION_MICRO Libcap_VERSION_MINOR) diff --git a/CMake/FindSystemd.cmake b/CMake/FindSystemd.cmake deleted file mode 100644 index 09d60115..00000000 --- a/CMake/FindSystemd.cmake +++ /dev/null @@ -1,40 +0,0 @@ -#.rst: -# FindSystemd -# ------- -# -# Find Systemd library -# -# Try to find Systemd library on UNIX systems. The following values are defined -# -# :: -# -# SYSTEMD_FOUND - True if Systemd is available -# SYSTEMD_INCLUDE_DIRS - Include directories for Systemd -# SYSTEMD_LIBRARIES - List of libraries for Systemd -# SYSTEMD_DEFINITIONS - List of definitions for Systemd -# -#============================================================================= -# 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(Systemd PROPERTIES - URL "http://freedesktop.org/wiki/Software/systemd/" - DESCRIPTION "System and Service Manager") - -find_package(PkgConfig) -pkg_check_modules(PC_SYSTEMD QUIET libsystemd) -find_library(SYSTEMD_LIBRARIES NAMES systemd ${PC_SYSTEMD_LIBRARY_DIRS}) -find_path(SYSTEMD_INCLUDE_DIRS systemd/sd-login.h HINTS ${PC_SYSTEMD_INCLUDE_DIRS}) - -set(SYSTEMD_DEFINITIONS ${PC_SYSTEMD_CFLAGS_OTHER}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(SYSTEMD DEFAULT_MSG SYSTEMD_INCLUDE_DIRS SYSTEMD_LIBRARIES) -mark_as_advanced(SYSTEMD_INCLUDE_DIRS SYSTEMD_LIBRARIES SYSTEMD_DEFINITIONS) diff --git a/CMake/FindUdev.cmake b/CMake/FindUdev.cmake deleted file mode 100644 index dd97d8e0..00000000 --- a/CMake/FindUdev.cmake +++ /dev/null @@ -1,40 +0,0 @@ -#.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 deleted file mode 100644 index 465d2665..00000000 --- a/CMake/FindWayland.cmake +++ /dev/null @@ -1,69 +0,0 @@ -#.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 deleted file mode 100644 index 8a8129b5..00000000 --- a/CMake/FindWaylandProtocols.cmake +++ /dev/null @@ -1,39 +0,0 @@ -#.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/FindXKBCommon.cmake b/CMake/FindXKBCommon.cmake deleted file mode 100644 index 30ac503a..00000000 --- a/CMake/FindXKBCommon.cmake +++ /dev/null @@ -1,19 +0,0 @@ -# - Find XKBCommon -# Once done, this will define -# -# XKBCOMMON_FOUND - System has XKBCommon -# XKBCOMMON_INCLUDE_DIRS - The XKBCommon include directories -# XKBCOMMON_LIBRARIES - The libraries needed to use XKBCommon -# XKBCOMMON_DEFINITIONS - Compiler switches required for using XKBCommon - -find_package(PkgConfig) -pkg_check_modules(PC_XKBCOMMON QUIET xkbcommon) -find_path(XKBCOMMON_INCLUDE_DIRS NAMES xkbcommon/xkbcommon.h HINTS ${PC_XKBCOMMON_INCLUDE_DIRS}) -find_library(XKBCOMMON_LIBRARIES NAMES xkbcommon HINTS ${PC_XKBCOMMON_LIBRARY_DIRS}) - -set(XKBCOMMON_DEFINITIONS ${PC_XKBCOMMON_CFLAGS_OTHER}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(XKBCOMMON DEFAULT_MSG XKBCOMMON_LIBRARIES XKBCOMMON_INCLUDE_DIRS) -mark_as_advanced(XKBCOMMON_LIBRARIES XKBCOMMON_INCLUDE_DIRS) - diff --git a/CMake/Manpage.cmake b/CMake/Manpage.cmake deleted file mode 100644 index cc04d710..00000000 --- a/CMake/Manpage.cmake +++ /dev/null @@ -1,33 +0,0 @@ -find_package(A2X) - -if (A2X_FOUND) - 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() -endif() diff --git a/CMake/Wayland.cmake b/CMake/Wayland.cmake deleted file mode 100644 index 6647c5ee..00000000 --- a/CMake/Wayland.cmake +++ /dev/null @@ -1,77 +0,0 @@ -#============================================================================= -# 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 deleted file mode 100644 index d1276f8b..00000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,67 +0,0 @@ -cmake_minimum_required(VERSION 3.1.0) - -project(wlroots C) - -set(CMAKE_C_STANDARD 11) -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}\") -add_definitions(-DWLR_SRC_DIR=\"${CMAKE_SOURCE_DIR}\") - -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(GBM REQUIRED) -find_package(LibInput REQUIRED) -find_package(XKBCommon REQUIRED) -find_package(Udev REQUIRED) -find_package(Libcap) -find_package(Systemd) - -include(Wayland) -include(Manpage) - -include_directories(include) - -add_subdirectory(backend) -add_subdirectory(types) -add_subdirectory(session) -add_subdirectory(render) -add_subdirectory(util) - -add_subdirectory(examples) diff --git a/README.md b/README.md index 4dcfed0e..c386ce81 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ WIP - [Status](https://github.com/SirCmpwn/wlroots/issues/9) Install dependencies: -* cmake +* meson * wayland * wayland-protocols * EGL @@ -23,8 +23,6 @@ Install dependencies: Run these commands: - mkdir build + meson --buildtype=release build cd build - cmake -DCMAKE_BUILD_TYPE=Release .. - make - sudo make install + ninja diff --git a/backend/CMakeLists.txt b/backend/CMakeLists.txt deleted file mode 100644 index 5486b302..00000000 --- a/backend/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -include_directories( - ${PROTOCOLS_INCLUDE_DIRS} - ${WAYLAND_INCLUDE_DIR} - ${DRM_INCLUDE_DIRS} - ${LIBINPUT_INCLUDE_DIRS} -) - -add_library(wlr-backend - wayland/backend.c - wayland/registry.c - wayland/wl_seat.c - wayland/output.c - drm/backend.c - drm/drm.c - - libinput/backend.c - libinput/events.c - libinput/keyboard.c - libinput/pointer.c - libinput/touch.c - libinput/tablet_tool.c - libinput/tablet_pad.c - - multi/backend.c - backend.c - egl.c - udev.c -) - -target_link_libraries(wlr-backend - wlr-util - wlr-types - ${WAYLAND_LIBRARIES} - ${DRM_LIBRARIES} - ${GBM_LIBRARIES} - ${GLESv2_LIBRARIES} - ${EGL_LIBRARIES} - ${SYSTEMD_LIBRARIES} - ${UDEV_LIBRARIES} - ${LIBINPUT_LIBRARIES} - ${GBM_LIBRARIES} -) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt deleted file mode 100644 index f3f555c3..00000000 --- a/examples/CMakeLists.txt +++ /dev/null @@ -1,81 +0,0 @@ -include_directories( - ${DRM_INCLUDE_DIRS} - ${CMAKE_CURRENT_SOURCE_DIR} - ${XKBCOMMON_INCLUDE_DIRS} -) - -add_executable(simple - simple.c - shared.c -) - -target_link_libraries(simple - wlr-backend - wlr-session - ${XKBCOMMON_LIBRARIES} -) - -add_executable(rotation - rotation.c - shared.c - cat.c -) - -target_link_libraries(rotation - wlr-backend - wlr-session - wlr-render - ${XKBCOMMON_LIBRARIES} -) - -add_executable(pointer - pointer.c - shared.c - cat.c -) - -target_link_libraries(pointer - wlr-backend - wlr-session - wlr-render - ${XKBCOMMON_LIBRARIES} -) - -add_executable(touch - touch.c - shared.c - cat.c -) - -target_link_libraries(touch - wlr-backend - wlr-session - wlr-render - ${XKBCOMMON_LIBRARIES} -) - -add_executable(tablet - tablet.c - shared.c -) - -target_link_libraries(tablet - wlr-backend - wlr-session - wlr-render - ${XKBCOMMON_LIBRARIES} -) - -add_executable(compositor - compositor/main.c - compositor/wl_compositor.c - compositor/wl_shell.c - shared.c -) - -target_link_libraries(compositor - wlr-backend - wlr-session - wlr-render - ${XKBCOMMON_LIBRARIES} -) diff --git a/examples/compositor/main.c b/examples/compositor/main.c index 6a689669..d59ef7a8 100644 --- a/examples/compositor/main.c +++ b/examples/compositor/main.c @@ -11,8 +11,8 @@ #include #include #include -#include "shared.h" -#include "compositor.h" +#include "../shared.h" +#include "../compositor.h" struct sample_state { struct wlr_renderer *renderer; diff --git a/examples/compositor/wl_compositor.c b/examples/compositor/wl_compositor.c index 0cd73afb..198e0a34 100644 --- a/examples/compositor/wl_compositor.c +++ b/examples/compositor/wl_compositor.c @@ -1,7 +1,7 @@ #include #include #include -#include "compositor.h" +#include "../compositor.h" static void wl_compositor_create_surface(struct wl_client *client, struct wl_resource *resource, uint32_t id) { diff --git a/examples/compositor/wl_shell.c b/examples/compositor/wl_shell.c index f2ec3c56..9067ef09 100644 --- a/examples/compositor/wl_shell.c +++ b/examples/compositor/wl_shell.c @@ -1,7 +1,7 @@ #include #include #include -#include "compositor.h" +#include "../compositor.h" void wl_shell_get_shell_surface(struct wl_client *client, struct wl_resource *resource, uint32_t id, diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..561128f1 --- /dev/null +++ b/meson.build @@ -0,0 +1,127 @@ +project('wlroots', 'c', + license: 'MIT', + default_options: 'c_std=c11') + +add_project_arguments('-Wall', '-Wextra', '-Wno-unused-parameter', '-Werror', language: 'c') +add_project_arguments('-DWLR_SRC_DIR="@0@"'.format(meson.source_root()), language: 'c') +add_project_arguments('-I@0@/include'.format(meson.source_root()), language: 'c') + +#add_project_arguments('-flto', language: 'c') +#add_project_link_arguments('-flto', language: 'c') + +cc = meson.get_compiler('c') + +# Clang complains about some zeroed initialiser lists (= {0}), even though they are valid +if cc.get_id() == 'clang' + add_project_arguments('-Wno-missing-field-initializers', language: 'c') + add_project_arguments('-Wno-missing-braces', language: 'c') +endif + +dep_wayland_server = dependency('wayland-server') +dep_wayland_client = dependency('wayland-client') +dep_wayland_egl = dependency('wayland-egl') +dep_wayland_proto = dependency('wayland-protocols') +dep_egl = dependency('egl') +dep_glesv2 = dependency('glesv2') +dep_drm = dependency('libdrm') +dep_gbm = dependency('gbm') +dep_libinput = dependency('libinput') +dep_xkbcommon = dependency('xkbcommon') +dep_udev = dependency('libudev') +dep_libcap = dependency('libcap', required: false) +dep_systemd = dependency('libsystemd', required: false) +dep_math = cc.find_library('m', required: false) + +all_deps = [ + dep_wayland_server, + dep_wayland_client, + dep_wayland_egl, + dep_wayland_proto, + dep_egl, + dep_glesv2, + dep_drm, + dep_gbm, + dep_libinput, + dep_xkbcommon, + dep_udev, + dep_libcap, + dep_systemd, + dep_math, +] + +wlr_src = [ + 'backend/wayland/backend.c', + 'backend/wayland/registry.c', + 'backend/wayland/wl_seat.c', + 'backend/wayland/output.c', + 'backend/drm/backend.c', + 'backend/drm/drm.c', + 'backend/backend.c', + 'backend/libinput/backend.c', + 'backend/libinput/events.c', + 'backend/libinput/keyboard.c', + 'backend/libinput/pointer.c', + 'backend/libinput/tablet_pad.c', + 'backend/libinput/tablet_tool.c', + 'backend/libinput/touch.c', + 'backend/multi/backend.c', + 'backend/udev.c', + 'backend/egl.c', + 'session/direct-ipc.c', + 'session/direct.c', + 'session/session.c', + 'types/wlr_input_device.c', + 'types/wlr_keyboard.c', + 'types/wlr_pointer.c', + 'types/wlr_tablet_pad.c', + 'types/wlr_tablet_tool.c', + 'types/wlr_touch.c', + 'types/wlr_output.c', + 'render/matrix.c', + 'render/gles2/pixel_format.c', + 'render/gles2/renderer.c', + 'render/gles2/shaders.c', + 'render/gles2/surface.c', + 'render/gles2/util.c', + 'render/wlr_renderer.c', + 'render/wlr_surface.c', + 'util/list.c', + 'util/log.c', +] + +if dep_libcap.found() + add_project_arguments('-DHAS_LIBCAP', language: 'c') +endif + +if dep_systemd.found() + wlr_src = wlr_src + ['session/logind.c'] + add_project_arguments('-DHAS_SYSTEMD', language: 'c') +endif + +lib_wlr = library('wlroots', wlr_src, + dependencies: all_deps) +dep_wlr = declare_dependency(link_with: lib_wlr, + dependencies: all_deps) + +lib_shared = static_library('shared', + ['examples/shared.c', 'examples/cat.c'], + dependencies: dep_wlr) + +all_libs = [ + lib_shared, + lib_wlr, +] + +executable('simple', 'examples/simple.c', link_with: all_libs) +executable('rotation', 'examples/rotation.c', link_with: all_libs) +executable('pointer', 'examples/pointer.c', link_with: all_libs) +executable('touch', 'examples/touch.c', link_with: all_libs) +executable('tablet', 'examples/tablet.c', link_with: all_libs) + +compositor_src = [ + 'examples/compositor/main.c', + 'examples/compositor/wl_compositor.c', + 'examples/compositor/wl_shell.c', +] + +executable('compositor', compositor_src, link_with: all_libs) diff --git a/render/CMakeLists.txt b/render/CMakeLists.txt deleted file mode 100644 index d412ddbc..00000000 --- a/render/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -add_library(wlr-render - matrix.c - wlr_renderer.c - wlr_surface.c - gles2/shaders.c - gles2/renderer.c - gles2/surface.c - gles2/pixel_format.c - gles2/util.c -) diff --git a/session/CMakeLists.txt b/session/CMakeLists.txt deleted file mode 100644 index bacd412f..00000000 --- a/session/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -include_directories( - ${WAYLAND_INCLUDE_DIR} - ${DRM_INCLUDE_DIRS} -) - -set(sources - session.c - direct.c - direct-ipc.c -) - -set(libs - wlr-util - ${WAYLAND_LIBRARIES} -) - -if (SYSTEMD_FOUND) - add_definitions(${SYSTEMD_DEFINITIONS}) - include_directories(${SYSTEMD_INCLUDE_DIRS}) - - add_definitions(-DHAS_SYSTEMD) - list(APPEND sources logind.c) - list(APPEND libs ${SYSTEMD_LIBRARIES}) -endif () - -if (Libcap_FOUND) - add_definitions(${Libcap_DEFINITIONS}) - include_directories(${Libcap_INCLUDE_DIRS}) - - add_definitions(-DHAS_LIBCAP) - list(APPEND libs ${Libcap_LIBRARIES}) -endif () - -add_library(wlr-session ${sources}) -target_link_libraries(wlr-session ${libs}) diff --git a/types/CMakeLists.txt b/types/CMakeLists.txt deleted file mode 100644 index 648db820..00000000 --- a/types/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -include_directories( - ${PROTOCOLS_INCLUDE_DIRS} - ${WAYLAND_INCLUDE_DIR} -) - -add_library(wlr-types - wlr_output.c - wlr_input_device.c - wlr_keyboard.c - wlr_pointer.c - wlr_touch.c - wlr_tablet_tool.c - wlr_tablet_pad.c -) - -target_link_libraries(wlr-types - wlr-util - wlr-render - ${WAYLAND_LIBRARIES} -) diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt deleted file mode 100644 index 5a057889..00000000 --- a/util/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -add_library(wlr-util STATIC - list.c - log.c -) - -target_link_libraries(wlr-util m) From a2ba226ba3f06236518cd15cab807a42c309b6dd Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Tue, 11 Jul 2017 09:56:54 +1200 Subject: [PATCH 2/3] Use subdir --- backend/meson.build | 19 ++++++++++++ examples/meson.build | 22 +++++++++++++ meson.build | 74 ++++++-------------------------------------- render/meson.build | 10 ++++++ session/meson.build | 9 ++++++ types/meson.build | 9 ++++++ util/meson.build | 4 +++ 7 files changed, 82 insertions(+), 65 deletions(-) create mode 100644 backend/meson.build create mode 100644 examples/meson.build create mode 100644 render/meson.build create mode 100644 session/meson.build create mode 100644 types/meson.build create mode 100644 util/meson.build diff --git a/backend/meson.build b/backend/meson.build new file mode 100644 index 00000000..02b79e65 --- /dev/null +++ b/backend/meson.build @@ -0,0 +1,19 @@ +wlr_files += files( + 'backend.c', + 'egl.c', + 'udev.c', + 'drm/backend.c', + 'drm/drm.c', + 'libinput/backend.c', + 'libinput/events.c', + 'libinput/keyboard.c', + 'libinput/pointer.c', + 'libinput/tablet_pad.c', + 'libinput/tablet_tool.c', + 'libinput/touch.c', + 'multi/backend.c', + 'wayland/backend.c', + 'wayland/output.c', + 'wayland/registry.c', + 'wayland/wl_seat.c', +) diff --git a/examples/meson.build b/examples/meson.build new file mode 100644 index 00000000..4cc05073 --- /dev/null +++ b/examples/meson.build @@ -0,0 +1,22 @@ +lib_shared = static_library('shared', + ['shared.c', 'cat.c'], + dependencies: dep_wlr) + +all_libs = [ + lib_shared, + lib_wlr, +] + +executable('simple', 'simple.c', link_with: all_libs) +executable('rotation', 'rotation.c', link_with: all_libs) +executable('pointer', 'pointer.c', link_with: all_libs) +executable('touch', 'touch.c', link_with: all_libs) +executable('tablet', 'tablet.c', link_with: all_libs) + +compositor_src = [ + 'compositor/main.c', + 'compositor/wl_compositor.c', + 'compositor/wl_shell.c', +] + +executable('compositor', compositor_src, link_with: all_libs) diff --git a/meson.build b/meson.build index 561128f1..547e5372 100644 --- a/meson.build +++ b/meson.build @@ -49,79 +49,23 @@ all_deps = [ dep_math, ] -wlr_src = [ - 'backend/wayland/backend.c', - 'backend/wayland/registry.c', - 'backend/wayland/wl_seat.c', - 'backend/wayland/output.c', - 'backend/drm/backend.c', - 'backend/drm/drm.c', - 'backend/backend.c', - 'backend/libinput/backend.c', - 'backend/libinput/events.c', - 'backend/libinput/keyboard.c', - 'backend/libinput/pointer.c', - 'backend/libinput/tablet_pad.c', - 'backend/libinput/tablet_tool.c', - 'backend/libinput/touch.c', - 'backend/multi/backend.c', - 'backend/udev.c', - 'backend/egl.c', - 'session/direct-ipc.c', - 'session/direct.c', - 'session/session.c', - 'types/wlr_input_device.c', - 'types/wlr_keyboard.c', - 'types/wlr_pointer.c', - 'types/wlr_tablet_pad.c', - 'types/wlr_tablet_tool.c', - 'types/wlr_touch.c', - 'types/wlr_output.c', - 'render/matrix.c', - 'render/gles2/pixel_format.c', - 'render/gles2/renderer.c', - 'render/gles2/shaders.c', - 'render/gles2/surface.c', - 'render/gles2/util.c', - 'render/wlr_renderer.c', - 'render/wlr_surface.c', - 'util/list.c', - 'util/log.c', -] - if dep_libcap.found() add_project_arguments('-DHAS_LIBCAP', language: 'c') endif if dep_systemd.found() - wlr_src = wlr_src + ['session/logind.c'] add_project_arguments('-DHAS_SYSTEMD', language: 'c') endif -lib_wlr = library('wlroots', wlr_src, - dependencies: all_deps) -dep_wlr = declare_dependency(link_with: lib_wlr, - dependencies: all_deps) - -lib_shared = static_library('shared', - ['examples/shared.c', 'examples/cat.c'], - dependencies: dep_wlr) +wlr_files = [] -all_libs = [ - lib_shared, - lib_wlr, -] - -executable('simple', 'examples/simple.c', link_with: all_libs) -executable('rotation', 'examples/rotation.c', link_with: all_libs) -executable('pointer', 'examples/pointer.c', link_with: all_libs) -executable('touch', 'examples/touch.c', link_with: all_libs) -executable('tablet', 'examples/tablet.c', link_with: all_libs) +subdir('backend') +subdir('render') +subdir('session') +subdir('types') +subdir('util') -compositor_src = [ - 'examples/compositor/main.c', - 'examples/compositor/wl_compositor.c', - 'examples/compositor/wl_shell.c', -] +lib_wlr = library('wlroots', wlr_files, dependencies: all_deps) +dep_wlr = declare_dependency(link_with: lib_wlr, dependencies: all_deps) -executable('compositor', compositor_src, link_with: all_libs) +subdir('examples') diff --git a/render/meson.build b/render/meson.build new file mode 100644 index 00000000..2fdba62c --- /dev/null +++ b/render/meson.build @@ -0,0 +1,10 @@ +wlr_files += files( + 'matrix.c', + 'wlr_renderer.c', + 'wlr_surface.c', + 'gles2/pixel_format.c', + 'gles2/renderer.c', + 'gles2/shaders.c', + 'gles2/surface.c', + 'gles2/util.c', +) diff --git a/session/meson.build b/session/meson.build new file mode 100644 index 00000000..4521cff6 --- /dev/null +++ b/session/meson.build @@ -0,0 +1,9 @@ +wlr_files += files( + 'direct-ipc.c', + 'direct.c', + 'session.c', +) + +if dep_systemd.found() + wlr_files += files('logind.c') +endif diff --git a/types/meson.build b/types/meson.build new file mode 100644 index 00000000..323806c6 --- /dev/null +++ b/types/meson.build @@ -0,0 +1,9 @@ +wlr_files += files( + 'wlr_input_device.c', + 'wlr_keyboard.c', + 'wlr_output.c', + 'wlr_pointer.c', + 'wlr_tablet_pad.c', + 'wlr_tablet_tool.c', + 'wlr_touch.c', +) diff --git a/util/meson.build b/util/meson.build new file mode 100644 index 00000000..7b80c23f --- /dev/null +++ b/util/meson.build @@ -0,0 +1,4 @@ +wlr_files += files( + 'list.c', + 'log.c', +) From e54b1eded4fc44e6f3d22af2f16d5e055dfd0045 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Tue, 11 Jul 2017 12:24:43 +1200 Subject: [PATCH 3/3] Small linking fix --- examples/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/meson.build b/examples/meson.build index 4cc05073..152453ae 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -1,5 +1,6 @@ lib_shared = static_library('shared', ['shared.c', 'cat.c'], + link_with: lib_wlr, dependencies: dep_wlr) all_libs = [