From 5888a20920a3c685bd92fd50183f919724534ac9 Mon Sep 17 00:00:00 2001 From: kirby1 Date: Thu, 14 Dec 2023 10:29:42 +0300 Subject: [PATCH] Add OpenBSD defines --- Global.h | 4 ++++ lib/CStopWatch.h | 4 ++-- lib/CThreadHelper.cpp | 3 ++- lib/modding/CModVersion.h | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Global.h b/Global.h index e3987bbbe..b563299ad 100644 --- a/Global.h +++ b/Global.h @@ -41,6 +41,10 @@ static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size."); # define VCMI_UNIX # define VCMI_XDG # define VCMI_FREEBSD +#elif defined(__OpenBSD__) +# define VCMI_UNIX +# define VCMI_XDG +# define VCMI_OPENBSD #elif defined(__HAIKU__) # define VCMI_UNIX # define VCMI_XDG diff --git a/lib/CStopWatch.h b/lib/CStopWatch.h index 08167eb3f..48d71a62e 100644 --- a/lib/CStopWatch.h +++ b/lib/CStopWatch.h @@ -9,7 +9,7 @@ */ #pragma once -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__OpenBSD__) #include #include #include @@ -55,7 +55,7 @@ public: private: si64 clock() { - #ifdef __FreeBSD__ // TODO: enable also for Apple? + #if defined(__FreeBSD__) || defined(__OpenBSD__) // TODO: enable also for Apple? struct rusage usage; getrusage(RUSAGE_SELF, &usage); return static_cast(usage.ru_utime.tv_sec + usage.ru_stime.tv_sec) * 1000000 + usage.ru_utime.tv_usec + usage.ru_stime.tv_usec; diff --git a/lib/CThreadHelper.cpp b/lib/CThreadHelper.cpp index 66f3bf7f9..fd98e279b 100644 --- a/lib/CThreadHelper.cpp +++ b/lib/CThreadHelper.cpp @@ -14,7 +14,8 @@ #include #elif defined(VCMI_HAIKU) #include -#elif !defined(VCMI_APPLE) && !defined(VCMI_FREEBSD) && !defined(VCMI_HURD) +#elif !defined(VCMI_APPLE) && !defined(VCMI_FREEBSD) && \ + !defined(VCMI_HURD) && !defined(VCMI_OPENBSD) #include #endif diff --git a/lib/modding/CModVersion.h b/lib/modding/CModVersion.h index 221decb88..40197d340 100644 --- a/lib/modding/CModVersion.h +++ b/lib/modding/CModVersion.h @@ -10,7 +10,7 @@ #pragma once -#if defined(__UCLIBC__) || defined(__FreeBSD__) +#if defined(__UCLIBC__) || defined(__FreeBSD__) || defined(__OpenBSD__) #undef major #undef minor #undef patch