From e323f42ea3e9d6562e8e23ead1b27fbc499d6dfb Mon Sep 17 00:00:00 2001 From: pantonshire Date: Tue, 23 Dec 2025 09:51:05 +0000 Subject: [PATCH] platform detection --- include/platform.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 include/platform.h diff --git a/include/platform.h b/include/platform.h new file mode 100644 index 0000000..1351c1d --- /dev/null +++ b/include/platform.h @@ -0,0 +1,34 @@ +#pragma once + +#if defined(__linux__) +#define PLATFORM_LINUX +#define EVENTLOOP_EPOLL + +#elif defined(__APPLE__) && defined(__MACH__) +#define PLATFORM_OSX +#define EVENTLOOP_KQUEUE + +#elif defined(__FreeBSD__) +#define PLATFORM_BSD +#define PLATFORM_FREEBSD +#define EVENTLOOP_KQUEUE + +#elif defined(__NetBSD__) +#define PLATFORM_BSD +#define PLATFORM_NETBSD +#define EVENTLOOP_KQUEUE + +#elif defined(__OpenBSD__) +#define PLATFORM_BSD +#define PLATFORM_OPENBSD +#define EVENTLOOP_KQUEUE + +#elif defined(__DragonFly__) +#define PLATFORM_BSD +#define PLATFORM_DRAGONFLY +#define EVENTLOOP_KQUEUE + +#else +#error "Failed to detect supported platform" + +#endif