feynman/src/CMakeLists.txt

74 lines
2.3 KiB
CMake

# Feynman -- Wayland compositor for GNU Emacs
#
# Copyright (c) 2022 Sameer Rahmani <lxsameer@gnu.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
add_executable(feynman-wm
main.c
compositor.c)
set_target_properties(feynman-wm PROPERTIES
VERSION ${PROJECT_VERSION}
# Warn on unused libs
LINK_WHAT_YOU_USE TRUE
C_INCLUDE_WHAT_YOU_USE "${iwyu_path}"
# LTO support
INTERPROCEDURAL_OPTIMIZATION TRUE)
if(FEYNMAN_ENABLE_TIDY)
set_target_properties(feynman-wm PROPERTIES C_CLANG_TIDY ${CLANG_TIDY_PATH})
endif()
target_include_directories(feynman-wm PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
find_package(PkgConfig REQUIRED)
pkg_check_modules(WLROOTS REQUIRED IMPORTED_TARGET wlroots)
pkg_check_modules(DEPS REQUIRED IMPORTED_TARGET
wayland-server
wayland-client
wayland-cursor
wayland-protocols
xkbcommon
libinput
xcb)
include_directories(SYSTEM ${WLROOTS_INCLUDE_DIRS})
find_package(Threads REQUIRED)
target_link_libraries(feynman-wm Threads::Threads PkgConfig::WLROOTS PkgConfig::DEPS)
# find Wayland protocols
pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
# find 'wayland-scanner' executable
pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner)
set(XDG_PROT_DEF "${WAYLAND_PROTOCOLS_DIR}/stable/xdg-shell/xdg-shell.xml")
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/xdg-shell-protocol.h
COMMAND ${WAYLAND_SCANNER} client-header ${XDG_PROT_DEF} xdg-shell-protocol.h)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/xdg-shell-protocol.c
COMMAND ${WAYLAND_SCANNER} private-code ${XDG_PROT_DEF} xdg-shell-protocol.c
DEPENDS xdg-shell-protocol.h)
target_include_directories(feynman-wm PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_sources(feynman-wm PRIVATE xdg-shell-protocol.c)
include_directories(SYSTEM ${WLROOTS_INCLUDE_DIRS})