diff options
author | Ching Pei Yang <[email protected]> | 2023-04-26 23:59:16 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2023-04-27 00:59:16 +0300 |
commit | 38bdbdb0f5356c07f077f238c4e27703e3ff4c1b (patch) | |
tree | 47a29c819d327230df1a3aae91529c0c255ca156 /CMakeLists.txt | |
parent | 622132290f60a3ecc1374d1e06eb8d3ddc96af89 (diff) | |
download | Hyprland-38bdbdb0f5356c07f077f238c4e27703e3ff4c1b.tar.gz Hyprland-38bdbdb0f5356c07f077f238c4e27703e3ff4c1b.zip |
Plugin header overhaul (#2087)
* meson: install headers
* Meson/CMake: add pkg-config file for headers
* makefile: install headers and pkgconfig
* CMake: move protocols to cmake
Co-authored-by: Ching Pei Yang <[email protected]>
---------
Co-authored-by: Mihai Fufezan <[email protected]>
Co-authored-by: vaxerski <[email protected]>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 58 |
1 files changed, 50 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 71a1437b..edaa1d78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,10 @@ project(Hyprland VERSION ${VER} ) +set(HYPRLAND_VERSION ${VER}) +set(PREFIX ${CMAKE_INSTALL_PREFIX}) +configure_file(hyprland.pc.in hyprland.pc @ONLY) + set(CMAKE_MESSAGE_LOG_LEVEL "STATUS") message(STATUS "Gathering git info") @@ -42,6 +46,15 @@ execute_process( # # +find_program(WaylandScanner NAMES wayland-scanner) +message(STATUS "Found WaylandScanner at ${WaylandScanner}") +execute_process( + COMMAND pkg-config --variable=pkgdatadir wayland-protocols + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE WAYLAND_PROTOCOLS_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE) +message(STATUS "Found wayland-protocols at ${WAYLAND_PROTOCOLS_DIR}") + if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG) message(STATUS "Configuring Hyprland in Debug with CMake") add_compile_definitions(HYPRLAND_DEBUG) @@ -54,7 +67,8 @@ include_directories( . "subprojects/wlroots/include/" "subprojects/wlroots/build/include/" - "subprojects/udis86/") + "subprojects/udis86/" + "protocols/") set(CMAKE_CXX_STANDARD 23) add_compile_definitions(WLR_USE_UNSTABLE) add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-narrowing -Wno-pointer-arith) @@ -130,6 +144,26 @@ include(CPack) message(STATUS "Setting link libraries") +function(protocol protoPath protoName external) + if (external) + execute_process( + COMMAND ${WaylandScanner} server-header ${protoPath} protocols/${protoName}-protocol.h + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + execute_process( + COMMAND ${WaylandScanner} private-code ${protoPath} protocols/${protoName}-protocol.c + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + target_sources(Hyprland PRIVATE protocols/${protoName}-protocol.c) + else() + execute_process( + COMMAND ${WaylandScanner} server-header ${WAYLAND_PROTOCOLS_DIR}/${protoPath} protocols/${protoName}-protocol.h + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + execute_process( + COMMAND ${WaylandScanner} private-code ${WAYLAND_PROTOCOLS_DIR}/${protoPath} protocols/${protoName}-protocol.c + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + target_sources(Hyprland PRIVATE protocols/${protoName}-protocol.c) + endif() +endfunction() + target_link_libraries(Hyprland PkgConfig::deps) target_link_libraries(Hyprland @@ -139,12 +173,20 @@ target_link_libraries(Hyprland GLESv2 pthread ${CMAKE_THREAD_LIBS_INIT} - ${CMAKE_SOURCE_DIR}/ext-workspace-unstable-v1-protocol.o - ${CMAKE_SOURCE_DIR}/wlr-foreign-toplevel-management-unstable-v1-protocol.o - ${CMAKE_SOURCE_DIR}/hyprland-toplevel-export-v1-protocol.o - ${CMAKE_SOURCE_DIR}/hyprland-global-shortcuts-v1-protocol.o - ${CMAKE_SOURCE_DIR}/fractional-scale-v1-protocol.o - ${CMAKE_SOURCE_DIR}/text-input-unstable-v1-protocol.o - ${CMAKE_SOURCE_DIR}/wlr-screencopy-unstable-v1-protocol.o ${CMAKE_SOURCE_DIR}/subprojects/udis86/build/libudis86/liblibudis86.a ) + +protocol("protocols/ext-workspace-unstable-v1.xml" "ext-workspace-unstable-v1" true) +protocol("protocols/idle.xml" "idle" true) +protocol("protocols/pointer-constraints-unstable-v1.xml" "pointer-constraints-unstable-v1" true) +protocol("protocols/tablet-unstable-v2.xml" "tablet-unstable-v2" true) +protocol("protocols/wlr-foreign-toplevel-management-unstable-v1.xml" "wlr-foreign-toplevel-management-unstable-v1" true) +protocol("protocols/wlr-layer-shell-unstable-v1.xml" "wlr-layer-shell-unstable-v1" true) +protocol("protocols/wlr-output-power-management-unstable-v1.xml" "wlr-output-power-management-unstable-v1" true) +protocol("protocols/wlr-screencopy-unstable-v1.xml" "wlr-screencopy-unstable-v1" true) +protocol("subprojects/hyprland-protocols/protocols/hyprland-global-shortcuts-v1.xml" "hyprland-global-shortcuts-v1" true) +protocol("subprojects/hyprland-protocols/protocols/hyprland-toplevel-export-v1.xml" "hyprland-toplevel-export-v1" true) +protocol("stable/xdg-shell/xdg-shell.xml" "xdg-shell" false) +protocol("unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml" "linux-dmabuf-unstable-v1" false) +protocol("staging/fractional-scale/fractional-scale-v1.xml" "fractional-scale-v1" false) +protocol("unstable/text-input/text-input-unstable-v1.xml" "text-input-unstable-v1" false) |