-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (42 loc) · 1.4 KB
/
Makefile
File metadata and controls
53 lines (42 loc) · 1.4 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
44
45
46
47
48
49
50
51
52
53
.PHONY: build clean test lint check-format fullcheck
CLANG_TIDY ?= clang-tidy
CLANG_TIDY_EXTRAS :=
CLANG_TIDY_HEADER_FILTER ?= $(CURDIR)/(src)/.*
CLANG_FORMAT ?= clang-format
__TESTS_DIR := tests
__TESTS_BUILD_DIR := $(__TESTS_DIR)/build
__UNAME_S := $(shell uname -s)
ifeq ($(__UNAME_S),Darwin)
# Add path to SDK on MacOS
__XCRUN := $(shell command -v xcrun 2>/dev/null)
ifneq ($(__XCRUN),)
__SDK := $(shell xcrun --show-sdk-path 2>/dev/null)
ifneq ($(__SDK),)
CLANG_TIDY_EXTRAS += --extra-arg=-isysroot$(__SDK)
endif
endif
endif
build:
cmake -S ${__TESTS_DIR} -B ${__TESTS_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug
cmake --build ${__TESTS_BUILD_DIR} -j
clean:
rm -rf ${__TESTS_BUILD_DIR}
test: build
ctest --test-dir ${__TESTS_BUILD_DIR} --output-on-failure -V
lint: build
find . \
\( -type d \( -name build -o -name ".cache" -o -name ".git" \) -prune \) \
-o \
\( -type d -name platform -prune \) \
-o \
-type f \( -name "*.c" -o -name "*.cpp" \) \
-print0 \
| xargs -0 ${CLANG_TIDY} ${CLANG_TIDY_EXTRAS} --header-filter='$(CLANG_TIDY_HEADER_FILTER)' -p ${__TESTS_BUILD_DIR}
check-format:
find . \
\( -type d \( -name build -o -name ".cache" -o -name ".git" \) -prune \) \
-o \
-type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) \
-print0 \
| xargs -0 ${CLANG_FORMAT} --dry-run --Werror
fullcheck: test lint check-format