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