include: Generate and install version-header

This commit is contained in:
Björn Esser 2017-12-27 16:17:09 +01:00
parent 892f7a5db0
commit 48ecbff691
No known key found for this signature in database
GPG key ID: F52E98007594C21D

View file

@ -1,2 +1,11 @@
version_array = meson.project_version().split('.')
version_data = configuration_data()
version_data.set_quoted('WLR_VERSION_STR', meson.project_version())
version_data.set('WLR_VERSION_MAJOR', version_array[0])
version_data.set('WLR_VERSION_MINOR', version_array[1])
version_data.set('WLR_VERSION_MICRO', version_array[2])
version_data.set('WLR_VERSION_NUM', '(WLR_VERSION_MAJOR << 16) | (WLR_VERSION_MINOR << 8) | WLR_VERSION_MICRO')
header_install_dir = 'include/@0@/wlr'.format(meson.project_name())
configure_file(output: 'config.h', install_dir: header_install_dir, configuration: conf_data)
configure_file(output: 'version.h', install_dir: header_install_dir, configuration: version_data)