-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
92 lines (79 loc) · 2.88 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
85
86
87
88
89
90
91
92
PYTHON3 := $(shell which python3 2>/dev/null)
PYTHON := python3
COVERAGE := --cov=pennylane_qrack --cov-report term-missing --cov-report=html:coverage_html_report
TESTRUNNER := -m pytest tests
UNAME_S := $(shell uname -s)
UNAME_P := $(shell uname -p)
QRACK_PRESENT := $(wildcard qrack/.)
.PHONY: help
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " build-deps to build PennyLane-Qrack C++ dependencies"
@echo " install to install PennyLane-Qrack"
@echo " wheel to build the PennyLane-Qrack wheel"
@echo " dist to package the source distribution"
@echo " clean to delete all temporary, cache, and build files"
@echo " clean-docs to delete all built documentation"
@echo " test to run the test suite"
@echo " coverage to generate a coverage report"
.PHONY: build-deps
build-deps:
ifneq ($(OS),Windows_NT)
ifeq ($(QRACK_PRESENT),)
git clone https://github.com/unitaryfund/qrack.git; cd qrack; git checkout 6d3ec4d55368a0799d621dcc703fbfbe8e32b74e; cd ..
endif
mkdir -p qrack/build
ifeq ($(UNAME_S),Linux)
ifeq ($(UNAME_P),x86_64)
cd qrack/build; cmake -DENABLE_RDRAND=OFF -DENABLE_DEVRAND=ON ..; make all; \
mkdir ../../_qrack_include; mkdir ../../_qrack_include/qrack; cp -r ../include/* ../../_qrack_include/qrack; cp -r include/* ../../_qrack_include/qrack; \
cd ../../..
else
cd qrack/build; cmake -DENABLE_RDRAND=OFF -DENABLE_DEVRAND=ON -DENABLE_COMPLEX_X2=OFF -DENABLE_SSE3=OFF ..; make all; \
mkdir ../../_qrack_include; mkdir ../../_qrack_include/qrack; cp -r ../include/* ../../_qrack_include/qrack; cp -r include/* ../../_qrack_include/qrack; \
cd ../../..
endif
endif
ifeq ($(UNAME_S),Darwin)
ifeq ($(UNAME_P),x86_64)
cd qrack/build; cmake ..; make all; \
mkdir ../../_qrack_include; mkdir ../../_qrack_include/qrack; cp -r ../include/* ../../_qrack_include/qrack; cp -r include/* ../../_qrack_include/qrack; \
cd ../../..
else
cd qrack/build; cmake -DENABLE_RDRAND=OFF -DENABLE_COMPLEX_X2=OFF -DENABLE_SSE3=OFF -DENABLE_OPENCL=OFF ..; make all; \
mkdir ../../_qrack_include; mkdir ../../_qrack_include/qrack; cp -r ../include/* ../../_qrack_include/qrack; cp -r include/* ../../_qrack_include/qrack; \
cd ../../..
endif
endif
endif
cd pennylane_qrack; cmake ..; make all
.PHONY: install
install:
ifndef PYTHON3
@echo "To install PennyLane-Qrack you need to have Python 3 installed"
endif
$(PYTHON) setup.py install
.PHONY: wheel
wheel:
$(PYTHON) setup.py bdist_wheel
.PHONY: dist
dist:
$(PYTHON) setup.py sdist
.PHONY : clean
clean:
rm -rf pennylane_qrack/__pycache__
rm -rf tests/__pycache__
rm -rf dist
rm -rf build
rm -rf .pytest_cache
rm -rf .coverage coverage_html_report/
docs:
make -C doc html
.PHONY : clean-docs
clean-docs:
make -C doc clean
test:
$(PYTHON) $(TESTRUNNER)
coverage:
@echo "Generating coverage report..."
$(PYTHON) $(TESTRUNNER) $(COVERAGE)