aboutsummaryrefslogtreecommitdiffstats
path: root/code/editor/editor_libs.h
blob: ce5feefa7ad33d365d7ec7fa6e60baf2382b256c (plain) (blame)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef EDITOR_LIBS_H
#define EDITOR_LIBS_H

#include "base/base_core.h"

#if EDITOR_SLOW_COMPILE
C_LINKAGE_BEGIN
# define GLAD_GL_IMPLEMENTATION
# define STB_IMAGE_IMPLEMENTATION
# define STB_IMAGE_WRITE_IMPLEMENTATION
# define STB_TRUETYPE_IMPLEMENTATION
# define STB_SPRINTF_IMPLEMENTATION
# define EDITOR_FONT_IMPLEMENTATION

# define XXH_STATIC_LINKING_ONLY
# define XXH_IMPLEMENTATION
// TODO(luca): Does not work because firstly, this implies XXH_IMPLEMENTATION and secondly, it will make the function signatures mismatch
//# define XXH_INLINE_ALL

#else
void GLADDisableCallbacks();
void GLADEnableCallbacks();
#endif

NO_WARNINGS_BEGIN
# include "lib/gl_core_3_3_debug.h"
# include "lib/stb_image.h"
# include "lib/stb_image_write.h"
# include "lib/stb_sprintf.h"
# include "lib/stb_truetype.h"
# include "lib/xxHash/xxhash.h"
NO_WARNINGS_END

//~ GLAD helper functions

#if EDITOR_SLOW_COMPILE

void GLADNullPreCallback(const char *name, GLADapiproc apiproc, int len_args, ...) {}
void GLADNullPostCallback(void *ret, const char *name, GLADapiproc apiproc, int len_args, ...) {}

void GLADDisableCallbacks()
{
    _pre_call_gl_callback = GLADNullPreCallback;
    _post_call_gl_callback = GLADNullPostCallback;
}

void GLADEnableCallbacks()
{
    _pre_call_gl_callback = _pre_call_gl_callback_default;
    _post_call_gl_callback = _post_call_gl_callback_default;
}

C_LINKAGE_END
#endif // EDITOR_SLOW_COMPILE

#endif // EDITOR_LIBS_H