rglfw.c (6000B)
1 /********************************************************************************************** 2 * 3 * rglfw - raylib GLFW single file compilation 4 * 5 * This file includes latest GLFW sources (https://github.com/glfw/glfw) to be compiled together 6 * with raylib for all supported platforms, this way, no external dependencies are required. 7 * 8 * LICENSE: zlib/libpng 9 * 10 * Copyright (c) 2017-2024 Ramon Santamaria (@raysan5) 11 * 12 * This software is provided "as-is", without any express or implied warranty. In no event 13 * will the authors be held liable for any damages arising from the use of this software. 14 * 15 * Permission is granted to anyone to use this software for any purpose, including commercial 16 * applications, and to alter it and redistribute it freely, subject to the following restrictions: 17 * 18 * 1. The origin of this software must not be misrepresented; you must not claim that you 19 * wrote the original software. If you use this software in a product, an acknowledgment 20 * in the product documentation would be appreciated but is not required. 21 * 22 * 2. Altered source versions must be plainly marked as such, and must not be misrepresented 23 * as being the original software. 24 * 25 * 3. This notice may not be removed or altered from any source distribution. 26 * 27 **********************************************************************************************/ 28 29 //#define _GLFW_BUILD_DLL // To build shared version 30 // Ref: http://www.glfw.org/docs/latest/compile.html#compile_manual 31 32 // Platform options: 33 // _GLFW_WIN32 to use the Win32 API 34 // _GLFW_X11 to use the X Window System 35 // _GLFW_WAYLAND to use the Wayland API (experimental and incomplete) 36 // _GLFW_COCOA to use the Cocoa frameworks 37 // 38 // On Linux, _GLFW_X11 and _GLFW_WAYLAND can be combined 39 40 //---------------------------------------------------------------------------------- 41 // Feature Test Macros required for this module 42 //---------------------------------------------------------------------------------- 43 #if (defined(__linux__) || defined(PLATFORM_WEB)) && (_POSIX_C_SOURCE < 199309L) 44 #undef _POSIX_C_SOURCE 45 #define _POSIX_C_SOURCE 199309L // Required for: CLOCK_MONOTONIC if compiled with c99 without gnu ext. 46 #endif 47 #if (defined(__linux__) || defined(PLATFORM_WEB)) && !defined(_GNU_SOURCE) 48 #undef _GNU_SOURCE 49 #define _GNU_SOURCE // Required for: ppoll if compiled with c99 without gnu ext. 50 #endif 51 52 #if defined(_WIN32) || defined(__CYGWIN__) 53 #define _GLFW_WIN32 54 #endif 55 #if defined(__linux__) 56 #if !defined(_GLFW_WAYLAND) && !defined(_GLFW_X11) 57 #error "Cannot disable Wayland and X11 at the same time" 58 #endif 59 #endif 60 #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) 61 #define _GLFW_X11 62 #endif 63 #if defined(__APPLE__) 64 #define _GLFW_COCOA 65 #define _GLFW_USE_MENUBAR // To create and populate the menu bar when the first window is created 66 #define _GLFW_USE_RETINA // To have windows use the full resolution of Retina displays 67 #endif 68 #if defined(__TINYC__) 69 #define _WIN32_WINNT_WINXP 0x0501 70 #endif 71 72 // Common modules to all platforms 73 #include "external/glfw/src/init.c" 74 #include "external/glfw/src/platform.c" 75 #include "external/glfw/src/context.c" 76 #include "external/glfw/src/monitor.c" 77 #include "external/glfw/src/window.c" 78 #include "external/glfw/src/input.c" 79 #include "external/glfw/src/vulkan.c" 80 81 #if defined(_WIN32) || defined(__CYGWIN__) 82 #include "external/glfw/src/win32_init.c" 83 #include "external/glfw/src/win32_module.c" 84 #include "external/glfw/src/win32_monitor.c" 85 #include "external/glfw/src/win32_window.c" 86 #include "external/glfw/src/win32_joystick.c" 87 #include "external/glfw/src/win32_time.c" 88 #include "external/glfw/src/win32_thread.c" 89 #include "external/glfw/src/wgl_context.c" 90 91 #include "external/glfw/src/egl_context.c" 92 #include "external/glfw/src/osmesa_context.c" 93 #endif 94 95 #if defined(__linux__) 96 #include "external/glfw/src/posix_module.c" 97 #include "external/glfw/src/posix_thread.c" 98 #include "external/glfw/src/posix_time.c" 99 #include "external/glfw/src/posix_poll.c" 100 #include "external/glfw/src/linux_joystick.c" 101 #include "external/glfw/src/xkb_unicode.c" 102 103 #include "external/glfw/src/egl_context.c" 104 #include "external/glfw/src/osmesa_context.c" 105 106 #if defined(_GLFW_WAYLAND) 107 #include "external/glfw/src/wl_init.c" 108 #include "external/glfw/src/wl_monitor.c" 109 #include "external/glfw/src/wl_window.c" 110 #endif 111 #if defined(_GLFW_X11) 112 #include "external/glfw/src/x11_init.c" 113 #include "external/glfw/src/x11_monitor.c" 114 #include "external/glfw/src/x11_window.c" 115 #include "external/glfw/src/glx_context.c" 116 #endif 117 #endif 118 119 #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined( __NetBSD__) || defined(__DragonFly__) 120 #include "external/glfw/src/posix_module.c" 121 #include "external/glfw/src/posix_thread.c" 122 #include "external/glfw/src/posix_time.c" 123 #include "external/glfw/src/posix_poll.c" 124 #include "external/glfw/src/null_joystick.c" 125 #include "external/glfw/src/xkb_unicode.c" 126 127 #include "external/glfw/src/x11_init.c" 128 #include "external/glfw/src/x11_monitor.c" 129 #include "external/glfw/src/x11_window.c" 130 #include "external/glfw/src/glx_context.c" 131 132 #include "external/glfw/src/egl_context.c" 133 #include "external/glfw/src/osmesa_context.c" 134 #endif 135 136 #if defined(__APPLE__) 137 #include "external/glfw/src/posix_module.c" 138 #include "external/glfw/src/posix_thread.c" 139 #include "external/glfw/src/cocoa_init.m" 140 #include "external/glfw/src/cocoa_joystick.m" 141 #include "external/glfw/src/cocoa_monitor.m" 142 #include "external/glfw/src/cocoa_window.m" 143 #include "external/glfw/src/cocoa_time.c" 144 #include "external/glfw/src/nsgl_context.m" 145 146 #include "external/glfw/src/egl_context.c" 147 #include "external/glfw/src/osmesa_context.c" 148 #endif