-
Notifications
You must be signed in to change notification settings - Fork 113
/
Makefile
57 lines (48 loc) · 1.42 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
UNAME := $(shell uname)
ifeq ($(UNAME), Darwin)
OS_MESSAGE := "MacOS detected"
CMAKE_SETUP := "which cmake || brew install cmake"
PROTOBUF_SETUP := "which protoc || brew install protobuf"
OPENSSL_SETUP := "which openssl || brew install openssl"
else ifeq ($(UNAME), Linux)
OS_MESSAGE := "Linux detected"
CMAKE_SETUP := "which cmake || sudo apt-get install --yes build-essential cmake"
PROTOBUF_SETUP := "which protoc || sudo apt-get install --yes protobuf-compiler"
OPENSSL_SETUP := "which openssl || sudo apt-get install --yes libssl-dev"
else
OS_MESSAGE := "Unsupported OS; please install rust, cmake, protobuf, and openssl manually"
CMAKE_SETUP := ""
PROTOBUF_SETUP := ""
OPENSSL_SETUP := ""
endif
setup:
@echo "${OS_MESSAGE}: installing..."
$(shell "${CMAKE_SETUP}")
$(shell "${PROTOBUF_SETUP}")
$(shell "${OPENSSL_SETUP}")
which cargo || curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
which maturin || pip install 'maturin>=1.5,<2.0'
publish:
maturin publish
test: test-python test-rust
test-python:
maturin develop --extras="all"
pytest -vsx tests/python
rm -rf tests/work/*
test-rust:
cargo test -- --nocapture
rm -rf tests/work/*
develop:
maturin develop --extras="all"
style:
rustfmt --edition 2021 src/*.rs
isort .
black .
check:
isort --check .
black --check .
mypy tests/python/
mypy python/
flake8 tests/python/
flake8 python/
rustfmt --edition 2021 src/*.rs --check