aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.clang-format27
-rw-r--r--.clang-tidy18
-rw-r--r--.editorconfig11
-rw-r--r--.gitignore3
-rw-r--r--CMakeLists.txt16
-rw-r--r--contributing.md29
-rw-r--r--lazy.mk32
-rw-r--r--main.cpp3
-rw-r--r--makefile12
-rw-r--r--readme.md4
10 files changed, 155 insertions, 0 deletions
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..5d233eb
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,27 @@
+---
+AccessModifierOffset: -4
+AllowShortIfStatementsOnASingleLine: AllIfsAndElse
+AllowShortLoopsOnASingleLine: true
+BasedOnStyle: LLVM
+BreakBeforeBraces: Attach
+ColumnLimit: 80
+EmptyLineBeforeAccessModifier: Always
+IndentAccessModifiers: false
+IndentCaseLabels: true
+IndentWidth: 4
+Language: Cpp
+Standard: Cpp11
+TabWidth: 4
+UseTab: Always
+PointerAlignment: Middle
+SpaceAfterCStyleCast: true
+AlignConsecutiveAssignments:
+ Enabled: false
+AlignTrailingComments:
+ Kind: Never
+ReflowComments: false
+AlignEscapedNewlines: DontAlign
+BreakBeforeBinaryOperators: All
+...
+
+# vim: ft=yaml
diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 0000000..b242e3f
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1,18 @@
+Checks: '-*,readability-identifier-naming'
+CheckOptions:
+ - { key: readability-identifier-naming.EnumCase, value: lower_case }
+ - { key: readability-identifier-naming.GlobalFunctionCase, value: lower_case }
+ - { key: readability-identifier-naming.ClassCase, value: CamelCase }
+ - { key: readability-identifier-naming.ClassMethodCase, value: lower_case }
+ - { key: readability-identifier-naming.ClassMethodPrefix, value: '' }
+ - { key: readability-identifier-naming.ClassMemberCase, value: lower_case }
+ - { key: readability-identifier-naming.ClassMemberPrefix, value: '' }
+ - { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
+ - { key: readability-identifier-naming.GlobalConstantIgnoredRegexp, value: _.* }
+ - { key: readability-identifier-naming.GlobalVariableCase, value: lower_case }
+ - { key: readability-identifier-naming.GlobalVariableIgnoredRegexp, value: _.* }
+ - { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE }
+ - { key: readability-identifier-naming.MacroDefinitionIgnoredRegexp, value: _.* }
+ - { key: readability-identifier-naming.StructCase, value: lower_case }
+
+# vim: ft=yaml
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..1bd7da9
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,11 @@
+root = true
+
+[*]
+indent_style = tab
+end_of_line = lf
+insert_final_newline = true
+
+[*.{md,yml}]
+indent_style = space
+indent_size = 2
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..69b610c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+build
+.vscode
+.cache
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..b471ea9
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,16 @@
+cmake_minimum_required(VERSION 3.29)
+
+set(CMAKE_C_STANDARD 11)
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
+
+# # enable debug features
+# set(CMAKE_BUILD_TYPE Debug)
+# add_compile_definitions(DEBUG)
+
+project(main C CXX)
+
+add_executable(main
+ main.cpp
+)
+
diff --git a/contributing.md b/contributing.md
new file mode 100644
index 0000000..c018917
--- /dev/null
+++ b/contributing.md
@@ -0,0 +1,29 @@
+# Contributing new code
+
+- Please do the following *before* sending a pull request:
+ - Merge upstream code (if any) back into your own branch
+ - Run formatters/linters
+
+# Git
+
+- TODO: tagging / versions
+- TODO: branch stability / gitflow?
+
+# Code style
+
+- Formatting nitty-gritty is handled by clang-format/clang-tidy
+- ASCII only
+- When using libraries of which the header include order is important, make
+ sure to separate the include statements using a blank line (clang-format may
+ sort include statements, but does not sort across empty lines).
+
+# Documentation
+
+- All documentation is written in U.S. English
+- TODO
+
+# Libraries
+
+- External libraries should be included as Git submodules under the `lib/`
+ subdirectory
+
diff --git a/lazy.mk b/lazy.mk
new file mode 100644
index 0000000..8684332
--- /dev/null
+++ b/lazy.mk
@@ -0,0 +1,32 @@
+# NOTE: CMAKE IS THE PRIMARY BUILD SYSTEM FOR THIS PROJECT. THIS FILE IS
+# PROVIDED PURELY FOR CONVENIENCE, AND SHOULD NOT BECOME AN ESSENTIAL PART OF
+# THE BUILD SYSTEM!
+
+BUILD_DIR ?= build
+TARGET ?= $(BUILD_DIR)/main
+
+# make cmake shut up
+CMFLAGS += --fresh
+CMFLAGS += --log-level WARNING
+CMFLAGS += -Wno-deprecated
+
+.PHONY: FORCE
+
+all: FORCE $(TARGET)
+
+$(BUILD_DIR)/build.ninja: CMakeLists.txt
+ @mkdir -p $(BUILD_DIR)
+ @cmake -B $(BUILD_DIR) -G Ninja $(CMFLAGS)
+
+$(TARGET): $(BUILD_DIR)/build.ninja FORCE
+ @ninja -C $(BUILD_DIR)
+
+clean: FORCE
+ $(RM) -r $(BUILD_DIR)
+
+# Forward any unknown targets to Ninja
+ifneq ($(MAKECMDGOALS),)
+%::
+ @ninja -C $(BUILD_DIR) $@
+endif
+
diff --git a/main.cpp b/main.cpp
new file mode 100644
index 0000000..8e9a184
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,3 @@
+#include <stdio.h>
+
+int main() { printf("Hello World!\n"); }
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..785c186
--- /dev/null
+++ b/makefile
@@ -0,0 +1,12 @@
+all: $(TARGET) # TARGET is defined in lazy.mk (build/main)
+
+.PHONY: FORCE
+
+FMT += $(shell git ls-files '*.h' '*.c' '*.cpp')
+format: FORCE
+ clang-format -i $(FMT)
+# clang tidy doesn't work that well :/
+# clang-tidy --fix-errors $(FMT)
+
+include lazy.mk
+
diff --git a/readme.md b/readme.md
index e69de29..6568bce 100644
--- a/readme.md
+++ b/readme.md
@@ -0,0 +1,4 @@
+# engine
+
+
+