-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
73 lines (59 loc) · 2.13 KB
/
Makefile
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
GAME ?= all
ARGS ?=
SANITIZER ?=
PROFILE ?= OFF
TRACY_PORT ?= 9000
TRACY_OUTPUT ?= output.tracy
TRACY_CAPTURE_TIME ?= 300
all: build
configure:
cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=Release -DSANITIZER=$(SANITIZER) -DPROFILE=${PROFILE}
build:
cmake --build build --target $(GAME)
build-tracy-gui:
cd build/_deps/tracy-src && cmake -B profiler/build -S profiler -DCMAKE_BUILD_TYPE=Release
cd build/_deps/tracy-src && cmake --build profiler/build --config Release
build-tracy-capture:
cd build/_deps/tracy-src && cmake -B capture/build -S capture -DCMAKE_BUILD_TYPE=Release
cd build/_deps/tracy-src && cmake --build capture/build --config Release
open-tracy-gui:
nohup ./build/_deps/tracy-src/profiler/build/tracy-profiler </dev/null >/dev/null 2>&1 &
clean:
cmake --build build --target clean
play:
@if [ "$(GAME)" = "all" ]; then \
echo "Usage:"; \
echo "make play GAME=<game> ARGS=<game_args> [ TRACY_PORT=<port> ]"; \
echo; \
echo "Where:"; \
echo "<game> is one of:"; \
cat .targetgames; \
echo; \
echo; \
exit 1; \
fi
cd ./build/$(GAME) && TRACY_PORT=$(TRACY_PORT) ./$(GAME) $(ARGS)
play-profile:
@if [ "$(GAME)" = "all" ]; then \
echo "Usage:"; \
echo "make play-profile GAME=<game> ARGS=<game_args> TRACY_PORT=<port> TRACY_OUTPUT=<file>.tracy [ TRACY_CAPTURE_TIME=<seconds> ]"; \
echo; \
echo "Where:"; \
echo "<game> is one of:"; \
cat .targetgames; \
echo; \
echo; \
exit 1; \
fi
mkdir -p traces
cd ./build/$(GAME) && TRACY_PORT=$(TRACY_PORT) ./$(GAME) $(ARGS) &
./build/_deps/tracy-src/capture/build/tracy-capture -o ./traces/$(TRACY_OUTPUT) -p $(TRACY_PORT) -s $(TRACY_CAPTURE_TIME)
format:
find src -name '*.[ch]pp' | xargs -P 8 -n 1 clang-format -i
check-format:
find src -name '*.[ch]pp' | xargs -P 8 -n 1 clang-format --dry-run --Werror
check-tidy:
ln -sf build/compile_commands.json compile_commands.json
find src/engine $(shell cat .targetgames | sed 's/^/src\/games\//') -name '*.[ch]pp' -print | xargs -P 8 -n 1 clang-tidy
rm -rf compile_commands.json
.PHONY: all configure build build-tracy-gui build-tracy-capture open-tracy-gui clean play play-profile format check-format check-tidy