xref: /oneTBB/include/oneapi/tbb/version.h (revision 3cd37a22)
1 /*
2     Copyright (c) 2005-2023 Intel Corporation
3 
4     Licensed under the Apache License, Version 2.0 (the "License");
5     you may not use this file except in compliance with the License.
6     You may obtain a copy of the License at
7 
8         http://www.apache.org/licenses/LICENSE-2.0
9 
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15 */
16 
17 #ifndef __TBB_version_H
18 #define __TBB_version_H
19 
20 // Exclude all includes during .rc files compilation
21 #ifndef RC_INVOKED
22     #include "detail/_config.h"
23     #include "detail/_namespace_injection.h"
24 #else
25     #define __TBB_STRING_AUX(x) #x
26     #define __TBB_STRING(x) __TBB_STRING_AUX(x)
27 #endif
28 
29 // Product version
30 #define TBB_VERSION_MAJOR 2021
31 // Update version
32 #define TBB_VERSION_MINOR 12
33 // "Patch" version for custom releases
34 #define TBB_VERSION_PATCH 0
35 // Suffix string
36 #define __TBB_VERSION_SUFFIX ""
37 // Full official version string
38 #define TBB_VERSION_STRING              \
39     __TBB_STRING(TBB_VERSION_MAJOR) "." \
40     __TBB_STRING(TBB_VERSION_MINOR) "." \
41     __TBB_STRING(TBB_VERSION_PATCH)     \
42     __TBB_VERSION_SUFFIX
43 
44 // OneAPI oneTBB specification version
45 #define ONETBB_SPEC_VERSION "1.0"
46 // Full interface version
47 #define TBB_INTERFACE_VERSION 12120
48 // Major interface version
49 #define TBB_INTERFACE_VERSION_MAJOR (TBB_INTERFACE_VERSION/1000)
50 // Minor interface version
51 #define TBB_INTERFACE_VERSION_MINOR (TBB_INTERFACE_VERSION%1000/10)
52 
53 // The binary compatibility version
54 // To be used in SONAME, manifests, etc.
55 #define __TBB_BINARY_VERSION 12
56 
57 //! TBB_VERSION support
58 #ifndef TBB_ENDL
59 #define TBB_ENDL "\n"
60 #endif
61 
62 //TBB_REVAMP_TODO: consider enabling version_string.ver generation
63 //TBB_REVAMP_TODO: #include "version_string.ver"
64 
65 #define __TBB_ONETBB_SPEC_VERSION(N) #N ": SPECIFICATION VERSION\t" ONETBB_SPEC_VERSION TBB_ENDL
66 #define __TBB_VERSION_NUMBER(N) #N ": VERSION\t\t" TBB_VERSION_STRING TBB_ENDL
67 #define __TBB_INTERFACE_VERSION_NUMBER(N) #N ": INTERFACE VERSION\t" __TBB_STRING(TBB_INTERFACE_VERSION) TBB_ENDL
68 
69 #ifndef TBB_USE_DEBUG
70     #define __TBB_VERSION_USE_DEBUG(N) #N ": TBB_USE_DEBUG\tundefined" TBB_ENDL
71 #elif TBB_USE_DEBUG==0
72     #define __TBB_VERSION_USE_DEBUG(N) #N ": TBB_USE_DEBUG\t0" TBB_ENDL
73 #elif TBB_USE_DEBUG==1
74     #define __TBB_VERSION_USE_DEBUG(N) #N ": TBB_USE_DEBUG\t1" TBB_ENDL
75 #elif TBB_USE_DEBUG==2
76     #define __TBB_VERSION_USE_DEBUG(N) #N ": TBB_USE_DEBUG\t2" TBB_ENDL
77 #else
78     #error Unexpected value for TBB_USE_DEBUG
79 #endif
80 
81 #ifndef TBB_USE_ASSERT
82     #define __TBB_VERSION_USE_ASSERT(N) #N ": TBB_USE_ASSERT\tundefined" TBB_ENDL
83 #elif TBB_USE_ASSERT==0
84     #define __TBB_VERSION_USE_ASSERT(N) #N ": TBB_USE_ASSERT\t0" TBB_ENDL
85 #elif TBB_USE_ASSERT==1
86     #define __TBB_VERSION_USE_ASSERT(N) #N ": TBB_USE_ASSERT\t1" TBB_ENDL
87 #elif TBB_USE_ASSERT==2
88     #define __TBB_VERSION_USE_ASSERT(N) #N ": TBB_USE_ASSERT\t2" TBB_ENDL
89 #else
90     #error Unexpected value for TBB_USE_ASSERT
91 #endif
92 
93 #define TBB_VERSION_STRINGS_P(N)                \
94     __TBB_ONETBB_SPEC_VERSION(N)                \
95     __TBB_VERSION_NUMBER(N)                     \
96     __TBB_INTERFACE_VERSION_NUMBER(N)           \
97     __TBB_VERSION_USE_DEBUG(N)                  \
98     __TBB_VERSION_USE_ASSERT(N)
99 
100 #define TBB_VERSION_STRINGS TBB_VERSION_STRINGS_P(oneTBB)
101 #define TBBMALLOC_VERSION_STRINGS TBB_VERSION_STRINGS_P(TBBmalloc)
102 
103 //! The function returns the version string for the Intel(R) oneAPI Threading Building Blocks (oneTBB)
104 //! shared library being used.
105 /**
106  * The returned pointer is an address of a string in the shared library.
107  * It can be different than the TBB_VERSION_STRING obtained at compile time.
108  */
109 extern "C" TBB_EXPORT const char* __TBB_EXPORTED_FUNC TBB_runtime_version();
110 
111 //! The function returns the interface version of the oneTBB shared library being used.
112 /**
113  * The returned version is determined at runtime, not at compile/link time.
114  * It can be different than the value of TBB_INTERFACE_VERSION obtained at compile time.
115  */
116 extern "C" TBB_EXPORT int __TBB_EXPORTED_FUNC TBB_runtime_interface_version();
117 
118 #endif // __TBB_version_H
119