-
Notifications
You must be signed in to change notification settings - Fork 637
/
Makefile.am
274 lines (238 loc) · 10.2 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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
##################################################
# description of unit tests
##################################################
TEST_DIR = tests
# material_dispersion.py test must be excluded from test suite for MPI build
if WITH_MPI
MDPYTEST=
else
MDPYTEST=$(TEST_DIR)/test_material_dispersion.py
endif # WITH_MPI
if WITH_MPB
MPBPYTEST=$(TEST_DIR)/test_mpb.py
else
MPBPYTEST=
endif # WITH_MPB
if WITH_MPB
BINARY_GRATING_TEST = $(TEST_DIR)/test_binary_grating.py
DIFFRACTED_PLANEWAVE_TEST = $(TEST_DIR)/test_diffracted_planewave.py
DISPERSIVE_EIGENMODE_TEST = $(TEST_DIR)/test_dispersive_eigenmode.py
KDOM_TEST = $(TEST_DIR)/test_kdom.py
MODE_COEFFS_TEST = $(TEST_DIR)/test_mode_coeffs.py
MODE_DECOMPOSITION_TEST = $(TEST_DIR)/test_mode_decomposition.py
WVG_SRC_TEST = $(TEST_DIR)/test_wvg_src.py
else
BINARY_GRATING_TEST =
DIFFRACTED_PLANEWAVE_TEST =
DISPERSIVE_EIGENMODE_TEST =
KDOM_TEST =
MODE_COEFFS_TEST =
MODE_DECOMPOSITION_TEST =
WVG_SRC_TEST =
endif
TESTS = \
$(TEST_DIR)/test_3rd_harm_1d.py \
$(TEST_DIR)/test_absorber_1d.py \
$(TEST_DIR)/test_adjoint_solver.py \
$(TEST_DIR)/test_adjoint_utils.py \
$(TEST_DIR)/test_adjoint_cyl.py \
$(TEST_DIR)/test_adjoint_jax.py \
$(TEST_DIR)/test_antenna_radiation.py \
$(TEST_DIR)/test_array_metadata.py \
$(TEST_DIR)/test_bend_flux.py \
$(TEST_DIR)/test_binary_partition_utils.py \
$(BINARY_GRATING_TEST) \
$(TEST_DIR)/test_cavity_arrayslice.py \
$(TEST_DIR)/test_cavity_farfield.py \
$(TEST_DIR)/test_chunk_balancer.py \
$(TEST_DIR)/test_chunk_layout.py \
$(TEST_DIR)/test_chunks.py \
$(TEST_DIR)/test_conductivity.py \
$(TEST_DIR)/test_cyl_ellipsoid.py \
$(TEST_DIR)/test_dft_energy.py \
$(TEST_DIR)/test_dft_fields.py \
${DIFFRACTED_PLANEWAVE_TEST} \
${DISPERSIVE_EIGENMODE_TEST} \
$(TEST_DIR)/test_divide_mpi_processes.py \
$(TEST_DIR)/test_dump_load.py \
$(TEST_DIR)/test_eigfreq.py \
$(TEST_DIR)/test_faraday_rotation.py \
$(TEST_DIR)/test_field_functions.py \
$(TEST_DIR)/test_force.py \
$(TEST_DIR)/test_fragment_stats.py \
$(TEST_DIR)/test_gaussianbeam.py \
$(TEST_DIR)/test_geom.py \
$(TEST_DIR)/test_get_point.py \
$(TEST_DIR)/test_get_epsilon_grid.py \
$(TEST_DIR)/test_holey_wvg_bands.py \
$(TEST_DIR)/test_holey_wvg_cavity.py \
$(TEST_DIR)/test_integrated_source.py \
$(KDOM_TEST) \
$(TEST_DIR)/test_ldos.py \
$(MDPYTEST) \
$(TEST_DIR)/test_material_grid.py \
$(TEST_DIR)/test_materials_library.py \
$(TEST_DIR)/test_medium_evaluations.py \
$(MPBPYTEST) \
$(MODE_COEFFS_TEST) \
$(MODE_DECOMPOSITION_TEST) \
$(TEST_DIR)/test_multilevel_atom.py \
$(TEST_DIR)/test_n2f_periodic.py \
$(TEST_DIR)/test_oblique_source.py \
$(TEST_DIR)/test_pml_cyl.py \
$(TEST_DIR)/test_physical.py \
$(TEST_DIR)/test_prism.py \
$(TEST_DIR)/test_pw_source.py \
$(TEST_DIR)/test_refl_angular.py \
$(TEST_DIR)/test_ring.py \
$(TEST_DIR)/test_ring_cyl.py \
$(TEST_DIR)/test_simulation.py \
$(TEST_DIR)/test_special_kz.py \
$(TEST_DIR)/test_source.py \
$(TEST_DIR)/test_timing_measurements.py \
$(TEST_DIR)/test_user_defined_material.py \
$(TEST_DIR)/test_verbosity_mgr.py \
$(TEST_DIR)/test_visualization.py \
$(WVG_SRC_TEST)
if WITH_COVERAGE
PY_LOG_COMPILER = coverage run -p --source=$(top_srcdir)/python/meep --omit=$(top_srcdir)/python/tests/*,$(top_srcdir)/python/examples/*,$(top_srcdir)/python/meep/materials.py
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 meep.py
EXTRA_DIST = $(BUILT_SOURCES) meep.i meep-python.hpp typemap_utils.cpp materials.py examples tests
CLEANFILES = .coverage
MAINTAINERCLEANFILES = $(BUILT_SOURCES)
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_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 \
$(top_srcdir)/src/adjust_verbosity.hpp \
meep-python.hpp
if MEEP_SWIG_PYTHON_THREADS
SWIG_MEEP_FLAGS = -threads
endif # MEEP_SWIG_PYTHON_THREADS
meep-python.cxx: $(MEEP_SWIG_SRC) $(HPPFILES)
$(SWIG) -Wextra $(SWIG_MEEP_FLAGS) $(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 $(top_srcdir)/src/meepgeom.hpp $(top_srcdir)/src/material_data.hpp $(top_srcdir)/src/material_data.cpp
$(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__ = '@VERSION@'" >> $@
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)/binary_partition_utils.py \
$(srcdir)/chunk_balancer.py \
$(srcdir)/geom.py \
$(srcdir)/simulation.py \
$(srcdir)/source.py \
$(srcdir)/timing_measurements.py \
$(srcdir)/visualization.py \
$(srcdir)/materials.py \
$(srcdir)/verbosity_mgr.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/optimization_problem.py \
$(srcdir)/adjoint/filters.py \
$(srcdir)/adjoint/filter_source.py \
$(srcdir)/adjoint/connectivity.py \
$(srcdir)/adjoint/unfilter_design.py \
$(srcdir)/adjoint/wrapper.py \
$(srcdir)/adjoint/utils.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/adjoint
cp $(PY_PKG_FILES) meep
cp $(adjoint_PYTHON) meep/adjoint
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