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
# also this: https://docs.python.org/2/extending/building.html
import os
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. " )
2017-05-03 08:32:06 +03:00
if ( " LD_LIBRARY_PATH " in os . environ ) :
2017-05-03 08:30:05 +03:00
print ( os . environ [ ' LD_LIBRARY_PATH ' ] . split ( ' : ' ) )
2017-04-19 17:43:24 +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 ' ,
]
2016-03-27 12:56:54 +03:00
qpms_c = Extension ( ' qpms_c ' ,
2017-05-11 04:38:46 +03:00
sources = [ ' qpms/qpms_c.pyx ' , #'qpms/hexpoints_c.pyx',
' 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-03-20 20:46:47 +02:00
' qpms/error.c ' ,
' qpms/bessel.c ' ,
] ,
2019-03-13 22:35:35 +02:00
extra_compile_args = [ ' -std=c99 ' , ' -ggdb ' , ' -O3 ' ,
2017-05-03 08:30:05 +03:00
' -DQPMS_COMPILE_PYTHON_EXTENSIONS ' , # this is required
#'-DQPMS_USE_OMP',
2017-04-26 14:12:29 +03:00
' -DDISABLE_NDEBUG ' , # uncomment to enable assertions in the modules
2017-05-03 08:30:05 +03:00
#'-fopenmp',
2017-04-26 14:12:29 +03:00
] ,
2019-03-18 03:06:04 +02:00
libraries = [ ' gsl ' , ' lapacke ' , ' blas ' , ' gslcblas ' , ' pthread ' , #'omp'
2018-01-15 15:14:15 +02:00
# TODO resolve the problem with openblas (missing gotoblas symbol) and preferable use other blas library
2019-03-20 20:46:47 +02:00
#('amos', dict(sources=amos_sources) ),
2017-05-03 08:43:29 +03:00
] ,
2019-03-20 20:46:47 +02:00
include_dirs = [ ' amos ' ] ,
extra_link_args = [ ' amos/libamos.a ' ] ,
runtime_library_dirs = os . environ [ ' LD_LIBRARY_PATH ' ] . split ( ' : ' ) if ' LD_LIBRARY_PATH ' in os . environ else [ ] ,
#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-03-13 16:23:23 +02:00
version = " 0.2.995 " ,
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-03-02 21:59:00 +02:00
install_requires = [ ' cython>=0.28 ' , ' quaternion ' , ' spherical_functions ' , ' scipy>=0.18.0 ' , ' sympy>=1.2 ' ] ,
2019-02-27 09:45:45 +02:00
dependency_links = [ ' https://github.com/moble/quaternion/archive/v2.0.tar.gz ' , ' https://github.com/moble/spherical_functions/archive/master.zip ' ] ,
2019-03-20 20:46:47 +02:00
ext_modules = cythonize ( [ qpms_c ] , include_path = [ ' qpms ' , ' amos ' ] , gdb_debug = True ) ,
2016-03-27 12:56:54 +03:00
cmdclass = { ' build_ext ' : build_ext } ,
)