xref: /honee/include/honee.h (revision 4ea616f4b9e156c5dc0183ae10bc12e5088c8c31)
1 // SPDX-FileCopyrightText: Copyright (c) 2017-2024, HONEE contributors.
2 // SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause
3 #pragma once
4 #include <petsc.h>
5 #include <stdbool.h>
6 typedef struct Honee_private *Honee;
7 
8 #define HONEE_VERSION_MAJOR 0
9 #define HONEE_VERSION_MINOR 0
10 #define HONEE_VERSION_PATCH 0
11 #define HONEE_VERSION_RELEASE false
12 /// Compile-time check that the the current library version is at least as
13 /// recent as the specified version. This macro is typically used in
14 /// @code
15 /// #if HONEE_VERSION_GE(0, 1, 0)
16 ///   code path that needs at least 0.1.0
17 /// #else
18 ///   fallback code for older versions
19 /// #endif
20 /// @endcode
21 ///
22 /// A non-release version always compares as positive infinity.
23 ///
24 #define HONEE_VERSION_GE(major, minor, patch) \
25   (!HONEE_VERSION_RELEASE ||                  \
26    (HONEE_VERSION_MAJOR > major ||            \
27     (HONEE_VERSION_MAJOR == major && (HONEE_VERSION_MINOR > minor || (HONEE_VERSION_MINOR == minor && HONEE_VERSION_PATCH >= patch)))))
28 
29 PetscErrorCode HoneeGetVersion(int *major, int *minor, int *patch, PetscBool *release);
30 PetscErrorCode HoneeGetGitVersion(const char **git_version);
31 PetscErrorCode HoneeGetBuildConfiguration(const char **build_config);
32