-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (31 loc) · 1.17 KB
/
Makefile
File metadata and controls
43 lines (31 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Convenience Makefile that wraps CMake (authoritative build system)
BUILD_DIR ?= build
CONFIG ?= Release
PARALLEL ?= 8
TEST_PARALLEL ?= 1
PROJECT_ROOT := $(CURDIR)
FORMAT_SCRIPT := scripts/clang_format.cmake
CPPLINT_SCRIPT := scripts/run_cpplint.cmake
.PHONY: all build clean format lint test dist
all: build
build:
cmake -S . -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=$(CONFIG)
cmake --build $(BUILD_DIR) --config $(CONFIG) -j $(PARALLEL)
test: build
ctest --test-dir $(BUILD_DIR) --output-on-failure -j $(TEST_PARALLEL) -C $(CONFIG) -R autogitpull_tests
.PHONY: test-all
test-all: build
ctest --test-dir $(BUILD_DIR) --output-on-failure -j $(TEST_PARALLEL) -C $(CONFIG)
format:
@cmake -DPROJECT_ROOT="$(PROJECT_ROOT)" -DACTION=fix -P $(FORMAT_SCRIPT)
lint:
@cmake -DPROJECT_ROOT="$(PROJECT_ROOT)" -DACTION=check -P $(FORMAT_SCRIPT)
@cmake -DPROJECT_ROOT="$(PROJECT_ROOT)" -P $(CPPLINT_SCRIPT)
.PHONY: format-commit
format-commit: format
@echo "Staging changes..."
@git add -A
@echo "Creating commit (allows empty to trigger CI if no changes)..."
@git commit --allow-empty -m "chore(format): apply clang-format (or no-op)"
clean:
cmake -E rm -rf $(BUILD_DIR)