1/* Copyright (c) 2018 Ribose Inc.
2 * All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
15 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23 * POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#define RNP_VERSION_MAJOR @RNP_VERSION_MAJOR@
27#define RNP_VERSION_MINOR @RNP_VERSION_MINOR@
28#define RNP_VERSION_PATCH @RNP_VERSION_PATCH@
29
30#define RNP_VERSION_STRING "@RNP_VERSION@"
31#define RNP_VERSION_STRING_FULL "@RNP_VERSION_FULL@"
32
33#define RNP_VERSION_COMMIT_TIMESTAMP @RNP_VERSION_COMMIT_TIMESTAMP@
34
35// using a 32-bit version with 10 bits per component
36#define RNP_VERSION_COMPONENT_MASK 0x3ff
37#define RNP_VERSION_MAJOR_SHIFT 20
38#define RNP_VERSION_MINOR_SHIFT 10
39#define RNP_VERSION_PATCH_SHIFT 0
40#define RNP_VERSION_CODE_FOR(major, minor, patch)                        \
41    (((major & RNP_VERSION_COMPONENT_MASK) << RNP_VERSION_MAJOR_SHIFT) | \
42     ((minor & RNP_VERSION_COMPONENT_MASK) << RNP_VERSION_MINOR_SHIFT) | \
43     ((patch & RNP_VERSION_COMPONENT_MASK) << RNP_VERSION_PATCH_SHIFT))
44
45#define RNP_VERSION_CODE \
46    RNP_VERSION_CODE_FOR(RNP_VERSION_MAJOR, RNP_VERSION_MINOR, RNP_VERSION_PATCH)
47
48static_assert(RNP_VERSION_MAJOR <= RNP_VERSION_COMPONENT_MASK &&
49                RNP_VERSION_MINOR <= RNP_VERSION_COMPONENT_MASK &&
50                RNP_VERSION_PATCH <= RNP_VERSION_COMPONENT_MASK,
51              "version components must be within range");
52
53