Fix builds, support NO_XWAYLAND

This commit is contained in:
Stanisław Zagórowski 2023-04-27 16:52:00 +02:00
parent d48b001b2e
commit a1b5792ea0
2 changed files with 21 additions and 10 deletions

View file

@ -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

View file

@ -1,13 +1,11 @@
#define WLR_USE_UNSTABLE
#include "src/helpers/Color.hpp"
#include "src/managers/KeybindManager.hpp"
#include "globals.hpp"
#include <src/helpers/Color.hpp>
#include <src/managers/KeybindManager.hpp>
#include <src/Compositor.hpp>
#include <src/config/ConfigManager.hpp>
#include <src/helpers/Workspace.hpp>
#include "globals.hpp"
#include <algorithm>
#include <map>
#include <thread>