-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
179 lines (138 loc) · 6.4 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# Makefile to drive the tests
DC ?= dmd
export PYTHON_LIB_DIR ?= /usr/lib
export DUB_CONFIGURATION ?= env
export PYD_LIBPYTHON_DIR ?= /usr/lib
export PYD_LIBPYTHON ?= $(shell python --version | awk '{print $$2}' | awk -F. '{print "python" $$1 "." $$2}')
export PYD_D_VERSION_1 ?= Python_2_4_Or_Later
export PYD_D_VERSION_2 ?= Python_2_5_Or_Later
export PYD_D_VERSION_3 ?= Python_2_6_Or_Later
export PYD_D_VERSION_4 ?= Python_2_7_Or_Later
export PYD_D_VERSION_5 ?= Python_3_0_Or_Later
export PYD_D_VERSION_6 ?= Python_3_1_Or_Later
export PYD_D_VERSION_7 ?= Python_3_2_Or_Later
export PYD_D_VERSION_8 ?= Python_3_3_Or_Later
export PYD_D_VERSION_9 ?= Python_3_4_Or_Later
export PYD_D_VERSION_10 ?= Python_3_5_Or_Later
export PYD_D_VERSION_11 ?= Python_3_6_Or_Later
export PYD_D_VERSION_12 ?= Python_3_7_Or_Later
export PYD_D_VERSION_13 ?= Python_3_8_Or_Later
.PHONY: all
all: test
.PHONY: test
test: test_python test_translation test_phobos #test_cs
.PHONY: test_python
test_python: ut test_python_pyd test_python_pynih
.PHONY: test_python_pyd
test_python_pyd: test_simple_pyd test_pyd_pyd test_issues_pyd test_numpy_pyd
.PHONY: test_python_pynih
test_python_pynih: test_simple_pynih test_pyd_pynih test_issues_pynih
.PHONY: test_phobos # new Phobos target, reflects on individual Phobos modules / packages
test_phobos:
make -C examples/phobos
.PHONY: test_cs
test_cs: test_wrapper_cs test_simple_cs
.PHONY: test_translation
test_translation: test_translation_ut #test_transl_simple_cs
.PHONY: test_translation_ut
test_translation_ut:
cd translate && PYTHONPATH=$(PWD)/translate pytest -s -vv
.PHONY: ut
ut:
dub test -q --compiler=${DC}
.PHONY: clean
clean:
git clean -xffd
.PHONY: test_simple_pyd
test_simple_pyd:
make -C examples/simple test_simple_pyd
.PHONY: test_simple_pynih
test_simple_pynih:
make -C examples/simple test_simple_pynih
# Runs the generated C# test for the simple example
.PHONY: test_transl_simple_cs
test_transl_simple_cs: tests/test_transl_simple_cs/bin/Debug/netcoreapp2.1/libsimple.so tests/test_transl_simple_cs/Simple.cs tests/test_transl_simple_cs/TestSimple.cs
@cd tests/test_transl_simple_cs && \
dotnet build test_simple_cs.csproj && \
dotnet test test_simple_cs.csproj
# I'm not sure why we have to do this manually but otherwise CI fails
tests/test_transl_simple_cs/bin/Debug/netcoreapp2.1/libsimple.so: examples/simple/lib/csharp/libsimple.x64.so tests/test_transl_simple_cs/bin/Debug/netcoreapp2.1
cp $< $@
tests/test_transl_simple_cs/bin/Debug/netcoreapp2.1:
mkdir -p $@
tests/test_transl_simple_cs/TestSimple.cs: tests/test_simple.py translate/pytest_translate translate/backend/csharp.py translate/python_to_ir.py translate/ir.py
translate/pytest_translate tests/test_simple.py $@
tests/test_transl_simple_cs/Simple.cs: examples/simple/Simple.cs
cp $^ $@
.PHONY: test_wrapper_cs
test_wrapper_cs: csharp/tests/Wrapper.cs csharp/tests/libcsharp-tests.x64.so
cd csharp/tests && dotnet build && dotnet test
csharp/tests/Wrapper.cs: csharp/tests/dub.sdl csharp/tests/dub.selections.json csharp/tests/source/app.d csharp/tests/source/test.d
cd csharp/tests && dub run -q --config=emitCSharp --compiler=${DC}
.PHONY: csharp/tests/libcsharp-tests.x64.so
csharp/tests/libcsharp-tests.x64.so:
cd csharp/tests && dub build -q --compiler=${DC} && cp libcsharp-tests.so libcsharp-tests.x64.so
.PHONY: test_simple_cs
test_simple_cs: examples/simple/lib/csharp/libsimple.x64.so examples/simple/Simple.cs
@cd tests/test_simple_cs && \
dotnet build test_simple_cs.csproj && \
dotnet test test_simple_cs.csproj
examples/simple/lib/csharp/libsimple.x64.so: examples/simple/lib/csharp/libsimple.so
@cp $^ $@
.PHONY: examples/simple/lib/csharp/libsimple.so
examples/simple/lib/csharp/libsimple.so: examples/simple/dub.sdl examples/simple/dub.selections.json
@cd examples/simple && dub build --compiler=${DC} -q -c csharp
examples/simple/Simple.cs: examples/simple/lib/csharp/libsimple.so
@cd examples/simple && dub run -q -c emitCSharp --compiler=${DC}
.PHONY: test_issues_pyd
test_issues_pyd: tests/test_issues.py examples/issues/lib/pyd/issues.so
PYTHONPATH=$(PWD)/examples/issues/lib/pyd PYD=1 pytest -s -vv $<
examples/issues/lib/pyd/issues.so: examples/issues/lib/pyd/libissues.so
@cp $^ $@
.PHONY: examples/issues/lib/pyd/libissues.so
examples/issues/lib/pyd/libissues.so:
@cd examples/issues && dub build -q -c $(DUB_CONFIGURATION) --compiler=${DC}
.PHONY: test_issues_pynih
test_issues_pynih: tests/test_issues.py examples/issues/lib/pynih/issues.so
PYTHONPATH=$(PWD)/examples/issues/lib/pynih PYNIH=1 pytest -s -vv $<
examples/issues/lib/pynih/issues.so: examples/issues/lib/pynih/libissues.so
@cp $^ $@
.PHONY: examples/issues/lib/pynih/libissues.so
examples/issues/lib/pynih/libissues.so:
@cd examples/issues && dub build -q -c pynih --compiler=${DC}
examples/issues/dub.selections.json:
@cd examples/issues && dub upgrade -q
.PHONY: test_pyd_pyd
test_pyd_pyd: tests/test_pyd.py examples/pyd/lib/pyd/pyd.so
PYTHONPATH=$(PWD)/examples/pyd/lib/pyd PYD=1 pytest -s -vv $<
examples/pyd/lib/pyd/pyd.so: examples/pyd/lib/pyd/libpydtests.so
@cp $^ $@
.PHONY: examples/pyd/lib/pyd/libpydtests.so
examples/pyd/lib/pyd/libpydtests.so:
@cd examples/pyd && dub build -q -c $(DUB_CONFIGURATION) --compiler=${DC}
.PHONY: test_pyd_pynih
test_pyd_pynih: tests/test_pyd.py examples/pyd/lib/pynih/pyd.so
PYTHONPATH=$(PWD)/examples/pyd/lib/pynih PYNIH=1 pytest -s -vv $<
examples/pyd/lib/pynih/pyd.so: examples/pyd/lib/pynih/libpydtests.so
@cp $^ $@
.PHONY: examples/pyd/lib/pynih/libpydtests.so
examples/pyd/lib/pynih/libpydtests.so:
@cd examples/pyd && dub build -q -c pynih --compiler=${DC}
.PHONY: test_numpy_pyd
test_numpy_pyd: tests/test_numpy.py examples/numpy/lib/pyd/numpytests.so
PYTHONPATH=$(PWD)/examples/numpy/lib/pyd pytest -s -vv $<
examples/numpy/lib/pyd/numpytests.so: examples/numpy/lib/pyd/libnumpy.so
@cp $^ $@
.PHONY: examples/numpy/lib/pyd/libnumpy.so
examples/numpy/lib/pyd/libnumpy.so:
@cd examples/numpy && dub build -q -c $(DUB_CONFIGURATION) --compiler=${DC}
examples/numpy/dub.selections.json:
@cd examples/numpy && dub upgrade -q
.PHONY: test_numpy_pynih
test_numpy_pynih: tests/test_numpy.py examples/numpy/lib/pynih/numpytests.so
PYTHONPATH=$(PWD)/examples/numpy/lib/pynih pytest -s -vv $<
examples/numpy/lib/pynih/numpytests.so: examples/numpy/lib/pynih/libnumpy.so
@cp $^ $@
.PHONY: examples/numpy/lib/pynih/libnumpy.so
examples/numpy/lib/pynih/libnumpy.so:
@cd examples/numpy && dub build -q -c pynih --compiler=${DC}