aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-02-05 14:32:05 +0100
committerDrew DeVault <sir@cmpwn.com>2019-02-11 10:15:00 -0500
commit9346ed1805dab798fe9f6edcb47e003081722d79 (patch)
treea8dccb095e9c53a413fb15764f9777a8ef1884bf /meson.build
parent41e10db0de243c903e28ae8f0b669ff681974e69 (diff)
downloadsway-9346ed1805dab798fe9f6edcb47e003081722d79.zip
sway-9346ed1805dab798fe9f6edcb47e003081722d79.tar.gz
sway-9346ed1805dab798fe9f6edcb47e003081722d79.tar.bz2
Set version in project file
Let's set the version in the meson file instead of declaring it outside. In case git is installed we use the git hash as version. Instead it isn't (like on a clean build system), let's use the version defined in the project.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build12
1 files changed, 4 insertions, 8 deletions
diff --git a/meson.build b/meson.build
index 766bf01..c50fab1 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,7 @@
project(
'sway',
'c',
+ version: '1.0',
license: 'MIT',
meson_version: '>=0.48.0',
default_options: [
@@ -127,17 +128,12 @@ endif
add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c')
-version = get_option('sway-version')
-if version != ''
- version = '"@0@"'.format(version)
-else
- if not git.found()
- error('git is required to make the version string')
- endif
-
+if git.found()
git_commit_hash = run_command([git.path(), 'describe', '--always', '--tags']).stdout().strip()
git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 'HEAD']).stdout().strip()
version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(git_commit_hash, git_branch)
+else
+ version = '"@0@"'.format(meson.project_version())
endif
add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c')