forked from gfx-rs/gfx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
104 lines (87 loc) · 3.19 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
94
95
96
97
98
99
100
101
102
103
104
RUST_BACKTRACE:=1
EXCLUDES:=--exclude gfx-backend-webgpu
FEATURES_GL:=
FEATURES_HAL:=
FEATURES_HAL2:=
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
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 --exclude gfx-backend-gl
else ifeq ($(TARGET),x86_64-apple-ios)
EXCLUDES+= --exclude gfx-backend-vulkan --exclude gfx-backend-gl
else
FEATURES_GL=gl
endif
ifeq ($(UNAME_S),Darwin)
FEATURES_HAL=metal
endif
endif
.PHONY: all check check-backends check-wasm quad quad-wasm test doc reftests benches shader-binaries
all: check test
help:
@echo "Supported backends: $(FEATURES_GL) $(FEATURES_HAL) $(FEATURES_HAL2)"
check: check-backends
cd examples && cargo check $(CHECK_TARGET_FLAG) --features "$(FEATURES_GL)"
cd examples && cargo check $(CHECK_TARGET_FLAG) --features "$(FEATURES_HAL)"
cd examples && cargo check $(CHECK_TARGET_FLAG) --features "$(FEATURES_HAL2)"
cd src/warden && cargo check $(CHECK_TARGET_FLAG) --no-default-features
cd src/warden && cargo check $(CHECK_TARGET_FLAG) --features "env_logger $(FEATURES_GL) $(FEATURES_HAL) $(FEATURES_HAL2)"
check-backends:
cargo check --all $(CHECK_TARGET_FLAG) $(EXCLUDES) --exclude gfx-warden
check-wasm:
cd src/backend/webgpu && RUSTFLAGS="--cfg=web_sys_unstable_apis" cargo check --target wasm32-unknown-unknown
test:
cargo test --all $(EXCLUDES)
doc:
cargo doc --all $(EXCLUDES)
reftests:
cd src/warden && cargo run --bin reftest --features "$(FEATURES_GL) $(FEATURES_HAL) $(FEATURES_HAL2)" -- local
benches:
cd src/warden && cargo run --release --bin bench --features "$(FEATURES_GL) $(FEATURES_HAL) $(FEATURES_HAL2)" -- blit
reftests-ci:
cd src/warden && cargo test
cd src/warden && cargo run --features "gl" -- ci
quad:
cd examples && cargo run --bin quad --features ${FEATURES_HAL}
quad-wasm:
cd examples && cargo +nightly build --features gl --target wasm32-unknown-unknown --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
# iOS Simulator
cd ./src/backend/metal/shaders && \
xcrun -sdk iphonesimulator metal -c *.metal -mios-simulator-version-min=13.0 && \
xcrun -sdk iphonesimulator metallib *.air -o gfx-shaders-ios-simulator.metallib && \
rm *.air
endif