summaryrefslogtreecommitdiff
path: root/include/mbgl/util/util.hpp
blob: 178f1cba483f3b4650889086178947ed7994983a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once

#ifndef NDEBUG

#include <thread>
#define MBGL_STORE_THREAD(tid) const std::thread::id tid = std::this_thread::get_id();
#define MBGL_VERIFY_THREAD(tid) assert(tid == std::this_thread::get_id());

#else

#define MBGL_STORE_THREAD(tid)
#define MBGL_VERIFY_THREAD(tid)

#endif

// GCC 4.9 compatibility
#if !defined(__GNUC__) || __GNUC__ >= 5
#define MBGL_CONSTEXPR constexpr
#else
#define MBGL_CONSTEXPR inline
#endif

// Compiler defines for making symbols visible, otherwise they
// will be defined as hidden by default.

#if defined WIN32
    #ifdef MBGL_BUILDING_LIB
        #ifdef __GNUC__
            #define MBGL_EXPORT __attribute__((dllexport))
        #else
            #define MBGL_EXPORT __declspec(dllexport)
        #endif
    #else
        #ifdef __GNUC__
            #define MBGL_EXPORT __attribute__((dllimport))
        #else
            #define MBGL_EXPORT __declspec(dllimport)
        #endif
    #endif
#else
    #define MBGL_EXPORT __attribute__((visibility ("default"))) // NOLINT
#endif