2018-10-22 14:46:13 +00:00
|
|
|
RUST_BACKTRACE:=1
|
|
|
|
EXCLUDES:=
|
|
|
|
|
2019-06-05 00:39:58 +00:00
|
|
|
GENERATOR_PLATFORM:=
|
|
|
|
|
2019-05-18 20:12:38 +00:00
|
|
|
FFI_DIR:=ffi
|
|
|
|
BUILD_DIR:=build
|
|
|
|
CLEAN_FFI_DIR:=
|
|
|
|
CREATE_BUILD_DIR:=
|
|
|
|
|
2019-07-28 16:42:17 +00:00
|
|
|
WILDCARD_WGPU_NATIVE:=$(wildcard wgpu-native/**/*.rs)
|
|
|
|
WILDCARD_WGPU_NATIVE_AND_REMOTE:=$(wildcard wgpu-native/**/*.rs wgpu-remote/**/*.rs)
|
|
|
|
|
2018-10-22 14:46:13 +00:00
|
|
|
ifeq (,$(TARGET))
|
|
|
|
CHECK_TARGET_FLAG=
|
|
|
|
else
|
|
|
|
CHECK_TARGET_FLAG=--target $(TARGET)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(OS),Windows_NT)
|
2019-05-18 20:12:38 +00:00
|
|
|
CLEAN_FFI_DIR=del $(FFI_DIR)\*.* /Q /S
|
|
|
|
CREATE_BUILD_DIR=mkdir $(BUILD_DIR)
|
2019-06-05 00:39:58 +00:00
|
|
|
GENERATOR_PLATFORM=-DCMAKE_GENERATOR_PLATFORM=x64
|
2018-10-22 14:46:13 +00:00
|
|
|
else
|
2019-05-18 20:12:38 +00:00
|
|
|
CLEAN_FFI_DIR=rm $(FFI_DIR)/**
|
|
|
|
CREATE_BUILD_DIR=mkdir -p $(BUILD_DIR)
|
2018-10-22 14:46:13 +00:00
|
|
|
endif
|
|
|
|
|
2019-10-25 18:18:18 +00:00
|
|
|
.PHONY: all check test doc clear lib-native lib-remote \
|
|
|
|
example-compute example-triangle example-remote \
|
|
|
|
run-example-compute run-example-triangle run-example-remote
|
2018-10-22 14:46:13 +00:00
|
|
|
|
2019-08-15 07:50:00 +00:00
|
|
|
all: example-compute example-triangle example-remote
|
2018-10-22 14:46:13 +00:00
|
|
|
|
|
|
|
check:
|
|
|
|
cargo check --all
|
|
|
|
|
|
|
|
test:
|
2019-08-25 05:04:14 +00:00
|
|
|
cargo test --all
|
2018-10-22 14:46:13 +00:00
|
|
|
|
|
|
|
doc:
|
|
|
|
cargo doc --all
|
|
|
|
|
|
|
|
clear:
|
2019-01-20 23:46:02 +00:00
|
|
|
cargo clean
|
2019-05-18 20:12:38 +00:00
|
|
|
$(CLEAN_FFI_DIR)
|
2018-10-22 14:46:13 +00:00
|
|
|
|
2019-07-28 16:42:17 +00:00
|
|
|
lib-native: Cargo.lock wgpu-native/Cargo.toml $(WILDCARD_WGPU_NATIVE)
|
2019-10-24 16:07:39 +00:00
|
|
|
cargo build --manifest-path wgpu-native/Cargo.toml --features local
|
2018-10-22 14:46:13 +00:00
|
|
|
|
2019-07-28 16:42:17 +00:00
|
|
|
lib-remote: Cargo.lock wgpu-remote/Cargo.toml $(WILDCARD_WGPU_NATIVE_AND_REMOTE)
|
2019-08-25 05:04:14 +00:00
|
|
|
cargo build --manifest-path wgpu-remote/Cargo.toml
|
2019-04-30 02:41:09 +00:00
|
|
|
|
2019-08-12 20:24:57 +00:00
|
|
|
$(FFI_DIR)/wgpu.h: wgpu-native/cbindgen.toml $(WILDCARD_WGPU_NATIVE)
|
2019-08-16 04:15:51 +00:00
|
|
|
rustup run nightly cbindgen -o $(FFI_DIR)/wgpu.h wgpu-native
|
2019-04-30 16:19:37 +00:00
|
|
|
|
2019-08-12 20:24:57 +00:00
|
|
|
$(FFI_DIR)/wgpu-remote.h: wgpu-remote/cbindgen.toml $(WILDCARD_WGPU_NATIVE_AND_REMOTE)
|
2019-08-16 04:15:51 +00:00
|
|
|
rustup run nightly cbindgen -o $(FFI_DIR)/wgpu-remote.h wgpu-remote
|
2019-04-30 16:19:37 +00:00
|
|
|
|
2019-07-24 19:22:00 +00:00
|
|
|
example-compute: lib-native $(FFI_DIR)/wgpu.h examples/compute/main.c
|
2019-10-25 18:18:18 +00:00
|
|
|
cd examples/compute && $(CREATE_BUILD_DIR) && cd build && cmake -DCMAKE_BUILD_TYPE=Debug .. $(GENERATOR_PLATFORM) && cmake --build .
|
|
|
|
|
|
|
|
run-example-compute: example-compute
|
|
|
|
cd examples/compute/build && ./compute 1 2 3 4
|
2019-04-30 02:41:09 +00:00
|
|
|
|
2019-07-24 19:22:00 +00:00
|
|
|
example-triangle: lib-native $(FFI_DIR)/wgpu.h examples/triangle/main.c
|
2019-10-25 18:18:18 +00:00
|
|
|
cd examples/triangle && $(CREATE_BUILD_DIR) && cd build && cmake -DCMAKE_BUILD_TYPE=Debug .. $(GENERATOR_PLATFORM) && cmake --build .
|
|
|
|
|
|
|
|
run-example-triangle: example-triangle
|
|
|
|
cd examples/triangle/build && ./triangle
|
2019-07-24 19:22:00 +00:00
|
|
|
|
|
|
|
example-remote: lib-remote $(FFI_DIR)/wgpu-remote.h examples/remote/main.c
|
2019-10-25 18:18:18 +00:00
|
|
|
cd examples/remote && $(CREATE_BUILD_DIR) && cd build && cmake -DCMAKE_BUILD_TYPE=Debug .. $(GENERATOR_PLATFORM) && cmake --build .
|
|
|
|
|
|
|
|
run-example-remote: example-remote
|
|
|
|
cd examples/remote/build && ./remote
|