xref: /oneTBB/include/oneapi/tbb/version.h (revision bb45f092)
1 /*
2     Copyright (c) 2005-2022 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 9
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 __TBB_STRING(TBB_VERSION_MAJOR) "." __TBB_STRING(TBB_VERSION_MINOR) __TBB_VERSION_SUFFIX
39 
40 // OneAPI oneTBB specification version
41 #define ONETBB_SPEC_VERSION "1.0"
42 // Full interface version
43 #define TBB_INTERFACE_VERSION 12090
44 // Major interface version
45 #define TBB_INTERFACE_VERSION_MAJOR (TBB_INTERFACE_VERSION/1000)
46 // Minor interface version
47 #define TBB_INTERFACE_VERSION_MINOR (TBB_INTERFACE_VERSION%1000/10)
48 
49 // The binary compatibility version
50 // To be used in SONAME, manifests, etc.
51 #define __TBB_BINARY_VERSION 12
52 
53 //! TBB_VERSION support
54 #ifndef ENDL
55 #define ENDL "\n"
56 #endif
57 
58 //TBB_REVAMP_TODO: consider enabling version_string.ver generation
59 //TBB_REVAMP_TODO: #include "version_string.ver"
60 
61 #define __TBB_ONETBB_SPEC_VERSION(N) #N ": SPECIFICATION VERSION\t" ONETBB_SPEC_VERSION ENDL
62 #define __TBB_VERSION_NUMBER(N) #N ": VERSION\t\t" TBB_VERSION_STRING ENDL
63 #define __TBB_INTERFACE_VERSION_NUMBER(N) #N ": INTERFACE VERSION\t" __TBB_STRING(TBB_INTERFACE_VERSION) ENDL
64 
65 #ifndef TBB_USE_DEBUG
66     #define __TBB_VERSION_USE_DEBUG(N) #N ": TBB_USE_DEBUG\tundefined" ENDL
67 #elif TBB_USE_DEBUG==0
68     #define __TBB_VERSION_USE_DEBUG(N) #N ": TBB_USE_DEBUG\t0" ENDL
69 #elif TBB_USE_DEBUG==1
70     #define __TBB_VERSION_USE_DEBUG(N) #N ": TBB_USE_DEBUG\t1" ENDL
71 #elif TBB_USE_DEBUG==2
72     #define __TBB_VERSION_USE_DEBUG(N) #N ": TBB_USE_DEBUG\t2" ENDL
73 #else
74     #error Unexpected value for TBB_USE_DEBUG
75 #endif
76 
77 #ifndef TBB_USE_ASSERT
78     #define __TBB_VERSION_USE_ASSERT(N) #N ": TBB_USE_ASSERT\tundefined" ENDL
79 #elif TBB_USE_ASSERT==0
80     #define __TBB_VERSION_USE_ASSERT(N) #N ": TBB_USE_ASSERT\t0" ENDL
81 #elif TBB_USE_ASSERT==1
82     #define __TBB_VERSION_USE_ASSERT(N) #N ": TBB_USE_ASSERT\t1" ENDL
83 #elif TBB_USE_ASSERT==2
84     #define __TBB_VERSION_USE_ASSERT(N) #N ": TBB_USE_ASSERT\t2" ENDL
85 #else
86     #error Unexpected value for TBB_USE_ASSERT
87 #endif
88 
89 #define TBB_VERSION_STRINGS_P(N)                \
90     __TBB_ONETBB_SPEC_VERSION(N)                \
91     __TBB_VERSION_NUMBER(N)                     \
92     __TBB_INTERFACE_VERSION_NUMBER(N)           \
93     __TBB_VERSION_USE_DEBUG(N)                  \
94     __TBB_VERSION_USE_ASSERT(N)
95 
96 #define TBB_VERSION_STRINGS TBB_VERSION_STRINGS_P(oneTBB)
97 #define TBBMALLOC_VERSION_STRINGS TBB_VERSION_STRINGS_P(TBBmalloc)
98 
99 //! The function returns the version string for the Intel(R) oneAPI Threading Building Blocks (oneTBB)
100 //! shared library being used.
101 /**
102  * The returned pointer is an address of a string in the shared library.
103  * It can be different than the TBB_VERSION_STRING obtained at compile time.
104  */
105 extern "C" TBB_EXPORT const char* __TBB_EXPORTED_FUNC TBB_runtime_version();
106 
107 //! The function returns the interface version of the oneTBB shared library being used.
108 /**
109  * The returned version is determined at runtime, not at compile/link time.
110  * It can be different than the value of TBB_INTERFACE_VERSION obtained at compile time.
111  */
112 extern "C" TBB_EXPORT int __TBB_EXPORTED_FUNC TBB_runtime_interface_version();
113 
114 #endif // __TBB_version_H
115