Commit 2f78058ef5dcc26947bd1bb76cfff0e5cef8317f
1 parent
413a0628
optionally include instrument specific interfaces
Showing
2 changed files
with
32 additions
and
8 deletions
pyext/Makefile.am
| 1 | 1 | ## Process this file with automake to produce Makefile.in |
| 2 | 2 | |
| 3 | -if HAVE_SWIG | |
| 4 | -if HAVE_PYTHON | |
| 5 | 3 | if ENABLE_PYTHON_BINDING |
| 6 | 4 | |
| 7 | 5 | SWIG_INTERFACE = gammalib.i |
| ... | ... | @@ -9,6 +7,18 @@ BUILT_SOURCES = gammalib_wrap.cpp gammalib.py |
| 9 | 7 | CLEANFILES = gammalib_wrap.cpp gammalib.py |
| 10 | 8 | #EXTRA_DIST = runme.py |
| 11 | 9 | |
| 10 | +# Set instrument specific SWIG options (those will be catched in gammalib.i) | |
| 11 | +if WITH_INST_CTA | |
| 12 | + OPT_CTA = -DWITH_INST_CTA | |
| 13 | + INC_CTA = -I$(top_srcdir)/inst/cta/pyext | |
| 14 | +endif | |
| 15 | +if WITH_INST_LAT | |
| 16 | + OPT_LAT = -DWITH_INST_LAT | |
| 17 | + INC_LAT = -I$(top_srcdir)/inst/lat/pyext | |
| 18 | +endif | |
| 19 | +INC_INST = $(INC_CTA) $(INC_LAT) | |
| 20 | +OPT_INST = $(OPT_CTA) $(OPT_LAT) | |
| 21 | + | |
| 12 | 22 | all-local: gammalib_wrap.cpp gammalib.py |
| 13 | 23 | $(PYTHON) setup.py build --build-platlib build |
| 14 | 24 | |
| ... | ... | @@ -19,12 +29,10 @@ clean-local: |
| 19 | 29 | rm -rf build |
| 20 | 30 | |
| 21 | 31 | gammalib_wrap.cpp gammalib.py: $(SWIG_INTERFACE) |
| 22 | - $(SWIG) -c++ -python -Wall -includeall -I$(top_srcdir)/src -o gammalib_wrap.cpp -outdir . $(srcdir)/$(SWIG_INTERFACE) | |
| 32 | + $(SWIG) -c++ -python -Wall -includeall -I$(top_srcdir)/src $(INC_INST) $(OPT_INST) -o gammalib_wrap.cpp -outdir . $(srcdir)/$(SWIG_INTERFACE) | |
| 23 | 33 | @if test "x`uname`" = "xCygwin"; then \ |
| 24 | 34 | echo "WARNING: working around bug in SWIG on Windows/Cygwin platforms ONLY"; \ |
| 25 | 35 | sed -i.bak -f $(srcdir)/fix_wrapper.sed gammalib_wrap.cpp; \ |
| 26 | 36 | fi |
| 27 | 37 | |
| 28 | 38 | endif # ENABLE_PYTHON_BINDING |
| 29 | -endif # HAVE_PYTHON | |
| 30 | -endif # HAVE_SWIG | ... | ... |
pyext/setup.py.in
| 1 | 1 | from distutils.core import setup, Extension |
| 2 | 2 | import glob |
| 3 | + | |
| 4 | +# Set default include directories and data files | |
| 5 | +include_dirs = ['@top_srcdir@/include'] | |
| 6 | +data_files = glob.glob('@top_srcdir@/pyext/*.i') | |
| 7 | + | |
| 8 | +# Add instrument specific include directories and data files | |
| 9 | +if '@WITH_INST_CTA_TRUE@' != '#': | |
| 10 | + print "Include CTA instrument interface in gammalib Python bindings." | |
| 11 | + include_dirs.append('@top_srcdir@/inst/cta/include') | |
| 12 | + data_files.extend(glob.glob('@top_srcdir@/inst/cta/pyext/*.i')) | |
| 13 | +if '@WITH_INST_LAT_TRUE@' != '#': | |
| 14 | + print "Include Fermi/LAT instrument interface in gammalib Python bindings." | |
| 15 | + include_dirs.append('@top_srcdir@/inst/lat/include') | |
| 16 | + data_files.extend(glob.glob('@top_srcdir@/inst/lat/pyext/*.i')) | |
| 17 | + | |
| 18 | +# Setup | |
| 3 | 19 | setup(name='@PACKAGE_NAME@', |
| 4 | 20 | version='@PACKAGE_VERSION@', |
| 5 | - description='gammalib Python binding', | |
| 21 | + description='gammalib Python bindings', | |
| 6 | 22 | author='Jurgen Knodlseder', |
| 7 | 23 | author_email='@PACKAGE_BUGREPORT@', |
| 8 | 24 | url='http://gammalib.sourceforge.net/', |
| 9 | 25 | py_modules=['gammalib'], |
| 10 | 26 | ext_modules=[Extension('_gammalib', ['gammalib_wrap.cpp'], |
| 11 | - include_dirs=['@top_srcdir@/include', '@top_srcdir@/src', '@top_srcdir@/src/support', '@top_srcdir@/inst/cta/include', '@top_srcdir@/inst/lat/include'], | |
| 27 | + include_dirs=include_dirs, | |
| 12 | 28 | library_dirs=['../src/.libs'], |
| 13 | 29 | libraries=['gamma','cfitsio'], |
| 14 | 30 | runtime_library_dirs=['@prefix@/lib'])], |
| 15 | - data_files=[('@prefix@/share/gammalib/swig', glob.glob('@top_srcdir@/pyext/*.i'))], | |
| 31 | + data_files=[('@prefix@/share/gammalib/swig', data_files)], | |
| 16 | 32 | ) | ... | ... |