Skip to content

Commit

Permalink
Fix pyarrow detection in the cross-compilation setting
Browse files Browse the repository at this point in the history
  • Loading branch information
xhochy committed Sep 27, 2024
1 parent 73adf54 commit 791b355
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -80,27 +80,31 @@ np_dep = declare_dependency(include_directories: inc_np, compile_args: numpy_nod

incdir_pyarrow = meson.get_external_property('pyarrow-include-dir', 'not-given')
if incdir_pyarrow == 'not-given'
incdir_pyarrow = run_command(py,
[
'-c',
'''import os
import pyarrow as pa
try:
incdir = os.path.relpath(pa.get_include())
except Exception:
incdir = pa.get_include()
print(incdir)
'''
],
check: true
).stdout().strip()

# We do need an absolute path to feed to `cc.find_library` below
_incdir_pyarrow_abs = run_command(py,
['-c', 'import pyarrow; print(pyarrow.get_include())'],
check: true
).stdout().strip()
else
incdir_pyarrow = py.get_path('platlib') + '/pyarrow/include'
_incdir_pyarrow_abs = incdir_pyarrow
# We would rather like to use the following code, but sadly pyarrow (in contrast to numpy)
# does not name the correct directory in a cross-compilation setting.
# incdir_pyarrow = run_command(py,
# [
# '-c',
# '''import os
#import pyarrow as pa
#try:
# incdir = os.path.relpath(pa.get_include())
#except Exception:
# incdir = pa.get_include()
#print(incdir)
# '''
# ],
# check: true
# ).stdout().strip()
#
# # We do need an absolute path to feed to `cc.find_library` below
# _incdir_pyarrow_abs = run_command(py,
# ['-c', 'import pyarrow; print(pyarrow.get_include())'],
# check: true
# ).stdout().strip()
#else
_incdir_pyarrow_abs = incdir_pyarrow
endif
inc_pa = include_directories(incdir_pyarrow)
Expand Down

0 comments on commit 791b355

Please sign in to comment.