1 /** @addtogroup utility
2  *  @{
3  */
4 #pragma once
5 
6 #include "config.h"
7 
8 #include <stddef.h>
9 #include <stdint.h>
10 
11 #include "cident.h"
12 
13 #define KFR_VERSION_MAJOR 4
14 #define KFR_VERSION_MINOR 2
15 #define KFR_VERSION_PATCH 0
16 #define KFR_VERSION_LABEL ""
17 
18 #define KFR_VERSION_STRING                                                                                   \
19     CMT_STRINGIFY(KFR_VERSION_MAJOR)                                                                         \
20     "." CMT_STRINGIFY(KFR_VERSION_MINOR) "." CMT_STRINGIFY(KFR_VERSION_PATCH) KFR_VERSION_LABEL
21 #define KFR_VERSION (KFR_VERSION_MAJOR * 10000 + KFR_VERSION_MINOR * 100 + KFR_VERSION_PATCH)
22 
23 #if defined DEBUG || defined KFR_DEBUG
24 #define KFR_DEBUG_STR " debug"
25 #elif defined NDEBUG || defined KFR_NDEBUG
26 #define KFR_DEBUG_STR " optimized"
27 #else
28 #define KFR_DEBUG_STR ""
29 #endif
30 
31 #define KFR_NATIVE_INTRINSICS 1
32 
33 #if defined CMT_COMPILER_CLANG && !defined CMT_DISABLE_CLANG_EXT
34 #define CMT_CLANG_EXT
35 #endif
36 
37 #ifdef KFR_NATIVE_INTRINSICS
38 #define KFR_BUILD_DETAILS_1 " +in"
39 #else
40 #define KFR_BUILD_DETAILS_1 ""
41 #endif
42 
43 #ifdef CMT_CLANG_EXT
44 #define KFR_BUILD_DETAILS_2 " +ve"
45 #else
46 #define KFR_BUILD_DETAILS_2 ""
47 #endif
48 
49 #define KFR_VERSION_FULL                                                                                     \
50     "KFR " KFR_VERSION_STRING KFR_DEBUG_STR                                                                  \
51     " " CMT_STRINGIFY(CMT_ARCH_NAME) " " CMT_ARCH_BITNESS_NAME " (" CMT_COMPILER_FULL_NAME "/" CMT_OS_NAME   \
52                                      ")" KFR_BUILD_DETAILS_1 KFR_BUILD_DETAILS_2
53 
54 #ifdef __cplusplus
55 namespace kfr
56 {
57 /// @brief KFR version string
58 constexpr inline const char version_string[] = KFR_VERSION_STRING;
59 
60 constexpr inline int version_major = KFR_VERSION_MAJOR;
61 constexpr inline int version_minor = KFR_VERSION_MINOR;
62 constexpr inline int version_patch = KFR_VERSION_PATCH;
63 constexpr inline int version       = KFR_VERSION;
64 
65 /// @brief KFR version string including architecture and compiler name
66 constexpr inline const char version_full[] = KFR_VERSION_FULL;
67 } // namespace kfr
68 #endif
69 
70 #define KFR_INTRINSIC CMT_INTRINSIC
71 #define KFR_MEM_INTRINSIC CMT_MEM_INTRINSIC
72 #ifdef KFR_FUNCTION_IS_INTRINSIC
73 #define KFR_FUNCTION CMT_INTRINSIC
74 #else
75 #define KFR_FUNCTION CMT_FUNCTION
76 #endif
77 #ifdef CMT_NATIVE_F64
78 #define KFR_NATIVE_F64 CMT_NATIVE_F64
79 #endif
80 
81 #if defined CMT_ARCH_ARM && !defined CMT_ARCH_NEON && !defined CMT_FORCE_GENERIC_CPU
82 #error "ARM builds require NEON support. Add -march=native for native build or skip the check with CMT_FORCE_GENERIC_CPU=1"
83 #endif
84 
85 #if defined CMT_ARCH_ARM && !defined CMT_COMPILER_CLANG && !defined CMT_FORCE_NON_CLANG
86 #error "ARM builds require Clang compiler. Disable checking with CMT_FORCE_NON_CLANG"
87 #endif
88