Skip to content

Commit

Permalink
Set up automatic code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurmoreno committed Nov 4, 2024
1 parent 910b9df commit c7b0b0f
Show file tree
Hide file tree
Showing 4 changed files with 849 additions and 559 deletions.
3 changes: 3 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
BasedOnStyle: Google
IndentWidth: 4
ColumnLimit: 100
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ Thumbs.db
# CMake files
CMakeCache.txt
CMakeFiles/
Makefile
cmake_install.cmake
47 changes: 47 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# ==============================
# VARIABLES
# ==============================

# Project name
PROJECT := campo_de_batalha.exe

# Build directory
BUILD_DIR := build

# CMake generator
CMAKE_GENERATOR := "MinGW Makefiles"

# CMake executable
CMAKE := cmake

# Make executable
MAKE_CMD := make

# ==============================
# RULES
# ==============================

.PHONY: all build clean

# Default target
all: build

# Build target
build:
@echo "Starting build process..."
@mkdir $(BUILD_DIR) 2> NUL || echo "Build directory already exists."
@cd $(BUILD_DIR) && $(CMAKE) -G $(CMAKE_GENERATOR) .. && $(MAKE_CMD) --always-make

# Clean target
clean:
@echo "Cleaning project..."
@rmdir /s /q $(BUILD_DIR) 2> NUL || echo "Build directory does not exist."
@if exist $(PROJECT) del /f /q $(PROJECT)

# Format target for Windows
format:
@echo "Formatting source files..."
@for /r %%f in (src\*.cpp src\*.hpp) do clang-format -i "%%f"

# Phony Targets
.PHONY: all build clean format
Loading

0 comments on commit c7b0b0f

Please sign in to comment.