meson: Add script to use VERSION file for getting version
Meson has up until this point set it's version in the root meson.build
script, while the other build systems read the VERSION file. This is
just "one more thing" to duplicate between meson and every other build
system. This script is a simple "read, strip, print" sort of deal to
allow meson to read the VERSION file.
I chose to implement this in python since python is portable, and to
keep the meson.build script clean. This is also complicated by the fact
that the project() call *must* be the first non-comment,non-blank in the
toplevel meson.build script.
v2: - Move from scripts/ to bin/
- use python explicitly to run the scripts to support windows
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
diff --git a/meson.build b/meson.build
index ddd7680..51d19c0 100644
--- a/meson.build
+++ b/meson.build
@@ -21,7 +21,9 @@
project(
'mesa',
['c', 'cpp'],
- version : '17.3.0-devel',
+ version : run_command(
+ [find_program('python', 'python2', 'python3'), 'bin/meson_get_version.py']
+ ).stdout(),
license : 'MIT',
meson_version : '>= 0.42',
default_options : ['buildtype=debugoptimized', 'c_std=c99', 'cpp_std=c++11']