Skip to content

Commit

Permalink
Use meson cross file for numpy arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
AutonomicPerfectionist committed Oct 24, 2023
1 parent 0769c3d commit a0d8a31
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
14 changes: 13 additions & 1 deletion numpy/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ if ! $PYTHON_BIN_PATH -m pip install --target=$PYTHON_LIB_PATH $TOOLS; then
"$CPYTHON_HOST_PATH/bin/python3.12" -m crossenv "$PYTHON_BIN_PATH" crossenv
source crossenv/bin/activate
cross-expose cython
cross-pip install build pyproject_metadata
chmod +x $CPYTHON_HOST_PATH/lib/python3.12/bin/*
export PATH="$CPYTHON_HOST_PATH/lib/python3.12/bin/:$PATH"
export PYTHON_BIN_PATH="python"
Expand All @@ -120,7 +121,18 @@ case $PLATFORM in
arm-linux-gnueabihf-strip $(find ../ -iname *.so)
;;
linux-arm64)
ATLAS=None CC="aarch64-linux-gnu-gcc -mabi=lp64" CFLAGS="-O2" "$PYTHON_BIN_PATH" -m pip install . --prefix $INSTALL_PATH
#ATLAS=None CC="aarch64-linux-gnu-gcc -mabi=lp64" CFLAGS="-O2" "$PYTHON_BIN_PATH" -m pip install . --prefix $INSTALL_PATH
cp $INSTALL_PATH/../../meson_cross_file.txt.in ${INSTALL_PATH}/meson_cross_file.txt
echo "python = '${PYTHON_BIN_PATH}'" >> ${INSTALL_PATH}/meson_cross_file.txt
echo "c = 'aarch64-linux-gnu-gcc'" >> ${INSTALL_PATH}/meson_cross_file.txt
echo "cpp = 'aarch64-linux-gnu-g++'" >> ${INSTALL_PATH}/meson_cross_file.txt

MESON_ARGS="--cross-file ${INSTALL_PATH}/meson_cross_file.txt"
# -wnx flags mean: --wheel --no-isolation --skip-dependency-check
$PYTHON_BIN_PATH -m build -w -n -x \
-Cbuilddir=builddir \
-Csetup-args=${MESON_ARGS// / -Csetup-args=}

aarch64-linux-gnu-strip $(find ../ -iname *.so)
;;
linux-ppc64le)
Expand Down
11 changes: 11 additions & 0 deletions numpy/meson_cross_file.txt.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[host_machine]
system = 'linux'
cpu_family = 'aarch64'
cpu = 'armv8-a+crypto'
endian = 'little'

[properties]
needs_exe_wrapper = true

[binaries]
exe_wrapper = 'qemu-aarch64'

0 comments on commit a0d8a31

Please sign in to comment.