forked from gfx-rs/gfx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
93 lines (78 loc) · 2.77 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
RUST_BACKTRACE:=1
EXCLUDES:=
FEATURES_HAL:=
FEATURES_HAL2:=
FEATURES_HAL3:=
ifeq (,$(TARGET))
CHECK_TARGET_FLAG=
else
CHECK_TARGET_FLAG=--target $(TARGET)
endif
ifeq ($(OS),Windows_NT)
EXCLUDES+= --exclude gfx-backend-metal
FEATURES_HAL=vulkan
ifeq ($(TARGET),x86_64-pc-windows-gnu)
# No d3d12 support on GNU windows ATM
# context: https://github.com/gfx-rs/gfx/pull/1417
EXCLUDES+= --exclude gfx-backend-dx12
EXCLUDES+= --exclude gfx-backend-dx11
else
FEATURES_HAL2=dx12
endif
FEATURES_HAL3=wgl
else
UNAME_S:=$(shell uname -s)
EXCLUDES+= --exclude gfx-backend-dx12
EXCLUDES+= --exclude gfx-backend-dx11
ifeq ($(UNAME_S),Linux)
EXCLUDES+= --exclude gfx-backend-metal
FEATURES_HAL=vulkan
endif
ifeq ($(TARGET),aarch64-apple-ios)
EXCLUDES+= --exclude gfx-backend-vulkan
endif
ifeq ($(UNAME_S),Darwin)
FEATURES_HAL=metal
endif
endif
.PHONY: all check quad quad-wasm test doc reftests benches shader-binaries
all: check test
help:
@echo "Supported backends: gl $(FEATURES_HAL) $(FEATURES_HAL2)"
check:
@echo "Note: excluding \`warden\` here, since it depends on serialization"
cargo check --all $(CHECK_TARGET_FLAG) $(EXCLUDES) --exclude gfx-warden
cd examples && cargo check $(CHECK_TARGET_FLAG) --features "gl"
cd examples && cargo check $(CHECK_TARGET_FLAG) --features "$(FEATURES_HAL)"
cd examples && cargo check $(CHECK_TARGET_FLAG) --features "$(FEATURES_HAL2)"
cd examples && cargo check $(CHECK_TARGET_FLAG) --features "$(FEATURES_HAL3)"
cd src/warden && cargo check $(CHECK_TARGET_FLAG) --no-default-features
cd src/warden && cargo check $(CHECK_TARGET_FLAG) --features "env_logger gl gl-headless $(FEATURES_HAL) $(FEATURES_HAL2)"
test:
cargo test --all $(EXCLUDES)
doc:
cargo doc --all $(EXCLUDES)
reftests:
cd src/warden && cargo run --bin reftest --features "$(FEATURES_HAL) $(FEATURES_HAL2)" -- local #TODO: gl
benches:
cd src/warden && cargo run --release --bin bench --features "$(FEATURES_HAL) $(FEATURES_HAL2)" -- blit
reftests-ci:
cd src/warden && cargo test --features "gl"
cd src/warden && cargo run --features "gl" -- ci #TODO: "gl-headless"
quad:
cd examples && cargo run --bin quad --features ${FEATURES_HAL}
quad-wasm:
cd examples && cargo +nightly build --target wasm32-unknown-unknown --features gl --bin quad && wasm-bindgen ../target/wasm32-unknown-unknown/debug/quad.wasm --out-dir ../examples/generated-wasm --web
shader-binaries:
ifeq ($(UNAME_S),Darwin)
# MacOS
cd ./src/backend/metal/shaders && \
xcrun -sdk macosx metal -c *.metal -mmacosx-version-min=10.11 && \
xcrun -sdk macosx metallib *.air -o gfx-shaders-macos.metallib && \
rm *.air
# iOS
cd ./src/backend/metal/shaders && \
xcrun -sdk iphoneos metal -c *.metal -mios-version-min=11.4 && \
xcrun -sdk iphoneos metallib *.air -o gfx-shaders-ios.metallib && \
rm *.air
endif