-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathMakefile
84 lines (67 loc) · 2.01 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#
# Makefile to set up consistent build environment for generated files
#
# specific versions to ensure consistent rebuilds
BLACK_VERSION = 22.6.0
GRPCIO_VERSION = 1.44.0
PYQT5_VERSION = 5.14.2
TORCH_VERSION = 1.11.0
TORCHVISION_VERSION = 0.12.0
LOCAL_EXECUTION_MODELS = \
cafe_gogh.model \
candy.model \
david_vaughan.model \
dido_carthage.model \
fall_icarus.model \
femmes_d_alger.model \
going_to_work.model \
monet.model \
mosaic.model \
rain_princess.model \
starry-night.model \
sunday_afternoon.model \
the_scream.model \
udnie.model \
weeping_woman.model
LOCAL_EXEC_ASSET_DIR = android-client/app/src/main/assets
GENERATED_FILES = \
$(LOCAL_EXECUTION_MODELS:%.model=$(LOCAL_EXEC_ASSET_DIR)/%.pt) \
python-client/src/openrtist/design.py \
python-client/src/openrtist/openrtist_pb2.py
REQUIREMENTS = \
'PyQT5==$(PYQT5_VERSION)' \
'opencv-python' \
'fire' \
'torch==$(TORCH_VERSION)' \
'torchvision==$(TORCHVISION_VERSION)' \
'black==$(BLACK_VERSION)' \
flake8 \
flake8-bugbear \
'grpcio-tools==$(GRPCIO_VERSION)'
all: $(GENERATED_FILES)
check: .venv
.venv/bin/black --check .
.venv/bin/flake8
reformat: .venv
.venv/bin/black .
docker: all
docker build -t cmusatyalab/openrtist .
clean:
$(RM) $(GENERATED_FILES)
distclean: clean
$(RM) -r .venv
.venv:
python3 -m venv .venv
.venv/bin/pip install $(REQUIREMENTS)
mkdir -p .venv/tmp
touch .venv
%.py: %.ui .venv
.venv/bin/pyuic5 -x $< -o $@
python-client/src/openrtist/openrtist_pb2.py: android-client/app/src/main/proto/openrtist.proto .venv
.venv/bin/python -m grpc_tools.protoc --python_out=server -I android-client/app/src/main/proto openrtist.proto
.venv/bin/python -m grpc_tools.protoc --python_out=python-client/src/openrtist -I android-client/app/src/main/proto openrtist.proto
$(LOCAL_EXEC_ASSET_DIR)/%.pt: models/%.model .venv
mkdir -p $(LOCAL_EXEC_ASSET_DIR)
.venv/bin/python scripts/freeze_model.py freeze --weight-file-path='$<' --output-file-path='$@'
.PHONY: all check reformat docker clean distclean
.PRECIOUS: $(GENERATED_FILES)