Add support for OpenBSD

There were three patches OpenBSD applied to build Irrlicht, and I implemented two of them. The first required turning off joystick events on OpenBSD, and the second (which I didn't confirm was necessary) required some defines in os.h. The third patch would have added an include to CIrrDeviceLinux.cpp, but the file had changed quite a bit and I could not tell whether this was necessary, so I left it out, and it appears Irrlicht builds fine.
This commit is contained in:
JosiahWI 2021-08-28 11:12:40 -05:00 committed by GitHub
parent 9690c1b3e3
commit 2dc2846c3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

@ -142,7 +142,9 @@
//! Define _IRR_COMPILE_WITH_JOYSTICK_SUPPORT_ if you want joystick events. //! Define _IRR_COMPILE_WITH_JOYSTICK_SUPPORT_ if you want joystick events.
#if !(defined(__FreeBSD__) || defined(__OpenBSD__))
#define _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ #define _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
#endif
#ifdef NO_IRR_COMPILE_WITH_JOYSTICK_EVENTS_ #ifdef NO_IRR_COMPILE_WITH_JOYSTICK_EVENTS_
#undef _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ #undef _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
#endif #endif

@ -25,11 +25,16 @@
#define bswap_16(X) OSReadSwapInt16(&X,0) #define bswap_16(X) OSReadSwapInt16(&X,0)
#define bswap_32(X) OSReadSwapInt32(&X,0) #define bswap_32(X) OSReadSwapInt32(&X,0)
#define bswap_64(X) OSReadSwapInt64(&X,0) #define bswap_64(X) OSReadSwapInt64(&X,0)
#elif defined(__FreeBSD__) || defined(__OpenBSD__) #elif defined(__FreeBSD__)
#include <sys/endian.h> #include <sys/endian.h>
#define bswap_16(X) bswap16(X) #define bswap_16(X) bswap16(X)
#define bswap_32(X) bswap32(X) #define bswap_32(X) bswap32(X)
#define bswap_64(X) bswap64(X) #define bswap_64(X) bswap64(X)
#elif defined(__OpenBSD__)
#include <endian.h>
#define bswap_16(X) letoh16(X)
#define bswap_32(X) letoh32(X)
#define bswap_64(X) letoh64(X)
#elif !defined(_IRR_SOLARIS_PLATFORM_) && !defined(__PPC__) && !defined(_IRR_WINDOWS_API_) #elif !defined(_IRR_SOLARIS_PLATFORM_) && !defined(__PPC__) && !defined(_IRR_WINDOWS_API_)
#include <byteswap.h> #include <byteswap.h>
#else #else