Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLD: Adding spatial to Meson build #28

Merged
merged 11 commits into from
Jun 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ scipy/sparse/sparsetools/csr_impl.h
scipy/sparse/sparsetools/other_impl.h
scipy/sparse/sparsetools/sparsetools_impl.h
scipy/spatial/ckdtree.cxx
scipy/spatial/ckdtree.cpp
scipy/spatial/ckdtree.h
scipy/spatial/_hausdorff.c
scipy/spatial/qhull.c
Expand Down
1 change: 1 addition & 0 deletions mesondev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ python -c "from scipy.sparse import csgraph as s; s.test()"
# python -c "from scipy import optimize as s; s.test()" # relies on sparse.linalg
# python -c "from scipy import stats as s; s.test()" # relies on spatial
# python -c "from scipy import special as s; s.test()" # relies on spatial
# python -c "from scipy import spatial as s; s.test()" # failing due to bug in scipy.linalg._decom_update
popd

# Notes:
Expand Down
1 change: 1 addition & 0 deletions scipy/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ subdir('stats')
subdir('fft')
subdir('_lib')
subdir('special')
subdir('spatial')
subdir('cluster')
subdir('constants')
subdir('fftpack')
Expand Down
120 changes: 120 additions & 0 deletions scipy/spatial/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
_spatial_pxd = custom_target('_spatial_pxd',
output : ['qhull.pxd', 'setlist.pxd'],
input : ['qhull.pxd', 'setlist.pxd'],
command : ['cp', '@INPUT@', '-t', '@OUTDIR@'],
)

qhull_src = ['qhull_src/src/poly_r.c',
'qhull_src/src/stat_r.c',
'qhull_src/src/merge_r.c',
'qhull_src/src/userprintf_r.c',
'qhull_src/src/userprintf_rbox_r.c',
'qhull_src/src/usermem_r.c',
'qhull_src/src/geom_r.c',
'qhull_src/src/libqhull_r.c',
'qhull_src/src/user_r.c',
'qhull_src/src/random_r.c',
'qhull_src/src/geom2_r.c',
'qhull_src/src/mem_r.c',
'qhull_src/src/global_r.c',
'qhull_src/src/poly2_r.c',
'qhull_src/src/io_r.c',
'qhull_src/src/rboxlib_r.c',
'qhull_src/src/qset_r.c']

qhull = py3.extension_module('qhull',
['qhull.pyx', 'qhull_misc.h', 'qhull_misc.c'] + qhull_src,
c_args: '-Wno-cpp',
include_directories: [incdir_numpy, '../_lib', '../_build_utils/src', 'qhull_src/src'],
dependencies: [py3_dep, lapack],
czgdp1807 marked this conversation as resolved.
Show resolved Hide resolved
install : true,
subdir : 'scipy/spatial')

ckdtree_src = ['ckdtree/src/query.cxx',
'ckdtree/src/build.cxx',
'ckdtree/src/query_pairs.cxx',
'ckdtree/src/count_neighbors.cxx',
'ckdtree/src/query_ball_point.cxx',
'ckdtree/src/query_ball_tree.cxx',
'ckdtree/src/sparse_distances.cxx']

ckdtree_cpp = custom_target('ckdtree_cpp',
output : 'ckdtree.cpp',
input : 'ckdtree.pyx',
command : [cython, '--cplus', '-3', '--fast-fail', '@INPUT@', '-o', '@OUTPUT@']
)

cpp_args = []
compiler = meson.get_compiler('cpp')
if compiler.get_id() == 'msvc'
cpp_args = cpp_args + ['/EHsc']
elif compiler.has_argument('-fvisibility=hidden')
cpp_args = cpp_args + ['-fvisibility=hidden']
endif

ckdtree = py3.extension_module('ckdtree',
ckdtree_src + [ckdtree_cpp],
cpp_args: cpp_args + ['-Wno-cpp'], # TODO: replace with numpy_nodepr_api
include_directories: [incdir_numpy, '../_lib', '../_build_utils/src', 'ckdtree/src'],
dependencies: [py3_dep],
install : true,
subdir : 'scipy/spatial')
czgdp1807 marked this conversation as resolved.
Show resolved Hide resolved

_distance_wrap = py3.extension_module('_distance_wrap',
'src/distance_wrap.c',
c_args: '-Wno-cpp', # TODO: replace with numpy_nodepr_api
include_directories: [incdir_numpy, '../_lib'],
dependencies: [py3_dep, npymath_lib],
install : true,
subdir : 'scipy/spatial')

