Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile package command and travis github releases #416

Merged
merged 9 commits into from
Dec 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
- if [[ $TRAVIS_RUST_VERSION == "stable" ]]; then make package; fi

deploy:
provider: releases
api_key:
secure: kS8vjHOnLEknb2qxf2dPxMW8S5KcpjSkSgoi23WXiX3DZ2v8DIJMxVLanJhD3mbr1oI1NGXQHrTeeA/HBEEJcOVzlQo38MgNo/Jyt1k4jLRyCEDL0LjO+M1zAQGoEDWlyyjeu+Alw3SFKqGoZeuYDZ/mxUpEapFMD++8w4IjON2fI6iNumcIMeAg3Ns6Y4wHYQPzfIQQf5svI9dh1lf7PhlFB/btONBPi6rXxU/UwCnHBoOPydl5OwjggaUAjCJSf8i/FDLWt5XpvA2UsML2AbcFNuwFhNGhf6ArwEsqgcMCGL6jACetvI/l3ZL96h5dsgzRLW0ruvnvpEm3y3aw9wCjEAcnQMZCBPlIfOpj5MH/guh526QWCVQ3rwRUJOhua9T2yvwda3ICYspyVShzlbwscA9yLwvsuO+6Hl+upuE2IPfLvS6QpnXVlIWHe/3HqOoQggDdsWvnZhhGNKASKsi9vNgTvec/1iX846/KGcV3nYeHIWFrvP0IgWtEqQrgcWj9w6X7LDdaTFmrkKwKnNn4ClLQYPnlWQS71iX0gwRhONGaSAEfFca6vwVTa8AGSQUEHphe5lT7LtAy6UhlbjZNuKvUR+pn+l0EoWlZzm+uxKMtGR+mG9h6My+GA3hCWWtX/Xc94TvuJ1cg+uRu48+rD21vv3cr2fEVDRq7pGg=
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
44 changes: 42 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,46 @@ 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
ZIP_TOOL=7z
else
UNAME_S:=$(shell uname -s)
ZIP_TOOL=zip
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

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

package: lib-native lib-native-release
mkdir -p dist
echo "$(GIT_TAG_FULL)" > dist/commit-sha
for RELEASE in debug release; do \
ARCHIVE=wgpu-$$RELEASE-$(OS_NAME)-$(GIT_TAG).zip; \
rm -f dist/$$ARCHIVE; \
if [ $(ZIP_TOOL) = zip ]; then \
zip -j dist/$$ARCHIVE target/$$RELEASE/libwgpu_*.$(LIB_EXTENSION) ffi/*.h dist/commit-sha; \
else \
7z a -tzip dist/$$ARCHIVE ./target/$$RELEASE/wgpu_*.$(LIB_EXTENSION) ./ffi/*.h ./dist/commit-sha; \
fi; \
done

check:
cargo check --all

Expand All @@ -49,6 +86,9 @@ 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

Expand Down