chore: parallelize build

This commit is contained in:
Familex 2025-07-19 02:05:14 +03:00
commit f2a35be02b
Failed to generate hash of commit
2 changed files with 16 additions and 6 deletions

View file

@ -1,18 +1,27 @@
PLUGIN_NAME=dynamic-cursors PLUGIN_NAME=dynamic-cursors
SOURCE_FILES=$(wildcard ./src/*.cpp ./src/*/*.cpp) SOURCE_FILES := $(wildcard ./src/*.cpp ./src/*/*.cpp)
OBJECT_FILES := $(patsubst ./src/%.cpp, out/%.o, $(SOURCE_FILES))
CXX_FLAGS := -Wall --no-gnu-unique -fPIC -std=c++26 -g \
$(shell pkg-config --cflags hyprland | awk '{print $$NF "/src";}') \
$(shell pkg-config --cflags pixman-1 libdrm hyprland)
OUTPUT=out/$(PLUGIN_NAME).so OUTPUT=out/$(PLUGIN_NAME).so
.PHONY: all clean load unload .PHONY: all clean load unload
all: $(OUTPUT) all: $(OUTPUT)
$(OUTPUT): $(SOURCE_FILES) $(OUTPUT): $(OBJECT_FILES)
mkdir -p out $(CXX) -shared $^ -o $@
$(CXX) -shared -Wall --no-gnu-unique -fPIC $(SOURCE_FILES) -g `pkg-config --cflags hyprland | awk '{print $$NF "/src";}'` `pkg-config --cflags pixman-1 libdrm hyprland` -std=c++26 -o $(OUTPUT)
# Compile step (object file per .cpp)
out/%.o: ./src/%.cpp
@mkdir -p $(dir $@)
$(CXX) $(CXX_FLAGS) -c $< -o $@
clean: clean:
rm -f $(OUTPUT) $(RM) $(OUTPUT) $(OBJECT_FILES)
load: all unload load: all unload
hyprctl plugin load ${PWD}/$(OUTPUT) hyprctl plugin load ${PWD}/$(OUTPUT)

View file

@ -30,6 +30,7 @@
inherit (hyprland) buildInputs; inherit (hyprland) buildInputs;
nativeBuildInputs = hyprland.nativeBuildInputs ++ [hyprland gcc14]; nativeBuildInputs = hyprland.nativeBuildInputs ++ [hyprland gcc14];
enableParallelBuilding = true;
dontUseCmakeConfigure = true; dontUseCmakeConfigure = true;
dontUseMesonConfigure = true; dontUseMesonConfigure = true;
@ -40,7 +41,7 @@
runHook preInstall runHook preInstall
mkdir -p "$out/lib" mkdir -p "$out/lib"
cp -r out/* "$out/lib/lib${name}.so" cp -r out/dynamic-cursors.so "$out/lib/lib${name}.so"
runHook postInstall runHook postInstall
''; '';