feat: scaffold C++ template with tooling helpers

This commit is contained in:
2025-09-23 13:34:55 +08:00
parent 3e9993775d
commit 237e7c3138
9 changed files with 197 additions and 0 deletions

29
Makefile Normal file
View File

@@ -0,0 +1,29 @@
CXX := g++
CXXFLAGS := -std=c++20 -Wall -Wextra -Wpedantic -O2
LDFLAGS :=
SRC_DIR := src
BUILD_DIR := build
TARGET := app
SRCS := $(wildcard $(SRC_DIR)/*.cpp)
OBJS := $(patsubst $(SRC_DIR)/%.cpp,$(BUILD_DIR)/%.o,$(SRCS))
$(TARGET): $(OBJS)
$(CXX) $(OBJS) $(LDFLAGS) -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp | $(BUILD_DIR)
$(CXX) $(CXXFLAGS) -c $< -o $@
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
.PHONY: clean run format
run: $(TARGET)
./$(TARGET)
clean:
rm -rf $(BUILD_DIR) $(TARGET)
format:
clang-format -i $(SRCS)