use pkg-config

This commit is contained in:
Stanisław Zagórowski 2023-05-08 11:55:05 +02:00
parent a1b5792ea0
commit 5d13b75b8d

View file

@ -7,12 +7,7 @@ PLUGIN_NAME=split-monitor-workspaces
SOURCE_FILES=$(wildcard src/*.cpp) SOURCE_FILES=$(wildcard src/*.cpp)
COMPILE_FLAGS=-g -fPIC --no-gnu-unique -std=c++23 COMPILE_FLAGS=-g -fPIC --no-gnu-unique -std=c++23
COMPILE_FLAGS+=-I "/usr/include/pixman-1" COMPILE_FLAGS+=`pkg-config --cflags pixman-1 libdrm hyprland`
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_FLAGS+=-Iinclude
COMPILE_DEFINES=-DWLR_USE_UNSTABLE COMPILE_DEFINES=-DWLR_USE_UNSTABLE
@ -34,10 +29,17 @@ install: all
cp $(PLUGIN_NAME).so ${HOME}/.local/share/hyprload/plugins/bin cp $(PLUGIN_NAME).so ${HOME}/.local/share/hyprload/plugins/bin
check_env: check_env:
@if [ -z "${HYPRLAND_HEADERS}" ]; then \ @if pkg-config --exists hyprland; then \
echo "HYPRLAND_HEADERS not set. Please set it to the root of the hl repo directory."; \ echo 'Hyprland headers found.'; \
else \
echo 'Hyprland headers not available. Run `make pluginenv` in the root Hyprland directory.'; \
exit 1; \ exit 1; \
fi fi
@if [ -z $(BUILT_WITH_NOXWAYLAND) ]; then \
echo 'Building with XWayland support.'; \
else \
echo 'Building without XWayland support.'; \
fi
$(PLUGIN_NAME).so: $(SOURCE_FILES) $(INCLUDE_FILES) $(PLUGIN_NAME).so: $(SOURCE_FILES) $(INCLUDE_FILES)
g++ -shared $(COMPILE_FLAGS) $(COMPILE_DEFINES) $(SOURCE_FILES) -o $(PLUGIN_NAME).so g++ -shared $(COMPILE_FLAGS) $(COMPILE_DEFINES) $(SOURCE_FILES) -o $(PLUGIN_NAME).so
@ -46,4 +48,8 @@ clean:
rm -f ./$(PLUGIN_NAME).so rm -f ./$(PLUGIN_NAME).so
clangd: clangd:
printf "%b" "-I/usr/include/pixman-1\n-I/usr/include/libdrm\n-I${HYPRLAND_HEADERS}\n-Iinclude\n-std=c++2b" > compile_flags.txt echo "$(COMPILE_FLAGS) $(COMPILE_DEFINES)" | \
sed 's/--no-gnu-unique//g' | \
sed 's/ -/\n-/g' | \
sed 's/std=c++23/std=c++2b/g' \
> compile_flags.txt