From a1b5792ea0496c4d7162c261a7fb87494744a27f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Zag=C3=B3rowski?= Date: Thu, 27 Apr 2023 16:52:00 +0200 Subject: [PATCH] Fix builds, support NO_XWAYLAND --- Makefile | 21 +++++++++++++++++---- src/main.cpp | 10 ++++------ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 0067529..fd6e784 100644 --- a/Makefile +++ b/Makefile @@ -10,10 +10,22 @@ COMPILE_FLAGS=-g -fPIC --no-gnu-unique -std=c++23 COMPILE_FLAGS+=-I "/usr/include/pixman-1" COMPILE_FLAGS+=-I "/usr/include/libdrm" COMPILE_FLAGS+=-I "${HYPRLAND_HEADERS}" +COMPILE_FLAGS+=-I "${HYPRLAND_HEADERS}/protocols" COMPILE_FLAGS+=-I "${HYPRLAND_HEADERS}/subprojects/wlroots/include" COMPILE_FLAGS+=-I "${HYPRLAND_HEADERS}/subprojects/wlroots/build/include" COMPILE_FLAGS+=-Iinclude +COMPILE_DEFINES=-DWLR_USE_UNSTABLE + +ifeq ($(shell whereis -b jq), "jq:") +$(error "jq not found. Please install jq.") +else +BUILT_WITH_NOXWAYLAND=$(shell hyprctl version -j | jq -r '.flags | .[]' | grep 'no xwayland') +ifneq ($(BUILT_WITH_NOXWAYLAND),) +COMPILE_DEFINES+=-DNO_XWAYLAND +endif +endif + .PHONY: clean clangd all: check_env $(PLUGIN_NAME).so @@ -22,12 +34,13 @@ install: all cp $(PLUGIN_NAME).so ${HOME}/.local/share/hyprload/plugins/bin check_env: -ifndef HYPRLAND_HEADERS - $(error HYPRLAND_HEADERS is undefined! Please set it to the path to the root of the configured Hyprland repo) -endif + @if [ -z "${HYPRLAND_HEADERS}" ]; then \ + echo "HYPRLAND_HEADERS not set. Please set it to the root of the hl repo directory."; \ + exit 1; \ + fi $(PLUGIN_NAME).so: $(SOURCE_FILES) $(INCLUDE_FILES) - g++ -shared $(COMPILE_FLAGS) $(SOURCE_FILES) -o $(PLUGIN_NAME).so + g++ -shared $(COMPILE_FLAGS) $(COMPILE_DEFINES) $(SOURCE_FILES) -o $(PLUGIN_NAME).so clean: rm -f ./$(PLUGIN_NAME).so diff --git a/src/main.cpp b/src/main.cpp index b39eae2..2a49660 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,13 +1,11 @@ -#define WLR_USE_UNSTABLE -#include "src/helpers/Color.hpp" -#include "src/managers/KeybindManager.hpp" - -#include "globals.hpp" - +#include +#include #include #include #include +#include "globals.hpp" + #include #include #include