summaryrefslogtreecommitdiff
path: root/numpy/_build_utils/gcc_build_bitness.py
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@gmail.com>2022-11-23 23:40:23 +0100
committerRalf Gommers <ralf.gommers@gmail.com>2022-11-25 12:37:46 +0100
commit4002a7d421ff10780c28a3643683af7a9754f87f (patch)
treea06d4c10642d1c93d552f80f1e90f393c9953c18 /numpy/_build_utils/gcc_build_bitness.py
parent632f573f12c641990bfac24cf4df435804340a7f (diff)
downloadnumpy-4002a7d421ff10780c28a3643683af7a9754f87f.tar.gz
BLD: enable building NumPy with Meson
This enables building with NumPy on Linux and macOS. Windows support should be complete to, but is untested as of now and may need a few tweaks. This contains: - A set of `meson.build` files and related code generation script tweaks, header templates, etc. - One CI job on Linux - Basic docs on using Meson to build NumPy (not yet integrated in the html docs, it's too early for that - this is for early adopters right now). The build should be complete, with the major exception of SIMD support. The full test suite passes. See gh-22546 for the tracking issue with detailed notes on the plan for switching NumPy to Meson as its build system. Co-authored-by: Stefan van der Walt <stefanv@berkeley.edu>
Diffstat (limited to 'numpy/_build_utils/gcc_build_bitness.py')
-rw-r--r--numpy/_build_utils/gcc_build_bitness.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/numpy/_build_utils/gcc_build_bitness.py b/numpy/_build_utils/gcc_build_bitness.py
new file mode 100644
index 000000000..fcad237e9
--- /dev/null
+++ b/numpy/_build_utils/gcc_build_bitness.py
@@ -0,0 +1,21 @@
+#!python
+""" Detect bitness (32 or 64) of Mingw-w64 gcc build target on Windows.
+"""
+
+import re
+from subprocess import run, PIPE
+
+
+def main():
+ res = run(['gcc', '-v'], check=True, text=True, capture_output=True)
+ target = re.search(r'^Target: (.*)$', res.stderr, flags=re.M).groups()[0]
+ if target.startswith('i686'):
+ print('32')
+ elif target.startswith('x86_64'):
+ print('64')
+ else:
+ raise RuntimeError('Could not detect Mingw-w64 bitness')
+
+
+if __name__ == "__main__":
+ main()