/
Makefile.am
234 lines (201 loc) · 8.05 KB
/
Makefile.am
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
##################################################
# description of unit tests
##################################################
TEST_DIR = tests
# material_dispersion.py test must be excluded from test suite for MPI build
if WITH_MPI
MDPYTEST=
MPBPYTEST=
else
MDPYTEST=$(TEST_DIR)/material_dispersion.py
if WITH_MPB
MPBPYTEST=$(TEST_DIR)/mpb.py
else
MPBPYTEST=
endif # WITH_MPB
endif # WITH_MPI
if WITH_MPB
BINARY_GRATING_TEST = $(TEST_DIR)/binary_grating.py
DISPERSIVE_EIGENMODE_TEST = $(TEST_DIR)/dispersive_eigenmode.py
KDOM_TEST = $(TEST_DIR)/kdom.py
MODE_COEFFS_TEST = $(TEST_DIR)/mode_coeffs.py
MODE_DECOMPOSITION_TEST = $(TEST_DIR)/mode_decomposition.py
WVG_SRC_TEST = $(TEST_DIR)/wvg_src.py
else
BINARY_GRATING_TEST =
DISPERSIVE_EIGENMODE_TEST =
KDOM_TEST =
MODE_COEFFS_TEST =
MODE_DECOMPOSITION_TEST =
WVG_SRC_TEST =
endif
TESTS = \
$(TEST_DIR)/3rd_harm_1d.py \
$(TEST_DIR)/absorber_1d.py \
$(TEST_DIR)/antenna_radiation.py \
$(TEST_DIR)/array_metadata.py \
$(TEST_DIR)/bend_flux.py \
$(BINARY_GRATING_TEST) \
$(TEST_DIR)/cavity_arrayslice.py \
$(TEST_DIR)/cavity_farfield.py \
$(TEST_DIR)/chunks.py \
$(TEST_DIR)/cyl_ellipsoid.py \
${DISPERSIVE_EIGENMODE_TEST} \
$(TEST_DIR)/dft_energy.py \
$(TEST_DIR)/dft_fields.py \
$(TEST_DIR)/faraday_rotation.py \
$(TEST_DIR)/field_functions.py \
$(TEST_DIR)/force.py \
$(TEST_DIR)/fragment_stats.py \
$(TEST_DIR)/geom.py \
$(TEST_DIR)/get_point.py \
$(TEST_DIR)/holey_wvg_bands.py \
$(TEST_DIR)/holey_wvg_cavity.py \
$(KDOM_TEST) \
$(TEST_DIR)/ldos.py \
$(MDPYTEST) \
$(TEST_DIR)/medium_evaluations.py \
$(MPBPYTEST) \
$(MODE_COEFFS_TEST) \
$(MODE_DECOMPOSITION_TEST) \
$(TEST_DIR)/multilevel_atom.py \
$(TEST_DIR)/n2f_periodic.py \
$(TEST_DIR)/oblique_source.py \
$(TEST_DIR)/physical.py \
$(TEST_DIR)/pw_source.py \
$(TEST_DIR)/refl_angular.py \
$(TEST_DIR)/ring.py \
$(TEST_DIR)/ring_cyl.py \
$(TEST_DIR)/simulation.py \
$(TEST_DIR)/source.py \
$(TEST_DIR)/user_defined_material.py \
$(TEST_DIR)/visualization.py \
$(WVG_SRC_TEST)
if WITH_COVERAGE
PY_LOG_COMPILER = coverage run -a --omit=$(top_srcdir)/python/tests/*,${HOME}/virtualenv/*,$(top_srcdir)/python/examples/*
else
PY_LOG_COMPILER = $(RUNCODE) $(PYTHON)
endif
TEST_EXTENSIONS = .py
TESTS_ENVIRONMENT = export PYTHONPATH=$(abs_top_builddir)/python:$$PYTHONPATH;
######################################################################
# instructions for building the _meep binary library that implements
# the low-level interface between python codes and the libmeep C++ library
######################################################################
BUILT_SOURCES = meep-python.cxx __init__.py
EXTRA_DIST = $(BUILT_SOURCES) typemap_utils.cpp materials.py examples tests
CLEANFILES = $(BUILT_SOURCES) meep.py .coverage
AM_CPPFLAGS = -I$(top_srcdir)/src \
-I$(top_srcdir)/libpympb \
-I$(top_builddir) # for config.h
LIBMEEP = $(top_builddir)/src/libmeep.la
_meep_la_SOURCES = meep-python.cxx
_meep_la_LIBADD = $(LIBMEEP) $(PYTHON_LIBS)
_meep_la_LDFLAGS = -module -version-info @SHARED_VERSION_INFO@
_meep_la_CPPFLAGS = $(PYTHON_INCLUDES) $(AM_CPPFLAGS)
pkgpyexec_LTLIBRARIES = _meep.la
######################################################################
# instructions for building the _mpb binary library that implements
# the low-level interface between python codes and the libmpb C++ library
######################################################################
if WITH_MPB
BUILT_SOURCES += mpb-python.cxx mpb.py
EXTRA_DIST += solver.py mpb_data.py
MPB_LA = _mpb.la
pympbdir = $(pkgpythondir)/mpb
pympb_PYTHON = mpb.py solver.py mpb_data.py
pympb_LTLIBRARIES = _mpb.la
_mpb_la_SOURCES = mpb-python.cxx
_mpb_la_LIBADD = $(PYTHON_LIBS) $(top_builddir)/libpympb/libpympb.la
_mpb_la_LDFLAGS = -module -version-info @SHARED_VERSION_INFO@
_mpb_la_CPPFLAGS = $(PYTHON_INCLUDES) $(AM_CPPFLAGS)
install-data-hook:
mv $(DESTDIR)$(pkgpythondir)/mpb/mpb.py $(DESTDIR)$(pkgpythondir)/mpb/__init__.py
uninstall-hook:
rm -f $(DESTDIR)$(pkgpythondir)/mpb/__init__.py
endif
##################################################
# instructions for running SWIG to generate the
# source files for the previous step
##################################################
if MAINTAINER_MODE
SWIG ?= swig
SWIG_VERSION = $(shell $(SWIG) -version | grep Version | awk '{print $$3}')
MEEP_SWIG_SRC = meep.i numpy.i vec.i
HPPFILES= \
$(top_srcdir)/src/meep.hpp \
$(top_srcdir)/src/meep_internals.hpp \
$(top_srcdir)/src/bicgstab.hpp \
$(top_srcdir)/src/meep/vec.hpp \
$(top_srcdir)/src/meep/mympi.hpp \
$(top_srcdir)/src/meepgeom.hpp \
$(top_srcdir)/src/material_data.hpp
meep-python.cxx: $(MEEP_SWIG_SRC) $(HPPFILES)
$(SWIG) -Wextra $(AM_CPPFLAGS) -outdir $(builddir) -c++ -nofastunpack -python -o $@ $(srcdir)/meep.i
if WITH_MPB
MPB_SWIG_SRC = mpb.i
mpb-python.cxx: $(MPB_SWIG_SRC) $(top_srcdir)/libpympb/pympb.hpp
$(SWIG) -Wextra $(AM_CPPFLAGS) $(PYMPBINCLUDE) -outdir $(builddir) -c++ -nofastunpack -python -o $@ $(srcdir)/mpb.i
mpb.py: mpb-python.cxx
MPB_PY = mpb.py
endif # WITH_MPB
meep.py: meep-python.cxx
__init__.py: meep.py $(MPB_PY)
cp $< $@
echo "__version__ = '$(shell git describe --tags | sed 's/^v//')'" >> $@
if [[ "${SWIG_VERSION}" = 3.0.12 ]]; then \
sed -i.bak '/^if _swig_python_version_info >= (2, 7, 0):/,/^else:/d' $@; \
sed -i.bak 's/ import _meep/from . import _meep/' $@; \
fi
if WITH_MPB
if [[ "${SWIG_VERSION}" == 3.0.12 ]]; then \
sed -i.bak '/^if _swig_python_version_info >= (2, 7, 0):/,/^else:/d' mpb.py; \
sed -i.bak 's/ import _mpb/from . import _mpb/' mpb.py; \
fi
endif
INIT_PY = __init__.py
MPB_PY_PATH = $(builddir)/mpb.py
else # not maintainer mode
INIT_PY = $(srcdir)/__init__.py
MPB_PY_PATH = $(srcdir)/mpb.py
endif # MAINTAINER_MODE
######################################################################
# specification of python source files to be byte-compiled at installation
######################################################################
HL_IFACE = \
$(srcdir)/geom.py \
$(srcdir)/simulation.py \
$(srcdir)/source.py \
$(srcdir)/visualization.py \
$(srcdir)/materials.py
pkgpython_PYTHON = __init__.py $(HL_IFACE)
adjointdir = $(pkgpythondir)/adjoint
adjoint_PYTHON = $(srcdir)/adjoint/__init__.py \
$(srcdir)/adjoint/Basis.py \
$(srcdir)/adjoint/Objective.py \
$(srcdir)/adjoint/OptimizationProblem.py \
$(srcdir)/adjoint/ParallelDesignTester.py \
$(srcdir)/adjoint/Visualization.py
######################################################################
# finally, specification of what gets installed in the meep python
# module directory of the python site-packages installation
# Q: Why is this not redundant since e.g. the HL_IFACE files should
# already be installed by virtue of being in pkgpython_PYTHON
######################################################################
PY_PKG_FILES = $(INIT_PY) $(HL_IFACE) .libs/_meep.so
meep: _meep.la $(MPB_LA) __init__.py $(HL_IFACE)
mkdir -p meep
cp $(PY_PKG_FILES) meep
if WITH_MPB
mkdir -p meep/mpb
cp .libs/_mpb.so meep/mpb
cp $(MPB_PY_PATH) meep/mpb/__init__.py
cp $(srcdir)/solver.py $(srcdir)/mpb_data.py meep/mpb
endif
all-local: meep
clean-local:
rm -rf meep __init__.py.bak
distclean-local:
rm -f *.h5
rm -f *.mp4
rm -f *.gif