From c882c281913d37e76ee9b839c5b4845de8094787 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Fri, 15 Nov 2019 14:26:17 +0800 Subject: meson: Improve Python detection on Windows Standard Windows binaries from www.python.org typically come as an MSI installer, which do not include pkg-config files for us, and it is often the case that people have multiple installations of Python on their systems, such as having both 32-bit and 64-bit installations of Python, so we need to go a bit harder to look for Python 2,x/3.x installations, by: -Allow people to explicitly input a full path to their Python 2.x/3.x interpreters, so that the right include/lib paths for the desired Python installation(s) can be discovered and utilized. -If no explicit path is specified, let Meson's Python module look for the installations for us instead. --- meson.build | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'meson.build') diff --git a/meson.build b/meson.build index dfa8004..56aa7c3 100644 --- a/meson.build +++ b/meson.build @@ -11,6 +11,7 @@ project( gnome = import('gnome') i18n = import('i18n') pkg = import('pkgconfig') +pymod = import('python') # Versioning version = meson.project_version() @@ -115,7 +116,24 @@ if not python3_dep.found() python3_dep = dependency('python3', version: python3_req, required: false) endif +if host_machine.system() == 'windows' and not python3_dep.found() + python3 = pymod.find_installation(get_option('python3_path'), + required: false) + if python3.found() + python3_dep = python3.dependency(version: python3_req, required: false) + endif +endif + + python2_dep = dependency('python2', version: python2_req, required: false) +if host_machine.system() == 'windows' and not python2_dep.found() + python2 = pymod.find_installation(get_option('python2_path') != '' ? get_option('python2_path') : 'python2', + required: false) + if python2.found() + python2_dep = python2.dependency(version: python2_req, required: false) + endif +endif + pygobject_dep = dependency('pygobject-3.0', version: pygobject_req, required: false) lua51_dep = dependency('lua51', version: lua_req, required: false) if not lua51_dep.found() -- cgit v1.2.1