| 1 |
project('Python extension module', 'c', |
| 2 |
default_options : ['buildtype=release']) |
| 3 |
# Because Windows Python ships only with optimized libs, |
| 4 |
# we must build this project the same way. |
| 5 |
|
| 6 |
py3_mod = import('python3') |
| 7 |
py3 = py3_mod.find_python() |
| 8 |
py3_dep = dependency('python3', required : false) |
| 9 |
cc = meson.get_compiler('c') |
| 10 |
|
| 11 |
# Copy to the builddir so that blaster.py can find the built tachyon module |
| 12 |
# FIXME: We should automatically detect this case and append the correct paths |
| 13 |
# to PYTHONLIBDIR |
| 14 |
blaster_py = configure_file(input : 'blaster.py', |
| 15 |
output : 'blaster.py', |
| 16 |
configuration : configuration_data()) |
| 17 |
|
| 18 |
check_exists = ''' |
| 19 |
import os, sys |
| 20 |
with open(sys.argv[1], 'rb') as f: |
| 21 |
assert(f.read() == b'success') |
| 22 |
''' |
| 23 |
if py3_dep.found() |
| 24 |
message('Detected Python version: ' + py3_dep.version()) |
| 25 |
if py3_dep.version().version_compare('>=3.8') and cc.get_id() == 'msvc' and cc.version().version_compare('<=19.00.24215.1') |
| 26 |
error('MESON_SKIP_TEST: Python modules do not work with Python 3.8 and VS2015 or earlier.') |
| 27 |
endif |
| 28 |
|
| 29 |
subdir('ext') |
| 30 |
|
| 31 |
out_txt = custom_target('tachyon flux', |
| 32 |
input : blaster_py, |
| 33 |
output : 'out.txt', |
| 34 |
command : [py3, '@INPUT@', '-o', '@OUTPUT@'], |
| 35 |
depends : pylib, |
| 36 |
build_by_default: true) |
| 37 |
|
| 38 |
test('flux', py3, args : ['-c', check_exists, out_txt]) |
| 39 |
else |
| 40 |
error('MESON_SKIP_TEST: Python3 libraries not found, skipping test.') |
| 41 |
endif |