[Meson] Use python3-embed when the version of given python3 is 3.8
authorWook Song <wook16.song@samsung.com>
Mon, 7 Sep 2020 05:45:18 +0000 (14:45 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Wed, 23 Sep 2020 23:58:19 +0000 (08:58 +0900)
python3.pc no longer provides the Libs section required to use Python
C-API since v3.8. To resolve it, this patch modifies the meson build
script to change a dependency declaration on python3 to python3-embed
when the version of a given python is upper than v3.8.

Signed-off-by: Wook Song <wook16.song@samsung.com>
meson.build

index 0653f1c..86ba476 100644 (file)
@@ -355,7 +355,10 @@ endif
 # Check python 3.x
 python3_dep = dependency('python3', required: get_option('python3-support'))
 if python3_dep.found()
-
+  if python3_dep.version().version_compare('>= 3.8')
+    # The name of .pc file provides C/CXX/LD_FLAGS for Python C API has been changed since v3.8
+    python3_dep = dependency('python3-embed', required: get_option('python3-support'))
+  endif
   python3_inc_args = []
   python3_inc_args += run_command(pg_pkgconfig, ['python3', '--cflags']).stdout().strip().split()
   python3_inc_args += run_command('python3', ['-c', 'import site\nfor i in site.getsitepackages(): print("-I" + i + "/numpy/core/include")']).stdout().strip().split()