summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2019-11-15 14:26:17 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2020-10-09 09:32:26 +0800
commitc882c281913d37e76ee9b839c5b4845de8094787 (patch)
tree7047fa4aac4921e1067da190d3a9246040dfd593 /meson.build
parent6d053ec0a4108be59f5e30a04ab4e6539e694e53 (diff)
downloadlibpeas-c882c281913d37e76ee9b839c5b4845de8094787.tar.gz
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.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build18
1 files changed, 18 insertions, 0 deletions
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()