use cmake

This commit is contained in:
2026-01-01 13:56:28 +01:00
parent 5ab0f43e8d
commit 09bda47840
5 changed files with 60 additions and 160 deletions

View File

@@ -1,31 +1,21 @@
MAKEFLAGS := "-j $(shell nproc)"
.PHONY: configure build clean nuke install install_service
# compiling with C++26
CXXFLAGS := -std=c++2c -fdiagnostics-color=always -Iinclude -lwebsockets -lz -Wall -Wextra -Wpedantic -Werror
CXXFLAGS += -MMD -MP
CXXFLAGS += -O2 -s
BUILD_DIR ?= build
SOURCES := $(wildcard src/*.cpp) main.cpp
OBJECTS := $(SOURCES:.cpp=.o)
DEPS := $(OBJECTS:.o=.d)
configure:
cmake -S . -B ${BUILD_DIR}
# glowny target, linkuje linuxSmartie, potrzebuje ${OBJECTS}, jest na samej górze wiec jest domyslny
linuxSmartie: $(OBJECTS)
g++ $(CXXFLAGS) -o $@ $^
build:
cmake --build ${BUILD_DIR} -j
# kompiluje obiekty, potrzebuje zrodel cpp
%.o: %.cpp
g++ $(CXXFLAGS) -c $< -o $@
clean:
cmake --build $(BUILD_DIR) --target clean
nuke: clean
rm -rf $(BUILD_DIR)
-include $(DEPS)
.PHONY: clean cleanobj install_service
cleanobj:
rm -f $(OBJECTS) $(DEPS) $(TEST_OBJS)
clean: cleanobj
rm -f linuxSmartie
install:
install ${BUILD}/linuxSmartie ${HOME}/.local/bin
install_service:
mkdir -p ~/.config/systemd/user