_distance_pybind = py3.extension_module('_distance_pybind',
['src/distance_pybind.cpp'],
cpp_args: cpp_args + [numpy_nodepr_api],
include_directories: [incdir_pybind11, incdir_numpy, 'src/'],
dependencies: [py3_dep],
install : true,
subdir : 'scipy/spatial')

_voronoi = py3.extension_module('_voronoi',
['_voronoi.pyx'],
c_args: numpy_nodepr_api,
include_directories: [incdir_numpy],
dependencies: [py3_dep],
install : true,
subdir : 'scipy/spatial')

_hausdorff = py3.extension_module('_hausdorff',
['_hausdorff.pyx'],
c_args: numpy_nodepr_api,
include_directories: [incdir_numpy],
dependencies: [py3_dep],
install : true,
subdir : 'scipy/spatial')

py3.install_sources(['qhull_src/COPYING.txt'],
pure: false,
subdir: 'scipy/spatial/qhull_src'
)

py3.install_sources(['qhull.pyi',
'_voronoi.pyi',
'ckdtree.pyi',
'distance.pyi'],
pure: false,
subdir: 'scipy/spatial'
)

py3.install_sources(['__init__.py',
'distance.py',
'_geometric_slerp.py',
'_procrustes.py',
'kdtree.py',
'_spherical_voronoi.py',
'_plotutils.py'],
pure: false,
subdir: 'scipy/spatial'
)

subdir('tests')
subdir('transform')
czgdp1807 marked this conversation as resolved.
Show resolved Hide resolved
47 changes: 47 additions & 0 deletions scipy/spatial/tests/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
py3.install_sources(['__init__.py',
'test__plotutils.py',
'test_kdtree.py',
'test_hausdorff.py',
'test__procrustes.py',
'test_spherical_voronoi.py',
'test_slerp.py',
'test_distance.py',
'test_qhull.py'],
pure: false,
subdir: 'scipy/spatial/tests'
)

py3.install_sources(['data/pdist-spearman-ml.txt',
'data/pdist-boolean-inp.txt',
'data/pdist-minkowski-5.8-ml-iris.txt',
'data/selfdual-4d-polytope.txt',
'data/pdist-euclidean-ml-iris.txt',
'data/pdist-correlation-ml.txt',
'data/pdist-double-inp.txt',
'data/random-uint-data.txt',
'data/random-bool-data.txt',
'data/iris.txt',
'data/random-int-data.txt',
'data/pdist-jaccard-ml.txt',
'data/pdist-seuclidean-ml.txt',
'data/pdist-euclidean-ml.txt',
'data/pdist-cosine-ml.txt',
'data/pdist-chebyshev-ml.txt',
'data/pdist-minkowski-3.2-ml.txt',
'data/pdist-cityblock-ml.txt',
'data/pdist-seuclidean-ml-iris.txt',
'data/pdist-jensenshannon-ml.txt',
'data/cdist-X1.txt',
'data/pdist-chebyshev-ml-iris.txt',
'data/degenerate_pointset.npz',
'data/pdist-correlation-ml-iris.txt',
'data/pdist-minkowski-3.2-ml-iris.txt',
'data/pdist-hamming-ml.txt',
'data/random-double-data.txt',
'data/cdist-X2.txt',
'data/pdist-cosine-ml-iris.txt',
'data/pdist-jensenshannon-ml-iris.txt',
'data/pdist-cityblock-ml-iris.txt'],
pure: false,
subdir: 'scipy/spatial/tests/data'
)
czgdp1807 marked this conversation as resolved.
Show resolved Hide resolved
24 changes: 24 additions & 0 deletions scipy/spatial/transform/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
rotation = py3.extension_module('rotation',
['rotation.pyx'],
c_args: '-Wno-cpp', # TODO: replace with numpy_nodepr_api
include_directories: [incdir_numpy],
dependencies: [py3_dep],
install: true,
subdir: 'scipy/spatial/transform')

py3.install_sources(
'rotation.pyi',
pure: false,
subdir: 'scipy/spatial/transform'
)

py3.install_sources(
['__init__.py',
'_rotation_groups.py',
'_rotation_spline.py'
],
pure: false,
subdir: 'scipy/spatial/transform'
)

subdir('tests')
7 changes: 7 additions & 0 deletions scipy/spatial/transform/tests/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
py3.install_sources(['__init__.py',
'test_rotation.py',
'test_rotation_groups.py',
'test_rotation_spline.py'],
pure: false,
subdir: 'scipy/spatial/transform/tests'
)
czgdp1807 marked this conversation as resolved.
Show resolved Hide resolved