C99 standard compliance for static const initialisers.
[qpms.git] / setup.py
blob29fd31f3304bbea10222f4a6e10f382faefe5679
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
6 #import sys
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
14 import os
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(':'))
23 '''
24 amos_sources = [
25 'amos/d1mach.f',
26 'amos/dgamln.f',
27 'amos/i1mach.f',
28 'amos/xerror.f',
29 'amos/zabs.f',
30 'amos/zacai.f',
31 'amos/zacon.f',
32 'amos/zairy.f',
33 'amos/zasyi.f',
34 'amos/zbesh.f',
35 'amos/zbesi.f',
36 'amos/zbesj.f',
37 'amos/zbesk.f',
38 'amos/zbesy.f',
39 'amos/zbinu.f',
40 'amos/zbiry.f',
41 'amos/zbknu.f',
42 'amos/zbuni.f',
43 'amos/zbunk.f',
44 'amos/zdiv.f',
45 'amos/zexp.f',
46 'amos/zkscl.f',
47 'amos/zlog.f',
48 'amos/zmlri.f',
49 'amos/zmlt.f',
50 'amos/zrati.f',
51 'amos/zs1s2.f',
52 'amos/zseri.f',
53 'amos/zshch.f',
54 'amos/zsqrt.f',
55 'amos/zuchk.f',
56 'amos/zunhj.f',
57 'amos/zuni1.f',
58 'amos/zuni2.f',
59 'amos/zunik.f',
60 'amos/zunk1.f',
61 'amos/zunk2.f',
62 'amos/zuoik.f',
63 'amos/zwrsk.f',
66 libqpms_sources = [
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',
71 'qpms/symmetries.c',
72 'qpms/wigner.c',
73 'qpms/scatsystem.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"
75 'qpms/legendre.c',
76 'qpms/tmatrices.c',
77 'qpms/materials.c',
78 'qpms/error.c',
79 'qpms/bessel.c',
80 'qpms/own_zgemm.c',
81 'qpms/pointgroups.c',
83 '''
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',
130 sources = [
131 'qpms/qpms_c.pyx',
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
144 setup(name='qpms',
145 version = "0.2.996",
146 packages=['qpms'],
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},
155 zip_safe=False