summaryrefslogtreecommitdiff
path: root/source/base/base_include.h
blob: 22727f5a52563188cf9a22b918f35b9e2a9a6622 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#ifndef BASE_INCLUDE_H
#define BASE_INCLUDE_H

#if defined(__APPLE__)
#define PLATFORM_APPLE 1
#define PLATFORM_UNIX 1
#elif defined(__linux__)
#define PLATFORM_LINUX 1
#define PLATFORM_UNIX 1
#elif defined(_WIN32)
#define PLATFORM_WINDOWS 1
#else
#error Unsupported platform
#endif // platform definitions

#ifndef PLATFORM_APPLE
#define PLATFORM_APPLE 0
#endif
#ifndef PLATFORM_LINUX
#define PLATFORM_LINUX 0
#endif
#ifndef PLATFORM_UNIX
#define PLATFORM_UNIX 0
#endif
#ifndef PLATFORM_WINDOWS
#define PLATFORM_WINDOWS 0
#endif
#ifndef DEBUG
#define DEBUG 0
#endif
#ifndef X11
#define X11 0
#endif
#ifndef WAYLAND
#define WAYLAND 0
#endif
#ifndef VULKAN
#define VULKAN 0
#endif
#ifndef OPENGL
#define OPENGL 0
#endif

#if PLATFORM_UNIX
#include <unistd.h>
#include <dirent.h>
#include <sys/mman.h>
#include <sys/socket.h> // needed for making a connection to displays (wayland)
#include <sys/stat.h>
#include <sys/un.h>
#include <fcntl.h>
#include <dlfcn.h>

#if PLATFORM_LINUX

#include <linux/input-event-codes.h>

#if X11
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
#elif WAYLAND


#include <wayland-client.h>              // wl_display, wl_surface, wl_seat, wl_keyboard, ... (core protocol)
#include "xdg-shell-client-protocol.h"   // xdg_wm_base, xdg_surface, xdg_toplevel (generated by build.sh)
#include <xkbcommon/xkbcommon.h> // the only types of inputs the server will probably send on wayland
#endif

#endif // PLATFORM_LINUX
#elif PLATFORM_WINDOWS
#define _WIN32_WINNT 0x0601
#include <windows.h>
#endif // PLATFORM_UNIX - PLATFORM_WINDOWS

#if VULKAN
// #include <vulkan/vulkan.h>
#elif OPENGL
...
#endif

//-

#include <time.h>
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include <stdarg.h>
#include <errno.h>

//-
#include "base_core.h"
#include "base_memory.h"

#include "base_arena.h"
#include "base_stack.h"
#include "base_string.h"
#include "base_platform.h"
#include "base_render.h"

#include "base_memory.cpp"
#include "base_arena.cpp"
#include "base_stack.cpp"
#include "base_string.cpp"

#if PLATFORM_LINUX
#include "base_platform_linux.cpp"
#elif PLATFORM_WINDOWS
#include "base_platform_win32.cpp"
#endif

#include "base_rand.cpp"
#include "base_simd.cpp"

#if VULKAN

#include "base_render_vulkan.cpp"
#endif

#endif // BASE_INCLUDE_H