Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a header with the version of xkbcommon #400

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions include/xkbcommon/version.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef _XKBCOMMON_VERSION_H
#define _XKBCOMMON_VERSION_H

#define XKBCOMMON_VERSION_MAJOR @XKBCOMMON_VERSION_MAJOR@
#define XKBCOMMON_VERSION_MINOR @XKBCOMMON_VERSION_MINOR@
#define XKBCOMMON_VERSION_PATCH @XKBCOMMON_VERSION_PATCH@
#define XKBCOMMON_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))
#define XKBCOMMON_VERSION_NUMBER XKBCOMMON_VERSION( \
XKBCOMMON_VERSION_MAJOR, \
XKBCOMMON_VERSION_MINOR, \
XKBCOMMON_VERSION_PATCH )
#define XKBCOMMON_VERSION_STR "@XKBCOMMON_VERSION_STR@"

#endif
17 changes: 17 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
project(
'libxkbcommon',
'c',
# Semantic version MAJOR.MINOR.PATCH, with each component between [0,255].
# See `version_file` below.
version: '1.6.0',
default_options: [
'c_std=c11',
Expand Down Expand Up @@ -256,7 +258,22 @@ libxkbcommon = library(
install: true,
include_directories: include_directories('src', 'include'),
)

# Version header file
version_components = meson.project_version().split('.')
version_file = configure_file(
input: 'include/xkbcommon/version.h.in',
output: 'version.h',
configuration: {
'XKBCOMMON_VERSION_MAJOR': version_components[0],
'XKBCOMMON_VERSION_MINOR': version_components[1],
'XKBCOMMON_VERSION_PATCH': version_components[2],
'XKBCOMMON_VERSION_STR': meson.project_version(),
},
)

install_headers(
version_file,
'include/xkbcommon/xkbcommon.h',
'include/xkbcommon/xkbcommon-compat.h',
'include/xkbcommon/xkbcommon-compose.h',
Expand Down