From ad797cbd81ff7521ea513940f0393e0f036a5f9a Mon Sep 17 00:00:00 2001 From: Korijn van Golen Date: Tue, 24 Dec 2019 14:19:43 +0100 Subject: [PATCH] makefile package command and travis deploy step --- .gitignore | 1 + .travis.yml | 14 ++++++++++++++ Makefile | 39 +++++++++++++++++++++++++++++++++++++-- 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f176de3dc..4c7b80e30 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ .vs build ffi/dawn*.h +dist diff --git a/.travis.yml b/.travis.yml index 2b61fbbeb..48ab803d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/Makefile b/Makefile index 37a1c847b..2fe9d838a 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 @@ -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