Skip to content

Commit

Permalink
makefile package command and travis deploy step
Browse files Browse the repository at this point in the history
  • Loading branch information
Korijn committed Dec 24, 2019
1 parent 6a96389 commit ad797cb
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
.vs
build
ffi/dawn*.h
dist
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,17 @@ script:
make example-compute example-triangle VERBOSE=1;
fi
- if [[ $TRAVIS_RUST_VERSION == "nightly" ]] && [[ $TRAVIS_OS_NAME != "windows" ]]; then make VERBOSE=1; fi
- make package

deploy:
provider: releases
api_key:
secure: TODO
file_glob: true
file: dist/wgpu-*.zip
skip_cleanup: true
overwrite: true
on:
tags: true
condition: $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_BRANCH == $TRAVIS_TAG
skip_cleanup: true
39 changes: 37 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ CREATE_BUILD_DIR:=
WILDCARD_WGPU_NATIVE:=$(wildcard wgpu-native/**/*.rs wgpu-core/**/*.rs)
WILDCARD_WGPU_REMOTE:=$(wildcard wgpu-remote/**/*.rs wgpu-core/**/*.rs)

GIT_TAG=$(shell git describe --abbrev=0 --tags)
GIT_TAG_FULL=$(shell git describe --tags)
OS_NAME=

ifeq (,$(TARGET))
CHECK_TARGET_FLAG=
else
Expand All @@ -26,13 +30,38 @@ else
CREATE_BUILD_DIR=mkdir -p $(BUILD_DIR)
endif

.PHONY: all check test doc clear lib-native lib-remote \
ifeq ($(OS),Windows_NT)
LIB_EXTENSION=dll
OS_NAME=windows
else
UNAME_S:=$(shell uname -s)
ifeq ($(UNAME_S),Linux)
LIB_EXTENSION=so
OS_NAME=linux
endif
ifeq ($(UNAME_S),Darwin)
LIB_EXTENSION=dylib
OS_NAME=macos
endif
endif


.PHONY: all check test doc clear \
example-compute example-triangle example-remote \
run-example-compute run-example-triangle run-example-remote
run-example-compute run-example-triangle run-example-remote \
lib-native lib-native-release \
lib-remote lib-remote-release

#TODO: example-remote
all: example-compute example-triangle lib-remote

package: lib-native lib-native-release lib-remote lib-remote-release
mkdir -p dist
echo "$(GIT_TAG_FULL)" > dist/commit-sha
for RELEASE in debug release; do \
zip -j dist/wgpu-$$RELEASE-$(OS_NAME)-$(GIT_TAG).zip target/$$RELEASE/libwgpu_*.$(LIB_EXTENSION) dist/commit-sha; \
done

check:
cargo check --all

Expand All @@ -49,9 +78,15 @@ clear:
lib-native: Cargo.lock wgpu-native/Cargo.toml $(WILDCARD_WGPU_NATIVE)
cargo build --manifest-path wgpu-native/Cargo.toml

lib-native-release: Cargo.lock wgpu-native/Cargo.toml $(WILDCARD_WGPU_NATIVE)
cargo build --manifest-path wgpu-native/Cargo.toml --release

lib-remote: Cargo.lock wgpu-remote/Cargo.toml $(WILDCARD_WGPU_REMOTE)
cargo build --manifest-path wgpu-remote/Cargo.toml

lib-remote-release: Cargo.lock wgpu-remote/Cargo.toml $(WILDCARD_WGPU_REMOTE)
cargo build --manifest-path wgpu-remote/Cargo.toml --release

$(FFI_DIR)/wgpu.h: wgpu-native/cbindgen.toml $(WILDCARD_WGPU_NATIVE)
rustup run nightly cbindgen -o $(FFI_DIR)/wgpu.h wgpu-native

Expand Down

0 comments on commit ad797cb

Please sign in to comment.