@@ -6,18 +6,24 @@ TESTRUNNER := -m pytest tests --tb=short
6
6
7
7
PL_BACKEND? ="$(if $(backend:-= ) ,$(backend ) ,lightning_qubit) "
8
8
9
- ifdef verbose
10
- VERBOSE := --verbose
11
- else
12
- VERBOSE :=
13
- endif
14
-
15
9
ifdef check
16
10
CHECK := --check
17
11
else
18
12
CHECK :=
19
13
endif
20
14
15
+ ifdef build_options
16
+ OPTIONS := $(build_options )
17
+ else
18
+ OPTIONS :=
19
+ endif
20
+
21
+ ifdef verbose
22
+ VERBOSE := --verbose
23
+ else
24
+ VERBOSE :=
25
+ endif
26
+
21
27
.PHONY : help
22
28
help :
23
29
@echo " Please use \` make <target>' where <target> is one of"
@@ -56,16 +62,7 @@ clean:
56
62
rm -rf .coverage coverage_html_report/
57
63
rm -rf pennylane_lightning/* _ops*
58
64
59
- .PHONY : test-builtin test-suite test-python coverage coverage-cpp test-cpp test-cpp-no-omp test-cpp-blas test-cpp-kokkos
60
- test-builtin :
61
- PL_DEVICE=$(if $(device:-= ) ,$(device ) ,lightning.qubit) $(PYTHON ) -I $(TESTRUNNER )
62
-
63
- test-suite :
64
- pl-device-test --device $(if $(device:-= ) ,$(device ) ,lightning.qubit) --skip-ops --shots=20000
65
- pl-device-test --device $(if $(device:-= ) ,$(device ) ,lightning.qubit) --shots=None --skip-ops
66
-
67
- test-python : test-builtin test-suite
68
-
65
+ .PHONY : test-builtin test-suite test-python test-cpp coverage coverage-cpp
69
66
coverage :
70
67
@echo " Generating coverage report for $( if $( device:-=) ,$( device) ,lightning.qubit) device:"
71
68
$(PYTHON ) $(TESTRUNNER ) $(COVERAGE )
@@ -75,20 +72,29 @@ coverage:
75
72
coverage-cpp :
76
73
@echo " Generating cpp coverage report in BuildCov/out for $( PL_BACKEND) backend"
77
74
rm -rf ./BuildCov
78
- cmake -BBuildCov -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DENABLE_COVERAGE=ON -DPL_BACKEND=$(PL_BACKEND )
75
+ cmake -BBuildCov -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DENABLE_COVERAGE=ON -DPL_BACKEND=$(PL_BACKEND ) $( OPTIONS )
79
76
cmake --build ./BuildCov
80
77
cd ./BuildCov; for file in * runner ; do ./$file ; done ; \
81
78
lcov --directory . -b ../pennylane_lightning/core/src --capture --output-file coverage.info; \
82
79
genhtml coverage.info --output-directory out
83
80
84
81
build :
85
82
rm -rf ./Build
86
- cmake -BBuild -G Ninja -DENABLE_BLAS=ON - DENABLE_WARNINGS=ON -DPL_BACKEND=$(PL_BACKEND )
83
+ cmake -BBuild -G Ninja -DENABLE_WARNINGS=ON -DPL_BACKEND=$(PL_BACKEND ) $( OPTIONS )
87
84
cmake --build ./Build $(VERBOSE )
88
85
86
+ test-builtin :
87
+ PL_DEVICE=$(if $(device:-= ) ,$(device ) ,lightning.qubit) $(PYTHON ) -I $(TESTRUNNER )
88
+
89
+ test-suite :
90
+ pl-device-test --device $(if $(device:-= ) ,$(device ) ,lightning.qubit) --skip-ops --shots=20000
91
+ pl-device-test --device $(if $(device:-= ) ,$(device ) ,lightning.qubit) --shots=None --skip-ops
92
+
93
+ test-python : test-builtin test-suite
94
+
89
95
test-cpp :
90
96
rm -rf ./BuildTests
91
- cmake -BBuildTests -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DENABLE_OPENMP=ON - DENABLE_WARNINGS=ON -DPL_BACKEND=$(PL_BACKEND )
97
+ cmake -BBuildTests -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DENABLE_WARNINGS=ON -DPL_BACKEND=$(PL_BACKEND ) $( OPTIONS )
92
98
ifdef target
93
99
cmake --build ./BuildTests $(VERBOSE) --target $(target)
94
100
OMP_PROC_BIND=false ./BuildTests/$(target)
@@ -97,25 +103,19 @@ else
97
103
OMP_PROC_BIND=false cmake --build ./BuildTests $(VERBOSE) --target test
98
104
endif
99
105
100
- test-cpp-blas :
101
- rm -rf ./BuildTests
102
- cmake -BBuildTests -G Ninja -DBUILD_TESTS=ON -DENABLE_BLAS=ON -DENABLE_WARNINGS=ON -DPL_BACKEND=$(PL_BACKEND )
103
- cmake --build ./BuildTests $(VERBOSE )
104
- cmake --build ./BuildTests $(VERBOSE ) --target test
105
-
106
106
.PHONY : format format-cpp
107
107
format : format-cpp format-python
108
108
109
109
format-cpp :
110
110
./bin/format $(CHECK ) --cfversion $(if $(version:-= ) ,$(version ) ,0) ./pennylane_lightning
111
111
112
112
format-python :
113
- black -l 100 ./pennylane_lightning/ ./tests $(CHECK )
113
+ black -l 100 ./pennylane_lightning/ ./mpitests ./ tests $(CHECK )
114
114
115
115
.PHONY : check-tidy
116
116
check-tidy :
117
117
rm -rf ./BuildTidy
118
- cmake -BBuildTidy -DENABLE_CLANG_TIDY=ON -DBUILD_TESTS=ON -DENABLE_WARNINGS=ON -DPL_BACKEND=$(PL_BACKEND )
118
+ cmake -BBuildTidy -DENABLE_CLANG_TIDY=ON -DBUILD_TESTS=ON -DENABLE_WARNINGS=ON -DPL_BACKEND=$(PL_BACKEND ) $( OPTIONS )
119
119
ifdef target
120
120
cmake --build ./BuildTidy $(VERBOSE) --target $(target)
121
121
else
0 commit comments