diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..4514b5a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,41 @@ +cmake_minimum_required(VERSION 3.20) + +file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" HYPRLAND_PROTOCOLS_VERSION + LIMIT_COUNT 1) +string(STRIP "${HYPRLAND_PROTOCOLS_VERSION}" HYPRLAND_PROTOCOLS_VERSION) + +project( + hyprland-protocols + VERSION ${HYPRLAND_PROTOCOLS_VERSION} + LANGUAGES NONE) + +include(GNUInstallDirs) + +set(PROTOCOL_FILES + protocols/hyprland-toplevel-export-v1.xml + protocols/hyprland-global-shortcuts-v1.xml + protocols/hyprland-focus-grab-v1.xml + protocols/hyprland-ctm-control-v1.xml + protocols/hyprland-surface-v1.xml + protocols/hyprland-lock-notify-v1.xml + protocols/hyprland-toplevel-mapping-v1.xml + protocols/hyprland-input-capture-v1.xml) + +foreach(PROTOCOL_FILE ${PROTOCOL_FILES}) + get_filename_component(PROTOCOL_DIR ${PROTOCOL_FILE} DIRECTORY) + install( + FILES ${PROTOCOL_FILE} + DESTINATION "${CMAKE_INSTALL_DATADIR}/hyprland-protocols/${PROTOCOL_DIR}") +endforeach() + +# Configure pkg-config file +set(prefix "${CMAKE_INSTALL_PREFIX}") +set(datarootdir "\${prefix}/${CMAKE_INSTALL_DATADIR}") +set(abs_top_srcdir "${CMAKE_CURRENT_SOURCE_DIR}") +set(PACKAGE "hyprland-protocols") + +configure_file(hyprland-protocols.pc.in hyprland-protocols.pc @ONLY) + +# Install pkg-config file +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/hyprland-protocols.pc" + DESTINATION "${CMAKE_INSTALL_DATADIR}/pkgconfig") diff --git a/README.md b/README.md index 1e89038..40ba907 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # hyprland-protocols + Wayland protocol extensions for Hyprland. This repository exists in an effort to bridge the gap between Hyprland and KDE/Gnome's functionality, @@ -10,6 +11,7 @@ a set of protocols Hyprland uses to plumb some things / add some useful features Some of the protocols here also do not belong in w-p, as they are specific to Hyprland. ## Finished protocols + - `hyprland_toplevel_export` -> for exporting toplevel buffers (aka. windows) for screensharing - `hyprland_global_keybindings` -> for managing global keybinds via D-Bus. - `hyprland_focus_grab` -> for grabbing input focus, primarily for complex context menus. @@ -20,14 +22,15 @@ Some of the protocols here also do not belong in w-p, as they are specific to Hy - `hyprland_input_capture` -> for EIS input capture. ## Building + ```sh -git clone https://github.com/hyprwm/hyprland-protocols -cd hyprland-protocols -meson setup build -sudo meson install -C build +git clone https://github.com/hyprwm/hyprland-protocols && cd hyprland-protocols +cmake -S . -B ./build +cmake --build ./build ``` ## Contributing + Adding new protocols is *discouraged*, as most things you think of can already be done one way or another. However, if the protocol has a good reason to be, and you have an impl ready, feel free to make a PR. We're always up for a discussion to improve things! @@ -35,4 +38,3 @@ We're always up for a discussion to improve things! Fixing typos / adding explanations to existing protocols - welcome. Adding functionality to protocols / new revisions - welcome, if accompanied with a reason and an impl. - diff --git a/meson.build b/meson.build deleted file mode 100644 index 3a56eba..0000000 --- a/meson.build +++ /dev/null @@ -1,66 +0,0 @@ -project('hyprland-protocols', - version: run_command('cat', 'VERSION', check: true).stdout().strip(), - meson_version: '>= 0.60.3', -) - -hyprland_protocols_version = meson.project_version() - -fs = import('fs') - -protocols = { - 'hyprland-toplevel-export': ['v1'], - 'hyprland-toplevel-mapping': ['v1'], - 'hyprland-global-shortcuts': ['v1'], - 'hyprland-focus-grab': ['v1'], - 'hyprland-ctm-control': ['v1'], - 'hyprland-surface': ['v1'], - 'hyprland-lock-notify': ['v1'], - 'hyprland-input-capture': ['v1'], -} - -protocol_files = [] - -foreach name : protocols.keys() - foreach version : protocols.get(name) - protocol_files += [ - 'protocols/@0@-@1@.xml'.format(name, version) - ] - endforeach -endforeach - -foreach protocol_file : protocol_files - protocol_install_dir = fs.parent(join_paths( - get_option('datadir'), - 'hyprland-protocols', - protocol_file, - )) - install_data( - protocol_file, - install_dir: protocol_install_dir, - ) -endforeach - -hyprland_protocols_srcdir = meson.current_source_dir() - -pkgconfig_configuration = configuration_data() -pkgconfig_configuration.set('prefix', get_option('prefix')) -pkgconfig_configuration.set('datarootdir', '${prefix}/@0@'.format(get_option('datadir'))) -pkgconfig_configuration.set('abs_top_srcdir', hyprland_protocols_srcdir) -pkgconfig_configuration.set('PACKAGE', 'hyprland-protocols') -pkgconfig_configuration.set('HYPRLAND_PROTOCOLS_VERSION', hyprland_protocols_version) - -pkg_install_dir = join_paths(get_option('datadir'), 'pkgconfig') -configure_file( - input: 'hyprland-protocols.pc.in', - output: 'hyprland-protocols.pc', - configuration: pkgconfig_configuration, - install_dir: pkg_install_dir, -) - -hyprland_protocols = declare_dependency( - variables: { - 'pkgdatadir': hyprland_protocols_srcdir, - }, -) - -meson.override_dependency('hyprland-protocols', hyprland_protocols) diff --git a/nix/default.nix b/nix/default.nix index 62b7ed4..5f526bc 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -1,8 +1,7 @@ { lib, stdenv, - meson, - ninja, + cmake, version, }: stdenv.mkDerivation { @@ -11,7 +10,7 @@ stdenv.mkDerivation { src = ../.; - nativeBuildInputs = [meson ninja]; + nativeBuildInputs = [cmake]; meta = { homepage = "https://github.com/hyprwm/hyprland-protocols";