| 1 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst |
| 2 |
|
| 3 |
import os |
| 4 |
|
| 5 |
import numpy as np |
| 6 |
|
| 7 |
HEALPIX_ROOT = os.path.relpath(os.path.dirname(__file__)) |
| 8 |
|
| 9 |
C_FILES = ['bl.c', |
| 10 |
'healpix-utils.c', |
| 11 |
'healpix.c', |
| 12 |
'mathutil.c', |
| 13 |
'permutedsort.c', |
| 14 |
'qsort_reentrant.c', |
| 15 |
'starutil.c'] |
| 16 |
|
| 17 |
|
| 18 |
C_DIR = os.path.join('cextern', 'astrometry.net') |
| 19 |
C_DIRS = [np.get_include(), C_DIR, HEALPIX_ROOT, |
| 20 |
os.path.join('cextern', 'numpy')] |
| 21 |
|
| 22 |
|
| 23 |
def get_extensions(): |
| 24 |
from setuptools import Extension |
| 25 |
|
| 26 |
libraries = [] |
| 27 |
|
| 28 |
sources = [os.path.join(C_DIR, filename) for filename in C_FILES] |
| 29 |
sources.append(os.path.join(HEALPIX_ROOT, 'interpolation.c')) |
| 30 |
sources.append(os.path.join(HEALPIX_ROOT, '_core.c')) |
| 31 |
|
| 32 |
extension = Extension( |
| 33 |
name="astropy_healpix._core", |
| 34 |
sources=sources, |
| 35 |
include_dirs=C_DIRS, |
| 36 |
libraries=libraries, |
| 37 |
language="c", |
| 38 |
extra_compile_args=['-O2'], |
| 39 |
py_limited_api=True, |
| 40 |
define_macros=[('Py_LIMITED_API', 0x030A0000), |
| 41 |
('NPY_TARGET_VERSION', 'NPY_1_19_API_VERSION'), |
| 42 |
('NPY_NO_DEPRECATED_API', 'NPY_1_19_API_VERSION')]) |
| 43 |
|
| 44 |
return [extension] |