makefile package command and travis deploy step

This commit is contained in:
Korijn van Golen 2019-12-24 14:19:43 +01:00
parent 6a963892b5
commit ad797cbd81
3 changed files with 52 additions and 2 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@
.vs .vs
build build
ffi/dawn*.h ffi/dawn*.h
dist

View File

@ -75,3 +75,17 @@ script:
make example-compute example-triangle VERBOSE=1; make example-compute example-triangle VERBOSE=1;
fi fi
- if [[ $TRAVIS_RUST_VERSION == "nightly" ]] && [[ $TRAVIS_OS_NAME != "windows" ]]; then make 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

View File

@ -11,6 +11,10 @@ CREATE_BUILD_DIR:=
WILDCARD_WGPU_NATIVE:=$(wildcard wgpu-native/**/*.rs wgpu-core/**/*.rs) WILDCARD_WGPU_NATIVE:=$(wildcard wgpu-native/**/*.rs wgpu-core/**/*.rs)
WILDCARD_WGPU_REMOTE:=$(wildcard wgpu-remote/**/*.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)) ifeq (,$(TARGET))
CHECK_TARGET_FLAG= CHECK_TARGET_FLAG=
else else
@ -26,13 +30,38 @@ else
CREATE_BUILD_DIR=mkdir -p $(BUILD_DIR) CREATE_BUILD_DIR=mkdir -p $(BUILD_DIR)
endif 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 \ 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 #TODO: example-remote
all: example-compute example-triangle lib-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: check:
cargo check --all cargo check --all
@ -49,9 +78,15 @@ clear:
lib-native: Cargo.lock wgpu-native/Cargo.toml $(WILDCARD_WGPU_NATIVE) lib-native: Cargo.lock wgpu-native/Cargo.toml $(WILDCARD_WGPU_NATIVE)
cargo build --manifest-path wgpu-native/Cargo.toml 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) lib-remote: Cargo.lock wgpu-remote/Cargo.toml $(WILDCARD_WGPU_REMOTE)
cargo build --manifest-path wgpu-remote/Cargo.toml 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) $(FFI_DIR)/wgpu.h: wgpu-native/cbindgen.toml $(WILDCARD_WGPU_NATIVE)
rustup run nightly cbindgen -o $(FFI_DIR)/wgpu.h wgpu-native rustup run nightly cbindgen -o $(FFI_DIR)/wgpu.h wgpu-native