feynman/src/CMakeLists.txt

75 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_library(feynman SHARED
feynman.c
queue.c
compositor.c
utils.c
xdg-shell-protocol.c
)
set_target_properties(feynman PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
# 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 PROPERTIES CXX_CLANG_TIDY ${CLANG_TIDY_PATH})
endif()
# Generate the export.h
include(GenerateExportHeader)
generate_export_header(feynman EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/src/export.h)
find_package(PkgConfig REQUIRED)
pkg_check_modules(WLROOTS REQUIRED IMPORTED_TARGET wlroots)
target_link_libraries(feynman PUBLIC
PkgConfig::WLROOTS)
# 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 PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_sources(feynman PRIVATE xdg-shell-protocol.c)
find_package(Threads REQUIRED)
target_link_libraries(feynman PRIVATE Threads::Threads)
include_directories(SYSTEM ${WLROOTS_INCLUDE_DIRS})