1 from setuptools
import setup
#, Extension
2 from Cython
.Build
import cythonize
, build_ext
3 from distutils
.extension
import Extension
4 # setuptools DWIM monkey-patch madness
5 # http://mail.python.org/pipermail/distutils-sig/2007-September/thread.html#8204
7 #if 'setuptools.extension' in sys.modules:
8 # m = sys.modules['setuptools.extension']
9 # m.Extension.__dict__ = m._Extension.__dict__
11 # TODO CHECK THIS OUT http://stackoverflow.com/questions/4056657/what-is-the-easiest-way-to-make-an-optional-c-extension-for-a-python-package
12 # AND THIS https://groups.google.com/forum/#!topic/cython-users/GAAPYb2X304
13 # also this: https://docs.python.org/2/extending/building.html
16 #print("You might want to add additional library path to LD_LIBRARY_PATH (especially if you are not using"
17 # " GNU GSL in your system library path) and if import fails. ")
18 #if("LD_LIBRARY_PATH" in os.environ):
19 # print(os.environ['LD_LIBRARY_PATH'].split(':'))
67 #'qpms/hexpoints_c.pyx',
68 'qpms/gaunt.c',#'qpms/gaunt.h','qpms/vectors.h','qpms/translations.h',
69 # FIXME http://stackoverflow.com/questions/4259170/python-setup-script-extensions-how-do-you-include-a-h-file
70 'qpms/translations.c',
74 'qpms/vswf.c', # FIXME many things from vswf.c are not required by this module, but they have many dependencies (following in this list); maybe I want to move all the "basespec stuff"
85 cycommon
= Extension('qpms.cycommon',
86 sources
= ['qpms/cycommon.pyx'],
87 #extra_link_args=['qpms/libqpms.a'],
88 libraries
=['qpms', 'gsl', 'lapacke', 'blas', 'gslcblas', 'pthread',]
90 cytmatrices
= Extension('qpms.cytmatrices',
91 sources
= ['qpms/cytmatrices.pyx'],
92 #extra_link_args=['qpms/libqpms.a', 'amos/libamos.a'],
93 libraries
=['qpms', 'gsl', 'lapacke', 'blas', 'gslcblas', 'pthread',]
95 cywaves
= Extension('qpms.cywaves',
96 sources
= ['qpms/cywaves.pyx'],
97 libraries
=['qpms', 'gsl', 'lapacke', 'blas', 'gslcblas', 'pthread',]
99 cytranslations
= Extension('qpms.cytranslations',
100 sources
= ['qpms/cytranslations.pyx',
101 'qpms/translations_python.c',
103 extra_compile_args
=['-std=c99',
104 '-DQPMS_COMPILE_PYTHON_EXTENSIONS', # This is needed to enable it in translations.h
106 #extra_link_args=['qpms/libqpms.a', 'amos/libamos.a'],
107 libraries
=['qpms', 'gsl', 'lapacke', 'blas', 'gslcblas', 'pthread',]
109 cybspec
= Extension('qpms.cybspec',
110 sources
= ['qpms/cybspec.pyx'],
111 #extra_link_args=['qpms/libqpms.a'],
112 libraries
=['qpms', 'gsl', 'lapacke', 'blas', 'gslcblas', 'pthread',]
114 cymaterials
= Extension('qpms.cymaterials',
115 sources
= ['qpms/cymaterials.pyx'],
116 #extra_link_args=['qpms/libqpms.a'],
117 libraries
=['qpms', 'gsl', 'lapacke', 'blas', 'gslcblas', 'pthread',]
119 cyquaternions
= Extension('qpms.cyquaternions',
120 sources
= ['qpms/cyquaternions.pyx'],
121 #extra_link_args=['amos/libamos.a', 'qpms/libqpms.a'],
122 libraries
=['qpms', 'gsl', 'lapacke', 'blas', 'gslcblas', 'pthread',]
124 cyewaldtest
= Extension('qpms.cyewaldtest',
125 sources
= ['qpms/cyewaldtest.pyx'],
126 libraries
=['qpms', 'gsl', 'lapacke', 'blas', 'gslcblas', 'pthread',]
129 qpms_c
= Extension('qpms.qpms_c',
133 libraries
=['qpms', 'gsl', 'lapacke', 'blas', 'gslcblas', 'pthread', #'omp'
134 #('amos', dict(sources=amos_sources) ),
136 include_dirs
=['amos', 'qpms'],
137 extra_link_args
=['-fopenmp'],
138 extra_compile_args
=['-fopenmp'],
139 #extra_link_args=[ 'qpms/libqpms.a','amos/libamos.a', ],
140 #runtime_library_dirs=os.environ['LD_LIBRARY_PATH'].split(':') if 'LD_LIBRARY_PATH' in os.environ else [],
141 #extra_objects = ['amos/libamos.a'], # FIXME apparently, I would like to eliminate the need to cmake/make first
147 # libraries = [('amos', {'sources': amos_sources} )],
148 setup_requires
=['cython>=0.28',],
149 install_requires
=['cython>=0.28',
150 #'quaternion','spherical_functions',
151 'scipy>=0.18.0', 'sympy>=1.2'],
152 #dependency_links=['https://github.com/moble/quaternion/archive/v2.0.tar.gz','https://github.com/moble/spherical_functions/archive/master.zip'],
153 ext_modules
=cythonize([qpms_c
, cywaves
, cytranslations
, cytmatrices
, cycommon
, cyquaternions
, cybspec
, cymaterials
, cyewaldtest
], include_path
=['qpms', 'amos'], gdb_debug
=True),
154 cmdclass
= {'build_ext': build_ext
},