Author | Jakob Wakeling <[email protected]> |
Date | 2023-12-26 12:07:47 |
Commit | 0811e1a731716c55924617b0c51c6aafae8e472c |
Add base project files
Diffstat
A | .gitignore | | | 6 | ++++++ |
A | .vscode/launch.json | | | 14 | ++++++++++++++ |
A | CMakeLists.txt | | | 11 | +++++++++++ |
A | Makefile | | | 13 | +++++++++++++ |
4 files changed, 44 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e4561ba --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/.cache/ +/.vscode/* +/bin/ +/build/ + +!/.vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..857b5b6 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug", + "type": "cppdbg", + "request": "launch", + "program": "${command:cmake.launchTargetPath}", + "cwd": "${workspaceFolder}/bin", + "args": [], + "MIMode": "gdb", + } + ] +} diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..2e06757 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.21 FATAL_ERROR) +project(ESH VERSION 0.0.0 LANGUAGES C) + +set(CMAKE_C_STANDARD 23) +set(CMAKE_C_STANDARD_REQUIRED TRUE) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin) + +file(GLOB_RECURSE SRC CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/src/*.c) +add_compile_definitions(PROJECT_VERSION="${PROJECT_VERSION}") + +add_executable(esh ${SRC}) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e994e06 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +.PHONY: all build test help +all: help + +build: ## Build the project + @cmake -S . -B ./build -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=1 + @cmake --build ./build + +test: build ## Run unit tests + @(cd ./build && ctest) + +help: ## Display help information + @grep -E '^[a-zA-Z_-]+:.*?##.*$$' $(MAKEFILE_LIST) | \ + awk 'BEGIN {FS = ":.*?## *"}; {printf "\033[36m%-6s\033[0m %s\n", $$1, $$2}'