-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
143 lines (106 loc) · 3.28 KB
/
Copy pathMakefile
File metadata and controls
143 lines (106 loc) · 3.28 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
##
## EPITECH PROJECT, 2024
## video-code
## File description:
## Makefile
##
# >>> Variables <<<
BINARY_NAME = video-code
BUILD_DIR = build
DOCKER_IMG_NAME = ubuntu-lts-img
VCPKG_VOLUME = video_code_vcpkg_cache
CMAKE_FLAGS = -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
VCPKG_FLAGS = \
-DCMAKE_TOOLCHAIN_FILE=$$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake \
-DVCPKG_INSTALLED_DIR=$(PWD)/vcpkg_installed \
-DWITH_FFMPEG=ON
DEBUG_FLAG = -DDEBUG=ON
VERBOSE_FLAG = -DVC_VERBOSE=ON
# >>> Rules <<<
.PHONY: all
all: cmake
.PHONY: cmake
cmake:
cmake -B $(BUILD_DIR) -DDEBUG=OFF -DVC_VERBOSE=OFF $(VCPKG_FLAGS) $(CMAKE_FLAGS)
cmake --build $(BUILD_DIR)
@ cp -f $(BUILD_DIR)/$(BINARY_NAME).app/Contents/MacOS/$(BINARY_NAME) .
@ cp -f $(BUILD_DIR)/compile_commands.json .
.PHONY: debug
debug:
cmake -B $(BUILD_DIR) $(DEBUG_FLAG) $(VCPKG_FLAGS) $(CMAKE_FLAGS)
cmake --build $(BUILD_DIR)
@ cp $(BUILD_DIR)/$(BINARY_NAME).app/Contents/MacOS/$(BINARY_NAME) .
@ cp -f $(BUILD_DIR)/compile_commands.json .
.PHONY: verbose
verbose:
cmake -B $(BUILD_DIR) -DDEBUG=OFF $(VERBOSE_FLAG) $(VCPKG_FLAGS) $(CMAKE_FLAGS)
cmake --build $(BUILD_DIR)
@ cp -f $(BUILD_DIR)/$(BINARY_NAME).app/Contents/MacOS/$(BINARY_NAME) .
@ cp -f $(BUILD_DIR)/compile_commands.json .
.PHONY: clean
clean:
@ $(RM) vgcore*
.PHONY: fclean
fclean: clean
@ $(RM) -r $(BUILD_DIR)
@ $(RM) -r vcpkg_installed
@ $(RM) $(BINARY_NAME)
.PHONY: format
format:
clang-format -i **/*.cpp **/*.hpp
# The gates GitHub cannot run: the goldens were rendered on this machine's GPU,
# and a shared runner's timings say nothing about a local baseline. Run it when
# you want the answer — never on the way to a push.
.PHONY: check
check:
@ printf "\n→ visual regression (new failures only)\n"
@ ./video-code --visual-test 2>&1 | tr '\r' '\n' | perl -pe 's/\e\[[0-9;]*m//g' \
| awk '/^\[visual-test\]/ { scene = $$2 } /\[FAIL\]/ { print scene }' | sort -u \
> /tmp/vc_failed.txt || true
@ grep -v '^\#' test/visual/known_failures.txt | grep -v '^[[:space:]]*$$' | sort -u > /tmp/vc_known.txt
@ if comm -23 /tmp/vc_failed.txt /tmp/vc_known.txt | grep -q .; then \
printf "\033[31mgoldens moved that were passing:\033[0m\n"; \
comm -23 /tmp/vc_failed.txt /tmp/vc_known.txt | sed 's/^/ /'; \
printf "Look at the render before regenerating: a golden can be recording a bug.\n"; \
exit 1; \
else \
printf " no new visual regressions\n"; \
fi
@ printf "\n→ performance guard\n"
@ python3 test/perf/guard.py
.PHONY: docs
docs: cmake
docs: docvid
docs: docdoc
.PHONY: docvid
docvid:
./$(BINARY_NAME) --generate
# Visual regression suite — golden-frame + hot-reload equivalence checks.
.PHONY: test
test:
./$(BINARY_NAME) --visual-test
# (Re)write the golden images the suite compares against.
.PHONY: test-golden
test-golden:
./$(BINARY_NAME) --visual-test --update-golden
# Python assertion-based unit tests.
.PHONY: test-unit
test-unit:
./test/run_tests.sh
# Static type-checking for the Python API.
.PHONY: typecheck
typecheck:
python3 -m pyright
# 1. Generate the Readme
# 2. Copies the generated video to example.gif
.PHONY: docdoc
docdoc:
./docs/readme/generate.sh
# Doesn't work
.PHONY: docker
docker:
$(MAKE) fclean
docker build -t $(DOCKER_IMG_NAME) .
docker run --rm -it \
-v "$(PWD):/work" \
$(DOCKER_IMG_NAME)