[pangomm/meson.msvc: 1/4] Meson builds: Improve Python and GIT check on MSVC builds
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pangomm/meson.msvc: 1/4] Meson builds: Improve Python and GIT check on MSVC builds
- Date: Tue, 15 Oct 2019 05:16:24 +0000 (UTC)
commit 90808e5368c6a1c14e9f658167765be1f2b6e122
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Thu Sep 19 17:50:41 2019 +0800
Meson builds: Improve Python and GIT check on MSVC builds
Standard Python 3.x binary installers from CPython comes with
python.exe, not python3.exe, so we ought to check for that on MSVC
builds as that is what Meson builds will make use of.
Also, check that we are not attempting to build directly from a GIT
checkout on MSVC, as this is currently not supported as m4 is required,
which is not well supported on a Windows cmd.exe environment.
meson.build | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/meson.build b/meson.build
index 14f1f27..0367a39 100644
--- a/meson.build
+++ b/meson.build
@@ -36,7 +36,16 @@ pangomm_libversion = '@0@.@1@.@2@'.format(
project_source_root = meson.current_source_dir()
project_build_root = meson.current_build_dir()
-python3 = import('python').find_installation('python3')
+cpp_compiler = meson.get_compiler('cpp')
+is_msvc = cpp_compiler.get_id() == 'msvc'
+
+# Standard CPython installations come with python.exe even for Python 3.x
+if is_msvc
+ python3 = import ('python').find_installation('python')
+else
+ python3 = import('python').find_installation('python3')
+endif
+
python_version = python3.language_version()
python_version_req = '>= 3.5'
if not python_version.version_compare(python_version_req)
@@ -51,10 +60,15 @@ import sys
sys.exit(0 if os.path.isdir("@0@") else 1)
'''.format(project_source_root / '.git')
is_git_build = run_command(python3, '-c', cmd_py).returncode() == 0
+
# In Unix-like system, an alternative is
# is_git_build = run_command('test', '-d', project_source_root / '.git').returncode() == 0
# Python code can be used in all operating sytems where Meson can run.
+# Unfortunately due to m4 requirements, we cannot support MSVC builds
+# directly from GIT checkouts
+assert(not is_msvc or not is_git_build, 'Direct builds from GIT is not supported for MSVC builds')
+
# Options.
maintainer_mode_opt = get_option('maintainer-mode')
maintainer_mode = maintainer_mode_opt == 'true' or \
@@ -114,8 +128,6 @@ if maintainer_mode and mm_common_get.found()
project_source_root / 'untracked' / 'docs')
endif
-cpp_compiler = meson.get_compiler('cpp')
-
# Set compiler warnings.
warning_flags = []
if warning_level == 'min'
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]