wgpu/Makefile

67 lines
1.8 KiB
Makefile
Raw Normal View History

2018-10-22 14:46:13 +00:00
RUST_BACKTRACE:=1
EXCLUDES:=
FEATURE_RUST:=
FEATURE_NATIVE:=
ifeq (,$(TARGET))
CHECK_TARGET_FLAG=
else
CHECK_TARGET_FLAG=--target $(TARGET)
endif
ifeq ($(OS),Windows_NT)
ifeq ($(TARGET),x86_64-pc-windows-gnu)
FEATURE_RUST=vulkan
FEATURE_NATIVE=gfx-backend-vulkan
else
FEATURE_RUST=dx12
FEATURE_NATIVE=gfx-backend-dx12
endif
else
UNAME_S:=$(shell uname -s)
ifeq ($(UNAME_S),Linux)
FEATURE_RUST=vulkan
FEATURE_NATIVE=gfx-backend-vulkan
endif
ifeq ($(UNAME_S),Darwin)
FEATURE_RUST=metal
FEATURE_NATIVE=gfx-backend-metal
endif
endif
2019-05-10 15:58:45 +00:00
.PHONY: all check test doc clear lib-native lib-remote examples-native examples-remote
2018-10-22 14:46:13 +00:00
2019-05-10 15:58:45 +00:00
all: examples-native examples-remote
2018-10-22 14:46:13 +00:00
check:
cargo check --all
test:
cargo test --all --features "$(FEATURE_NATIVE) $(FEATURE_RUST)"
doc:
cargo doc --all
clear:
cargo clean
2019-05-10 15:58:45 +00:00
rm wgpu-bindings/wgpu.h wgpu-bindings/wgpu-remote.h
2018-10-22 14:46:13 +00:00
lib-native: Cargo.lock wgpu-native/Cargo.toml $(wildcard wgpu-native/**/*.rs)
2019-02-26 16:18:31 +00:00
cargo build --manifest-path wgpu-native/Cargo.toml --features "local,$(FEATURE_NATIVE)"
2018-10-22 14:46:13 +00:00
lib-remote: Cargo.lock wgpu-remote/Cargo.toml $(wildcard wgpu-native/**/*.rs wgpu-remote/**/*.rs)
cargo build --manifest-path wgpu-remote/Cargo.toml --features $(FEATURE_RUST)
2019-05-14 16:49:10 +00:00
ffi/wgpu.h: wgpu-native/cbindgen.toml $(wildcard wgpu-native/src/**/*.rs)
2019-05-10 18:42:48 +00:00
rustup run nightly cbindgen wgpu-native >ffi/wgpu.h
2019-05-14 16:49:10 +00:00
ffi/wgpu-remote.h: wgpu-remote/cbindgen.toml $(wildcard wgpu-native/src/**/*.rs wgpu-remote/src/**/*.rs)
2019-05-10 18:42:48 +00:00
rustup run nightly cbindgen wgpu-remote >ffi/wgpu-remote.h
2019-05-10 15:58:45 +00:00
examples-native: lib-native ffi/wgpu.h examples/hello_triangle_c/main.c
cd examples/hello_triangle_c && mkdir -p build && cd build && cmake .. && make
2019-05-10 15:58:45 +00:00
examples-remote: lib-remote ffi/wgpu-remote.h examples/hello_remote_c/main.c
cd examples/hello_remote_c && mkdir -p build && cd build && cmake .. && make