MapLibre Native Core
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
util.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #ifndef NDEBUG
4 
5 #include <thread>
6 #define MBGL_STORE_THREAD(tid) const std::thread::id tid = std::this_thread::get_id();
7 #define MBGL_VERIFY_THREAD(tid) assert(tid == std::this_thread::get_id());
8 
9 #else
10 
11 #define MBGL_STORE_THREAD(tid)
12 #define MBGL_VERIFY_THREAD(tid)
13 
14 #endif
15 
16 // GCC 4.9 compatibility
17 #if !defined(__GNUC__) || __GNUC__ >= 5
18 #define MBGL_CONSTEXPR constexpr
19 #else
20 #define MBGL_CONSTEXPR inline
21 #endif
22 
23 // Compiler defines for making symbols visible, otherwise they
24 // will be defined as hidden by default.
25 
26 // clang-format off
27 #if defined WIN32
28  #ifdef MBGL_BUILDING_LIB
29  #ifdef __GNUC__
30  #define MBGL_EXPORT __attribute__((dllexport))
31  #else
32  #define MBGL_EXPORT __declspec(dllexport)
33  #endif
34  #else
35  #ifdef __GNUC__
36  #define MBGL_EXPORT __attribute__((dllimport))
37  #else
38  #define MBGL_EXPORT __declspec(dllimport)
39  #endif
40  #endif
41 #else
42  #define MBGL_EXPORT __attribute__((visibility ("default"))) // NOLINT
43 #endif
44 // clang-format on