mirror of
https://github.com/glfw/glfw.git
synced 2026-09-19 23:43:15 +00:00
Add conditional compilation for platform units
This is a step towards being able to compile GLFW manually without needing to duplicate a lot of platform- or OS-specific logic.
This commit is contained in:
+43
-3
@@ -25,6 +25,18 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#if defined(GLFW_BUILD_WIN32_TIMER) || \
|
||||
defined(GLFW_BUILD_WIN32_MODULE) || \
|
||||
defined(GLFW_BUILD_WIN32_THREAD) || \
|
||||
defined(GLFW_BUILD_COCOA_TIMER) || \
|
||||
defined(GLFW_BUILD_POSIX_TIMER) || \
|
||||
defined(GLFW_BUILD_POSIX_MODULE) || \
|
||||
defined(GLFW_BUILD_POSIX_THREAD) || \
|
||||
defined(GLFW_BUILD_POSIX_POLL) || \
|
||||
defined(GLFW_BUILD_LINUX_JOYSTICK)
|
||||
#error "You must not define these; define zero or more _GLFW_<platform> macros instead"
|
||||
#endif
|
||||
|
||||
#include "null_platform.h"
|
||||
|
||||
#if defined(_GLFW_WIN32)
|
||||
@@ -86,6 +98,10 @@
|
||||
#endif
|
||||
|
||||
#if (defined(_GLFW_X11) || defined(_GLFW_WAYLAND)) && defined(__linux__)
|
||||
#define GLFW_BUILD_LINUX_JOYSTICK
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_BUILD_LINUX_JOYSTICK)
|
||||
#include "linux_joystick.h"
|
||||
#else
|
||||
#define GLFW_LINUX_JOYSTICK_STATE
|
||||
@@ -141,23 +157,47 @@
|
||||
GLFW_GLX_LIBRARY_CONTEXT_STATE
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define GLFW_BUILD_WIN32_THREAD
|
||||
#else
|
||||
#define GLFW_BUILD_POSIX_THREAD
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_BUILD_WIN32_THREAD)
|
||||
#include "win32_thread.h"
|
||||
#define GLFW_PLATFORM_TLS_STATE GLFW_WIN32_TLS_STATE
|
||||
#define GLFW_PLATFORM_MUTEX_STATE GLFW_WIN32_MUTEX_STATE
|
||||
#else
|
||||
#elif defined(GLFW_BUILD_POSIX_THREAD)
|
||||
#include "posix_thread.h"
|
||||
#define GLFW_PLATFORM_TLS_STATE GLFW_POSIX_TLS_STATE
|
||||
#define GLFW_PLATFORM_MUTEX_STATE GLFW_POSIX_MUTEX_STATE
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define GLFW_BUILD_WIN32_TIMER
|
||||
#elif defined(__APPLE__)
|
||||
#define GLFW_BUILD_COCOA_TIMER
|
||||
#else
|
||||
#define GLFW_BUILD_POSIX_TIMER
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_BUILD_WIN32_TIMER)
|
||||
#include "win32_time.h"
|
||||
#define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_WIN32_LIBRARY_TIMER_STATE
|
||||
#elif defined(__APPLE__)
|
||||
#elif defined(GLFW_BUILD_COCOA_TIMER)
|
||||
#include "cocoa_time.h"
|
||||
#define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_COCOA_LIBRARY_TIMER_STATE
|
||||
#else
|
||||
#elif defined(GLFW_BUILD_POSIX_TIMER)
|
||||
#include "posix_time.h"
|
||||
#define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_POSIX_LIBRARY_TIMER_STATE
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define GLFW_BUILD_WIN32_MODULE
|
||||
#else
|
||||
#define GLFW_BUILD_POSIX_MODULE
|
||||
#endif
|
||||
|
||||
#if defined(_GLFW_WAYLAND) || defined(_GLFW_X11)
|
||||
#define GLFW_BUILD_POSIX_POLL
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user