2016-03-27 12:56:54 +03:00
from setuptools import setup #, Extension
2019-02-18 14:42:44 +02:00
from Cython . Build import cythonize , build_ext
2016-03-27 12:56:54 +03:00
from distutils . extension import Extension
# setuptools DWIM monkey-patch madness
# http://mail.python.org/pipermail/distutils-sig/2007-September/thread.html#8204
#import sys
#if 'setuptools.extension' in sys.modules:
# m = sys.modules['setuptools.extension']
# m.Extension.__dict__ = m._Extension.__dict__
2017-04-19 17:43:24 +03:00
# TODO CHECK THIS OUT http://stackoverflow.com/questions/4056657/what-is-the-easiest-way-to-make-an-optional-c-extension-for-a-python-package
2019-08-10 08:08:16 +03:00
# AND THIS https://groups.google.com/forum/#!topic/cython-users/GAAPYb2X304
2017-04-19 17:43:24 +03:00
# also this: https://docs.python.org/2/extending/building.html
import os
2019-08-10 08:08:16 +03:00
#print("You might want to add additional library path to LD_LIBRARY_PATH (especially if you are not using"
# " GNU GSL in your system library path) and if import fails. ")
#if("LD_LIBRARY_PATH" in os.environ):
# print(os.environ['LD_LIBRARY_PATH'].split(':'))
2017-04-19 17:43:24 +03:00
2019-03-20 20:46:47 +02:00
2019-08-10 08:08:16 +03:00
'''
2019-03-20 20:46:47 +02:00
amos_sources = [
' amos/d1mach.f ' ,
' amos/dgamln.f ' ,
' amos/i1mach.f ' ,
' amos/xerror.f ' ,
' amos/zabs.f ' ,
' amos/zacai.f ' ,
' amos/zacon.f ' ,
' amos/zairy.f ' ,
' amos/zasyi.f ' ,
' amos/zbesh.f ' ,
' amos/zbesi.f ' ,
' amos/zbesj.f ' ,
' amos/zbesk.f ' ,
' amos/zbesy.f ' ,
' amos/zbinu.f ' ,
' amos/zbiry.f ' ,
' amos/zbknu.f ' ,
' amos/zbuni.f ' ,
' amos/zbunk.f ' ,
' amos/zdiv.f ' ,
' amos/zexp.f ' ,
' amos/zkscl.f ' ,
' amos/zlog.f ' ,
' amos/zmlri.f ' ,
' amos/zmlt.f ' ,
' amos/zrati.f ' ,
' amos/zs1s2.f ' ,
' amos/zseri.f ' ,
' amos/zshch.f ' ,
' amos/zsqrt.f ' ,
' amos/zuchk.f ' ,
' amos/zunhj.f ' ,
' amos/zuni1.f ' ,
' amos/zuni2.f ' ,
' amos/zunik.f ' ,
' amos/zunk1.f ' ,
' amos/zunk2.f ' ,
' amos/zuoik.f ' ,
' amos/zwrsk.f ' ,
]
2019-08-10 08:08:16 +03:00
libqpms_sources = [
2019-08-09 21:54:13 +03:00
#'qpms/hexpoints_c.pyx',
2017-05-11 04:38:46 +03:00
' qpms/gaunt.c ' , #'qpms/gaunt.h','qpms/vectors.h','qpms/translations.h',
2017-04-19 17:43:24 +03:00
# FIXME http://stackoverflow.com/questions/4259170/python-setup-script-extensions-how-do-you-include-a-h-file
2019-02-22 08:22:56 +02:00
' qpms/translations.c ' ,
2019-02-26 00:40:41 +02:00
' qpms/symmetries.c ' ,
2019-03-03 02:30:12 +02:00
' qpms/wigner.c ' ,
' qpms/scatsystem.c ' ,
' 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"
2019-03-06 23:05:52 +02:00
' qpms/legendre.c ' ,
2019-03-18 15:04:21 +02:00
' qpms/tmatrices.c ' ,
2019-08-08 15:33:06 +03:00
' qpms/materials.c ' ,
2019-03-20 20:46:47 +02:00
' qpms/error.c ' ,
' qpms/bessel.c ' ,
2019-03-29 13:17:28 +02:00
' qpms/own_zgemm.c ' ,
2019-07-24 18:26:12 +03:00
' qpms/pointgroups.c ' ,
2019-08-10 08:08:16 +03:00
]
'''
cycommon = Extension ( ' qpms.cycommon ' ,
sources = [ ' qpms/cycommon.pyx ' ] ,
2019-08-12 16:33:54 +03:00
#extra_link_args=['qpms/libqpms.a'],
libraries = [ ' qpms ' , ' gsl ' , ' lapacke ' , ' blas ' , ' gslcblas ' , ' pthread ' , ]
2019-08-10 08:56:23 +03:00
)
2019-08-10 09:55:50 +03:00
cytmatrices = Extension ( ' qpms.cytmatrices ' ,
sources = [ ' qpms/cytmatrices.pyx ' ] ,
2019-08-12 16:33:54 +03:00
#extra_link_args=['qpms/libqpms.a', 'amos/libamos.a'],
libraries = [ ' qpms ' , ' gsl ' , ' lapacke ' , ' blas ' , ' gslcblas ' , ' pthread ' , ]
2019-08-10 09:55:50 +03:00
)
2019-08-14 11:04:42 +03:00
cywaves = Extension ( ' qpms.cywaves ' ,
sources = [ ' qpms/cywaves.pyx ' ] ,
libraries = [ ' qpms ' , ' gsl ' , ' lapacke ' , ' blas ' , ' gslcblas ' , ' pthread ' , ]
)
2019-08-10 08:56:23 +03:00
cytranslations = Extension ( ' qpms.cytranslations ' ,
sources = [ ' qpms/cytranslations.pyx ' ,
' qpms/translations_python.c ' ,
] ,
extra_compile_args = [ ' -std=c99 ' ,
' -DQPMS_COMPILE_PYTHON_EXTENSIONS ' , # This is needed to enable it in translations.h
] ,
2019-08-12 16:33:54 +03:00
#extra_link_args=['qpms/libqpms.a', 'amos/libamos.a'],
libraries = [ ' qpms ' , ' gsl ' , ' lapacke ' , ' blas ' , ' gslcblas ' , ' pthread ' , ]
2019-08-10 08:08:16 +03:00
)
cybspec = Extension ( ' qpms.cybspec ' ,
sources = [ ' qpms/cybspec.pyx ' ] ,
2019-08-12 16:33:54 +03:00
#extra_link_args=['qpms/libqpms.a'],
libraries = [ ' qpms ' , ' gsl ' , ' lapacke ' , ' blas ' , ' gslcblas ' , ' pthread ' , ]
2019-08-10 08:08:16 +03:00
)
2019-08-10 09:20:39 +03:00
cymaterials = Extension ( ' qpms.cymaterials ' ,
sources = [ ' qpms/cymaterials.pyx ' ] ,
2019-08-12 16:33:54 +03:00
#extra_link_args=['qpms/libqpms.a'],
libraries = [ ' qpms ' , ' gsl ' , ' lapacke ' , ' blas ' , ' gslcblas ' , ' pthread ' , ]
2019-08-10 09:20:39 +03:00
)
2019-08-10 08:08:16 +03:00
cyquaternions = Extension ( ' qpms.cyquaternions ' ,
sources = [ ' qpms/cyquaternions.pyx ' ] ,
2019-08-12 16:33:54 +03:00
#extra_link_args=['amos/libamos.a', 'qpms/libqpms.a'],
libraries = [ ' qpms ' , ' gsl ' , ' lapacke ' , ' blas ' , ' gslcblas ' , ' pthread ' , ]
2019-08-10 08:08:16 +03:00
)
qpms_c = Extension ( ' qpms.qpms_c ' ,
sources = [
' qpms/qpms_c.pyx ' ,
2019-03-20 20:46:47 +02:00
] ,
2019-08-12 16:33:54 +03:00
libraries = [ ' qpms ' , ' gsl ' , ' lapacke ' , ' blas ' , ' gslcblas ' , ' pthread ' , #'omp'
2019-03-20 20:46:47 +02:00
#('amos', dict(sources=amos_sources) ),
2017-05-03 08:43:29 +03:00
] ,
2019-08-10 08:08:16 +03:00
include_dirs = [ ' amos ' , ' qpms ' ] ,
2019-08-12 16:33:54 +03:00
#extra_link_args=[ 'qpms/libqpms.a','amos/libamos.a', ],
2019-08-10 08:08:16 +03:00
#runtime_library_dirs=os.environ['LD_LIBRARY_PATH'].split(':') if 'LD_LIBRARY_PATH' in os.environ else [],
2019-03-20 20:46:47 +02:00
#extra_objects = ['amos/libamos.a'], # FIXME apparently, I would like to eliminate the need to cmake/make first
2017-04-19 17:43:24 +03:00
)
2016-03-27 12:56:54 +03:00
setup ( name = ' qpms ' ,
2019-08-10 08:08:16 +03:00
version = " 0.2.996 " ,
2016-03-27 12:56:54 +03:00
packages = [ ' qpms ' ] ,
2019-03-20 20:46:47 +02:00
# libraries = [('amos', {'sources': amos_sources} )],
2019-02-27 10:44:58 +02:00
setup_requires = [ ' cython>=0.28 ' , ] ,
2019-07-21 23:37:25 +03:00
install_requires = [ ' cython>=0.28 ' ,
#'quaternion','spherical_functions',
' scipy>=0.18.0 ' , ' sympy>=1.2 ' ] ,
#dependency_links=['https://github.com/moble/quaternion/archive/v2.0.tar.gz','https://github.com/moble/spherical_functions/archive/master.zip'],
2019-08-14 11:04:42 +03:00
ext_modules = cythonize ( [ qpms_c , cywaves , cytranslations , cytmatrices , cycommon , cyquaternions , cybspec , cymaterials ] , include_path = [ ' qpms ' , ' amos ' ] , gdb_debug = True ) ,
2016-03-27 12:56:54 +03:00
cmdclass = { ' build_ext ' : build_ext } ,
2019-08-10 08:08:16 +03:00
zip_safe = False
2016-03-27 12:56:54 +03:00
)