From 2a2a4d19c545aed85dfb541e8b0a5ccbe4b1deb7 Mon Sep 17 00:00:00 2001 From: Vitalii Shylienkov Date: Mon, 13 Apr 2020 12:47:07 +0200 Subject: [PATCH] meson: supports version - generate version header --- meson.build | 3 ++- src/meson.build | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 968e5b1..33d5887 100644 --- a/meson.build +++ b/meson.build @@ -7,7 +7,8 @@ project('unity', 'c', license: 'MIT', meson_version: '>=0.53.0', - default_options: ['layout=flat', 'warning_level=3', 'werror=true', 'c_std=c11'] + default_options: ['layout=flat', 'warning_level=3', 'werror=true', 'c_std=c11'], + version: '2.5.0' ) lang = 'c' cc = meson.get_compiler(lang) diff --git a/src/meson.build b/src/meson.build index 7ede15a..19e7bd8 100644 --- a/src/meson.build +++ b/src/meson.build @@ -4,6 +4,15 @@ # # license: MIT # +conf_data = configuration_data() +conf_data.set('PROJECT_VERSION', meson.project_version()) +conf_data.set('PROJECT_VERSION_MAJOR',meson.project_version().split('.')[0]) +conf_data.set('PROJECT_VERSION_MINOR',meson.project_version().split('.')[1]) +conf_data.set('PROJECT_VERSION_PATCH',meson.project_version().split('.')[2]) +unity_version_template = join_paths(meson.source_root(), 'cmake/templates/unity_version.h.in') +unity_version_file =configure_file(input : unity_version_template, + output : 'unity_version.h', + configuration : conf_data) unity_dir = include_directories('.') unity_lib = static_library(meson.project_name(),