-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
32 lines (23 loc) · 822 Bytes
/
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
BUILD_TYPE?=Debug
OUTPUT_DIR?=build/$(BUILD_TYPE)
VCPKG?=~/.vcpkg/
ARGS?=
CC:=clang
CXX:=clang++
LD:=mold
.PHONY: all run clean format iwyu
all: $(OUTPUT_DIR)/build.ninja
ninja -C$(OUTPUT_DIR)
run: all
./$(OUTPUT_DIR)/ToyRenderer/ToyRenderer $(ARGS)
build/shaders:
mkdir -p build/shaders
clean:
rm -rf ./$(OUTPUT_DIR)
format:
find ToyRenderer/ -iname '*.h' -o -iname '*.cpp' | xargs clang-format -i
find utils/ -iname '*.h' -o -iname '*.cpp' | xargs clang-format -i
iwyu:
iwyu-tool -p ./compile_commands.json -- -Xiwyu --mapping_file=$(PWD)/iwyu-mapping.yaml
$(OUTPUT_DIR)/build.ninja:
cmake -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX) -B$(OUTPUT_DIR) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -GNinja -DCMAKE_TOOLCHAIN_FILE=$(VCPKG)/scripts/buildsystems/vcpkg.cmake -DCMAKE_CXX_FLAGS="-fuse-ld=$(LD)"