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

9
utils/build.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="${SCRIPT_DIR}/.."
cd "${PROJECT_ROOT}"
make "$@"

9
utils/clean.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="${SCRIPT_DIR}/.."
cd "${PROJECT_ROOT}"
make clean

21
utils/format.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="${SCRIPT_DIR}/.."
SRC_DIR="${PROJECT_ROOT}/src"
if ! command -v clang-format >/dev/null 2>&1; then
echo "error: clang-format is not installed or not in PATH" >&2
exit 1
fi
if [ ! -d "${SRC_DIR}" ]; then
echo "warning: src directory not found; nothing to format" >&2
exit 0
fi
find "${SRC_DIR}" -name '*.cpp' -o -name '*.hpp' -o -name '*.h' | while read -r file; do
clang-format -i "$file"
echo "formatted $file"
done

9
utils/run.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="${SCRIPT_DIR}/.."
cd "${PROJECT_ROOT}"
make "$@" run